Compare commits
No commits in common. "bce7b1cdd473b78254c963fac0ec7c96d4a63b8f" and "76d314ec00fe3922f67799cdefde0c284ef08657" have entirely different histories.
bce7b1cdd4
...
76d314ec00
22 changed files with 754 additions and 857 deletions
|
@ -1,11 +0,0 @@
|
||||||
name: Push Action
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '!**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
uses: ./.gitea/workflows/test.yml
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
name: Tag Action
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
uses: ./.gitea/workflows/test.yml
|
|
||||||
release_code:
|
|
||||||
needs: test
|
|
||||||
uses: ./.gitea/workflows/release_code.yml
|
|
||||||
release_amd:
|
|
||||||
needs: [test, release_code]
|
|
||||||
uses: ./.gitea/workflows/release_amd.yml
|
|
|
@ -1,36 +0,0 @@
|
||||||
name: Outbag AMD Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
secrets:
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-amd:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
npm run bundleRelease
|
|
||||||
|
|
||||||
- name: Build AMD
|
|
||||||
run: |
|
|
||||||
npm run build-amd
|
|
||||||
mkdir upload
|
|
||||||
cp build/bin/* upload
|
|
||||||
|
|
||||||
- name: Create Release AMD
|
|
||||||
id: gitea-release-amd
|
|
||||||
uses: actions/release-action@main
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
upload/**
|
|
||||||
api_key: '${{ secrets.RELEASE_TOKEN }}'
|
|
|
@ -1,43 +0,0 @@
|
||||||
name: Outbag Code release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
secrets:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-code:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
npm run prepublish
|
|
||||||
|
|
||||||
- name: Build Code
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install zip tar -y
|
|
||||||
mkdir outbag_server
|
|
||||||
mkdir outbag_server/dist
|
|
||||||
mkdir upload
|
|
||||||
cp -r dist/* outbag_server/dist
|
|
||||||
cp package.json outbag_server
|
|
||||||
cp package-lock.json outbag_server
|
|
||||||
cp readme.md outbag_server
|
|
||||||
zip -r upload/OutbagServer.zip outbag_server/*
|
|
||||||
tar -czvf upload/OutbagServer.tar.gz outbag_server/*
|
|
||||||
|
|
||||||
- name: Create Release Code
|
|
||||||
id: gitea-release-code
|
|
||||||
uses: actions/release-action@main
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
upload/**
|
|
||||||
api_key: '${{ secrets.RELEASE_TOKEN }}'
|
|
|
@ -1,38 +0,0 @@
|
||||||
name: Outbag Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
secrets:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
services:
|
|
||||||
database:
|
|
||||||
image: mariadb
|
|
||||||
env:
|
|
||||||
MYSQL_DATABASE: outbag
|
|
||||||
MYSQL_USER: outbag
|
|
||||||
MYSQL_PASSWORD: 12345678
|
|
||||||
MYSQL_ROOT_PASSWORD: 12345678
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
- name: Build Outbag
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
npm run prepublish
|
|
||||||
npm run bundleRelease
|
|
||||||
- name: Generate Self-Signed Cert
|
|
||||||
run:
|
|
||||||
sh genSelfSignedCert.sh
|
|
||||||
- name: Run Tests
|
|
||||||
run: |
|
|
||||||
node tests/ws.js ci
|
|
||||||
node tests/post.js ci
|
|
1004
package-lock.json
generated
1004
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -4,4 +4,3 @@ export * from "./acts/admin.js"
|
||||||
export * from "./acts/rooms.js"
|
export * from "./acts/rooms.js"
|
||||||
export * from "./acts/server.js"
|
export * from "./acts/server.js"
|
||||||
export * from "./acts/roomContent.js"
|
export * from "./acts/roomContent.js"
|
||||||
export * from "./acts/subscribe.js"
|
|
|
@ -17,7 +17,6 @@ export const getAccounts: Act = {
|
||||||
accounts.name,
|
accounts.name,
|
||||||
accounts.viewable,
|
accounts.viewable,
|
||||||
accounts.deleted,
|
accounts.deleted,
|
||||||
accounts.deletedTime,
|
|
||||||
accounts.maxRooms,
|
accounts.maxRooms,
|
||||||
accounts.maxRoomSize,
|
accounts.maxRoomSize,
|
||||||
accounts.maxUsersPerRoom
|
accounts.maxUsersPerRoom
|
||||||
|
@ -29,12 +28,11 @@ export const getAccounts: Act = {
|
||||||
let name = d[accounts.name];
|
let name = d[accounts.name];
|
||||||
let viewable = d[accounts.viewable] ? true : false;
|
let viewable = d[accounts.viewable] ? true : false;
|
||||||
let deleted = d[accounts.deleted] ? true : false;
|
let deleted = d[accounts.deleted] ? true : false;
|
||||||
let deletedTime = Number(d[accounts.deletedTime]);
|
|
||||||
let maxRooms = d[accounts.maxRooms];
|
let maxRooms = d[accounts.maxRooms];
|
||||||
let maxRoomSize = d[accounts.maxRoomSize];
|
let maxRoomSize = d[accounts.maxRoomSize];
|
||||||
let maxUsersPerRoom = d[accounts.maxUsersPerRoom];
|
let maxUsersPerRoom = d[accounts.maxUsersPerRoom];
|
||||||
if (accID != null && rights != null && name != null && viewable != null && deleted != null && maxRooms != null && maxRoomSize != null && maxUsersPerRoom != null && deletedTime != null) {
|
if (accID != null && rights != null && name != null && viewable != null && deleted != null && maxRooms != null && maxRoomSize != null && maxUsersPerRoom != null) {
|
||||||
return { accID, rights, name, viewable, deleted, deletedTime, maxRooms, maxRoomSize, maxUsersPerRoom };
|
return { accID, rights, name, viewable, deleted, maxRooms, maxRoomSize, maxUsersPerRoom };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -42,23 +40,6 @@ export const getAccounts: Act = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const recoverAccount: Act = {
|
|
||||||
state: STATE.client,
|
|
||||||
right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_USERS,
|
|
||||||
data: {
|
|
||||||
accID: "number"
|
|
||||||
},
|
|
||||||
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
|
|
||||||
let req = await update(accounts)
|
|
||||||
.set(accounts.deleted, false)
|
|
||||||
.set(accounts.deletedTime, 0)
|
|
||||||
.where(eq(accounts.accID, data.accID))
|
|
||||||
.query(db);
|
|
||||||
if(req.affectedRows > 0) aws("ok", "");
|
|
||||||
else aws("error", act_error.ACCOUNT_NOT_EXISTS)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const setPermissions: Act = {
|
export const setPermissions: Act = {
|
||||||
state: STATE.client,
|
state: STATE.client,
|
||||||
right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_RIGHTS,
|
right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_RIGHTS,
|
||||||
|
|
|
@ -6,8 +6,6 @@ import { isCategoryInRoom, isItemInRoom, isProductInRoom, isRoomDataFull } from
|
||||||
import { ROOM_RIGHTS } from "../../server/permissions.js";
|
import { ROOM_RIGHTS } from "../../server/permissions.js";
|
||||||
import { act_error } from "../../server/errors.js";
|
import { act_error } from "../../server/errors.js";
|
||||||
import { uts } from "../../sys/tools.js";
|
import { uts } from "../../sys/tools.js";
|
||||||
import { sendRoomListeners } from "../listener.js";
|
|
||||||
import { LISTENER_ACTION, LISTENER_TYPE } from "../../server/listener.js";
|
|
||||||
|
|
||||||
export const getCategories: Act = {
|
export const getCategories: Act = {
|
||||||
state: STATE.client | STATE.remote,
|
state: STATE.client | STATE.remote,
|
||||||
|
@ -130,12 +128,10 @@ export const addCategory: Act = {
|
||||||
.where(eq(listCategories.roomID, roomID))
|
.where(eq(listCategories.roomID, roomID))
|
||||||
.limit(1)
|
.limit(1)
|
||||||
).query(db);
|
).query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", {
|
||||||
aws("ok", {
|
|
||||||
catID: Number(req.insertId)
|
catID: Number(req.insertId)
|
||||||
});
|
});
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.CATEGORIES, LISTENER_ACTION.ADD, [req.insertId]);
|
else aws("error", act_error.ADD_CAT);
|
||||||
} else aws("error", act_error.ADD_CAT);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,10 +165,8 @@ export const changeCategory: Act = {
|
||||||
eq(listCategories.listCatID, data.listCatID)
|
eq(listCategories.listCatID, data.listCatID)
|
||||||
))
|
))
|
||||||
.query(db);
|
.query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.CAT_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.CATEGORIES, LISTENER_ACTION.CHANGE, [data.listCatID]);
|
|
||||||
} else aws("error", act_error.CAT_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -208,10 +202,8 @@ export const changeCategoriesOrder: Act = {
|
||||||
.query(db);
|
.query(db);
|
||||||
affacted += req.affectedRows;
|
affacted += req.affectedRows;
|
||||||
}
|
}
|
||||||
if (affacted > 0) {
|
if (affacted > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.CAT_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.CATEGORIES, LISTENER_ACTION.CHANGE, data.listCatIDs);
|
|
||||||
} else aws("error", act_error.CAT_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -241,10 +233,8 @@ export const deleteCategory: Act = {
|
||||||
eq(listCategories.listCatID, data.listCatID)
|
eq(listCategories.listCatID, data.listCatID)
|
||||||
))
|
))
|
||||||
.query(db);
|
.query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.CAT_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.CATEGORIES, LISTENER_ACTION.DELETE, [data.listCatID]);
|
|
||||||
} else aws("error", act_error.CAT_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -393,12 +383,10 @@ export const addProduct: Act = {
|
||||||
data.ean,
|
data.ean,
|
||||||
data.parent != null ? data.parent : null,
|
data.parent != null ? data.parent : null,
|
||||||
).query(db);
|
).query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", {
|
||||||
aws("ok", {
|
|
||||||
listProdID: Number(req.insertId)
|
listProdID: Number(req.insertId)
|
||||||
});
|
});
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.PRODUCTS, LISTENER_ACTION.ADD, [req.insertId]);
|
else aws("error", act_error.ADD_PROD);
|
||||||
} else aws("error", act_error.ADD_PROD);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -446,10 +434,8 @@ export const changeProduct: Act = {
|
||||||
eq(listProducts.roomID, roomID),
|
eq(listProducts.roomID, roomID),
|
||||||
))
|
))
|
||||||
.query(db);
|
.query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.PROD_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.PRODUCTS, LISTENER_ACTION.CHANGE, [data.listProdID]);
|
|
||||||
} else aws("error", act_error.PROD_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -479,10 +465,8 @@ export const deleteProduct: Act = {
|
||||||
eq(listProducts.listProdID, data.listProdID),
|
eq(listProducts.listProdID, data.listProdID),
|
||||||
eq(listProducts.roomID, roomID),
|
eq(listProducts.roomID, roomID),
|
||||||
)).query(db);
|
)).query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.PROD_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.PRODUCTS, LISTENER_ACTION.DELETE, [data.listProdID]);
|
|
||||||
} else aws("error", act_error.PROD_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -575,7 +559,7 @@ export const getItem: Act = {
|
||||||
], listItems)
|
], listItems)
|
||||||
.where(and(
|
.where(and(
|
||||||
eq(listItems.listItemID, data.listItemID),
|
eq(listItems.listItemID, data.listItemID),
|
||||||
eq(listItems.roomID, roomID)
|
eq(listItems.roomID, data.roomID)
|
||||||
))
|
))
|
||||||
.query(db);
|
.query(db);
|
||||||
if (req.length > 0) {
|
if (req.length > 0) {
|
||||||
|
@ -652,12 +636,10 @@ export const addItem: Act = {
|
||||||
data.value,
|
data.value,
|
||||||
data.listProdID != null ? data.listProdID : null,
|
data.listProdID != null ? data.listProdID : null,
|
||||||
).query(db);
|
).query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", {
|
||||||
aws("ok", {
|
|
||||||
listItemID: Number(req.insertId)
|
listItemID: Number(req.insertId)
|
||||||
});
|
});
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ITEMS, LISTENER_ACTION.ADD, [req.insertId]);
|
else aws("error", act_error.ADD_ITEM);
|
||||||
} else aws("error", act_error.ADD_ITEM);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -702,13 +684,11 @@ export const changeItem: Act = {
|
||||||
.set(listItems.link, data.listProdID != null ? data.listProdID : null)
|
.set(listItems.link, data.listProdID != null ? data.listProdID : null)
|
||||||
.where(and(
|
.where(and(
|
||||||
eq(listItems.listItemID, data.listItemID),
|
eq(listItems.listItemID, data.listItemID),
|
||||||
eq(listItems.roomID, roomID)
|
eq(listItems.roomID, data.roomID)
|
||||||
))
|
))
|
||||||
.query(db);
|
.query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.ITEM_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ITEMS, LISTENER_ACTION.CHANGE, [data.listItemID]);
|
|
||||||
} else aws("error", act_error.ITEM_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -743,10 +723,8 @@ export const changeItemState: Act = {
|
||||||
eq(listItems.roomID, roomID)
|
eq(listItems.roomID, roomID)
|
||||||
))
|
))
|
||||||
.query(db);
|
.query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.ITEM_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ITEMS, LISTENER_ACTION.CHANGE, [data.listItemID]);
|
|
||||||
} else aws("error", act_error.ITEM_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -775,12 +753,7 @@ export const changeItemStates: Act = {
|
||||||
if (
|
if (
|
||||||
data.listItemIDs.length != data.changedTimes.length
|
data.listItemIDs.length != data.changedTimes.length
|
||||||
|| data.changedTimes.length != data.states.length
|
|| data.changedTimes.length != data.states.length
|
||||||
) return void aws("error", act_error.DATA);
|
) return void aws("error", "data");
|
||||||
for (let i = 0; i < data.listItemIDs.length; i++) {
|
|
||||||
let id = data.listItemIDs[i];
|
|
||||||
if (typeof id != "number" || id < 0)
|
|
||||||
return void aws("error", act_error.DATA);
|
|
||||||
}
|
|
||||||
for (let i = 0; i < data.listItemIDs.length; i++) {
|
for (let i = 0; i < data.listItemIDs.length; i++) {
|
||||||
let id = data.listItemIDs[i];
|
let id = data.listItemIDs[i];
|
||||||
let time = data.changedTimes[i];
|
let time = data.changedTimes[i];
|
||||||
|
@ -796,7 +769,6 @@ export const changeItemStates: Act = {
|
||||||
.query(db);
|
.query(db);
|
||||||
}
|
}
|
||||||
aws("ok", "");
|
aws("ok", "");
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ITEMS, LISTENER_ACTION.CHANGE, data.listItemIDs);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -825,10 +797,8 @@ export const deleteItem: Act = {
|
||||||
eq(listItems.listItemID, data.listItemID),
|
eq(listItems.listItemID, data.listItemID),
|
||||||
eq(listItems.roomID, roomID)
|
eq(listItems.roomID, roomID)
|
||||||
)).query(db);
|
)).query(db);
|
||||||
if (req.affectedRows > 0) {
|
if (req.affectedRows > 0) aws("ok", "");
|
||||||
aws("ok", "");
|
else aws("error", act_error.ITEM_NOT_EXISTS);
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ITEMS, LISTENER_ACTION.DELETE, [data.listItemID]);
|
|
||||||
} else aws("error", act_error.ITEM_NOT_EXISTS);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export const deleteItemByState: Act = {
|
export const deleteItemByState: Act = {
|
||||||
|
@ -857,6 +827,5 @@ export const deleteItemByState: Act = {
|
||||||
eq(listItems.roomID, roomID)
|
eq(listItems.roomID, roomID)
|
||||||
)).query(db);
|
)).query(db);
|
||||||
aws("ok", "");
|
aws("ok", "");
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ITEMS, LISTENER_ACTION.DELETE, []);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,6 @@ import { isRoomFull } from "../helper.js";
|
||||||
import { fetchRemoteAsServer } from "../server.js";
|
import { fetchRemoteAsServer } from "../server.js";
|
||||||
import { Act, Client, STATE } from "../user.js";
|
import { Act, Client, STATE } from "../user.js";
|
||||||
import { act_error } from "../../server/errors.js";
|
import { act_error } from "../../server/errors.js";
|
||||||
import { sendRoomListeners } from "../listener.js";
|
|
||||||
import { LISTENER_ACTION, LISTENER_TYPE } from "../../server/listener.js";
|
|
||||||
|
|
||||||
export const listRooms: Act = {
|
export const listRooms: Act = {
|
||||||
state: STATE.client | STATE.remote,
|
state: STATE.client | STATE.remote,
|
||||||
|
@ -48,7 +46,7 @@ export const listRooms: Act = {
|
||||||
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null && confirmed != null) {
|
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null && confirmed != null) {
|
||||||
return { name, server, owner, rights, visibility, title, description, icon, debug: global.debug, confirmed };
|
return { name, server, owner, rights, visibility, title, description, icon, debug: global.debug, confirmed };
|
||||||
}
|
}
|
||||||
//console.log(name, server, owner, rights, visibility, title, description, icon, global.debug, confirmed)
|
console.log(name, server, owner, rights, visibility, title, description, icon, global.debug, confirmed)
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (client.state == STATE.client) {
|
if (client.state == STATE.client) {
|
||||||
|
@ -610,7 +608,6 @@ export const setAdminStatus: Act = {
|
||||||
} else {
|
} else {
|
||||||
aws("error", act_error.MEMBER_NOT_EXISTS);
|
aws("error", act_error.MEMBER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ROOMINFO, LISTENER_ACTION.CHANGE, []);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -620,7 +617,6 @@ export const leaveRoom: Act = {
|
||||||
data: {
|
data: {
|
||||||
room: "string",
|
room: "string",
|
||||||
server: "string",
|
server: "string",
|
||||||
// TODO: add force option for remote rooms
|
|
||||||
},
|
},
|
||||||
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
|
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
|
||||||
if (!checkSelfTag(data.server)) {
|
if (!checkSelfTag(data.server)) {
|
||||||
|
@ -710,7 +706,6 @@ export const setRoomRight: Act = {
|
||||||
.where(eq(rooms.roomID, roomID))
|
.where(eq(rooms.roomID, roomID))
|
||||||
.query(db);
|
.query(db);
|
||||||
aws("ok", "");
|
aws("ok", "");
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ROOMINFO, LISTENER_ACTION.CHANGE, []);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -740,6 +735,5 @@ export const changeRoomMeta: Act = {
|
||||||
.where(eq(rooms.roomID, roomID))
|
.where(eq(rooms.roomID, roomID))
|
||||||
.query(db);
|
.query(db);
|
||||||
aws("ok", "");
|
aws("ok", "");
|
||||||
sendRoomListeners(roomID, LISTENER_TYPE.ROOMINFO, LISTENER_ACTION.CHANGE, []);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -1,68 +0,0 @@
|
||||||
import { act_error } from "../../server/errors.js";
|
|
||||||
import { checkSelfTag } from "../../server/outbagURL.js";
|
|
||||||
import { Act, Client, STATE } from "../user.js";
|
|
||||||
import { wsClient } from "../ws.js";
|
|
||||||
|
|
||||||
export const subscribeRoom: Act = {
|
|
||||||
state: STATE.client | STATE.remote,
|
|
||||||
right: 0,
|
|
||||||
data: {
|
|
||||||
room: "name",
|
|
||||||
server: "string",
|
|
||||||
},
|
|
||||||
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
|
|
||||||
if (!(client.connectionClient instanceof wsClient)) {
|
|
||||||
return void aws("error", act_error.CONNECTION);
|
|
||||||
}
|
|
||||||
if (!checkSelfTag(data.server)) {
|
|
||||||
throw new Error("Remote not yet implemented.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const roomID = await client.isInRoom(data.room);
|
|
||||||
if (roomID == -1) {
|
|
||||||
aws("error", act_error.NOT_IN_ROOM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
client.connectionClient.listenRoom(roomID, data.room, data.server);
|
|
||||||
aws("ok", "");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const unsubscribeRoom: Act = {
|
|
||||||
state: STATE.client | STATE.remote,
|
|
||||||
right: 0,
|
|
||||||
data: {
|
|
||||||
room: "name",
|
|
||||||
server: "string",
|
|
||||||
},
|
|
||||||
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
|
|
||||||
if (!(client.connectionClient instanceof wsClient)) {
|
|
||||||
return void aws("error", act_error.CONNECTION);
|
|
||||||
}
|
|
||||||
if (!checkSelfTag(data.server)) {
|
|
||||||
throw new Error("Remote not yet implemented.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const roomID = await client.isInRoom(data.room);
|
|
||||||
if (roomID == -1) {
|
|
||||||
aws("error", act_error.NOT_IN_ROOM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
client.connectionClient.unlistenRoom(roomID);
|
|
||||||
aws("ok", "");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const unsubscribeAllRooms: Act = {
|
|
||||||
state: STATE.client | STATE.remote,
|
|
||||||
right: 0,
|
|
||||||
data: {},
|
|
||||||
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
|
|
||||||
if (!(client.connectionClient instanceof wsClient)) {
|
|
||||||
return void aws("error", act_error.CONNECTION);
|
|
||||||
}
|
|
||||||
// TODO: When implemented close remote listeners
|
|
||||||
client.connectionClient.unlistenAllRooms();
|
|
||||||
aws("ok", "");
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,38 +0,0 @@
|
||||||
import { wsClient } from "./ws.js"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface RoomListener {
|
|
||||||
client: wsClient;
|
|
||||||
room: string;
|
|
||||||
server: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
let roomListeners: { [key: number]: RoomListener[] } = {};
|
|
||||||
|
|
||||||
export const sendRoomListeners = async (roomID: number, type: string | number, action: number, ids: number[]) => {
|
|
||||||
for (const listener of roomListeners[roomID] ?? []) {
|
|
||||||
listener.client.sendFromServer({
|
|
||||||
room: listener.room,
|
|
||||||
server: listener.server,
|
|
||||||
type,
|
|
||||||
action,
|
|
||||||
ids,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const addRoomListener = (client: wsClient, roomID: number, room: string, server: string) => {
|
|
||||||
if (!Array.isArray(roomListeners[roomID])) roomListeners[roomID] = [];
|
|
||||||
const existingListener = roomListeners[roomID].find(listener => listener.client === client);
|
|
||||||
if (!existingListener) roomListeners[roomID].push({ client, room, server });
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
export const removeRoomListener = (client: wsClient, roomID: number | null = null) => {
|
|
||||||
let keys = roomID == null ? Object.keys(roomListeners) as any : [roomID];
|
|
||||||
for (const key of keys) {
|
|
||||||
roomListeners[key] = roomListeners[key].filter(listener => listener.client !== client);
|
|
||||||
if (roomListeners[key].length === 0) delete roomListeners[key];
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -116,8 +116,7 @@ export const addPostMethods = (server: express.Express) => {
|
||||||
export class postClient {
|
export class postClient {
|
||||||
lastReq = uts();
|
lastReq = uts();
|
||||||
client: Client;
|
client: Client;
|
||||||
constructor(ip: string, client: Client | null = null) {
|
constructor(ip: string, client = new Client(ip)) {
|
||||||
if (client === null) client = new Client(ip, this);
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
async runAct(act: Act, json: any, aws: (state: string, data: any) => void) {
|
async runAct(act: Act, json: any, aws: (state: string, data: any) => void) {
|
||||||
|
|
|
@ -5,8 +5,6 @@ import { outbagServer, outbagURLfromTag } from "../server/outbagURL.js";
|
||||||
import { fetchRemoteAs } from "./server.js";
|
import { fetchRemoteAs } from "./server.js";
|
||||||
import { debug } from "../sys/log.js";
|
import { debug } from "../sys/log.js";
|
||||||
import { act_error } from "../server/errors.js";
|
import { act_error } from "../server/errors.js";
|
||||||
import { wsClient } from "./ws.js";
|
|
||||||
import { postClient } from "./post.js";
|
|
||||||
|
|
||||||
export const STATE = {
|
export const STATE = {
|
||||||
no: 0b00001,
|
no: 0b00001,
|
||||||
|
@ -42,10 +40,7 @@ export class Client {
|
||||||
challenge: string = "";
|
challenge: string = "";
|
||||||
remoteKey: string = "";
|
remoteKey: string = "";
|
||||||
|
|
||||||
connectionClient: wsClient | postClient;
|
constructor(ip: string) {
|
||||||
|
|
||||||
constructor(ip: string, client: wsClient | postClient) {
|
|
||||||
this.connectionClient = client;
|
|
||||||
this.server = new outbagServer("", "", "", "");
|
this.server = new outbagServer("", "", "", "");
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { Act, checktype, Client } from "./user.js";
|
||||||
import { debug, error } from "../sys/log.js";
|
import { debug, error } from "../sys/log.js";
|
||||||
import * as importActs from "./acts.js"
|
import * as importActs from "./acts.js"
|
||||||
import { act_error } from "../server/errors.js";
|
import { act_error } from "../server/errors.js";
|
||||||
import { addRoomListener, removeRoomListener } from "./listener.js";
|
|
||||||
|
|
||||||
let acts = importActs as { [key: string]: Act };
|
let acts = importActs as { [key: string]: Act };
|
||||||
|
|
||||||
|
@ -31,11 +30,9 @@ export class wsClient {
|
||||||
activeRequests = 0;
|
activeRequests = 0;
|
||||||
client: Client;
|
client: Client;
|
||||||
constructor(socket: ws.WebSocket, req: http.IncomingMessage) {
|
constructor(socket: ws.WebSocket, req: http.IncomingMessage) {
|
||||||
this.client = new Client(req.socket.remoteAddress ?? "", this);
|
this.client = new Client(req.socket.remoteAddress ?? "");
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
|
|
||||||
clients.push(this);
|
|
||||||
|
|
||||||
socket.on("message", async (msg: any) => {
|
socket.on("message", async (msg: any) => {
|
||||||
try {
|
try {
|
||||||
this.activeRequests++;
|
this.activeRequests++;
|
||||||
|
@ -144,7 +141,6 @@ export class wsClient {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('close', () => {
|
socket.on('close', () => {
|
||||||
this.unlistenAllRooms();
|
|
||||||
this.open = false;
|
this.open = false;
|
||||||
var i = clients.indexOf(this);
|
var i = clients.indexOf(this);
|
||||||
delete clients[i];
|
delete clients[i];
|
||||||
|
@ -156,7 +152,6 @@ export class wsClient {
|
||||||
|
|
||||||
close(ms: number) {
|
close(ms: number) {
|
||||||
return new Promise<void>(res => {
|
return new Promise<void>(res => {
|
||||||
this.unlistenAllRooms();
|
|
||||||
if (this.activeRequests == 0) {
|
if (this.activeRequests == 0) {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
return void res();
|
return void res();
|
||||||
|
@ -167,34 +162,6 @@ export class wsClient {
|
||||||
}, Math.max(100, ms));
|
}, Math.max(100, ms));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFromServer(data: any): Promise<boolean> {
|
|
||||||
if (this.socket.readyState != WebSocket.OPEN) {
|
|
||||||
return Promise.resolve(false);
|
|
||||||
}
|
|
||||||
return new Promise((res, rej) => {
|
|
||||||
this.socket.send(JSON.stringify({
|
|
||||||
id: -1,
|
|
||||||
state: "server",
|
|
||||||
data: data
|
|
||||||
}), (err) => {
|
|
||||||
if(err) return void rej(false);
|
|
||||||
return void res(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
listenRoom(roomID: number, room: string, server: string) {
|
|
||||||
addRoomListener(this, roomID, room, server);
|
|
||||||
}
|
|
||||||
unlistenRoom(roomID: number) {
|
|
||||||
removeRoomListener(this, roomID);
|
|
||||||
}
|
|
||||||
unlistenAllRooms() {
|
|
||||||
removeRoomListener(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const closeWebSocket = async () => {
|
export const closeWebSocket = async () => {
|
||||||
|
|
|
@ -124,7 +124,7 @@ async function complete_loaded() {
|
||||||
await nman.shutdown();
|
await nman.shutdown();
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
warn("Outbag", "Keep running due to debug Mode");
|
warn("Outbag", "Keep running tue to debug Mode");
|
||||||
}
|
}
|
||||||
activatePost();
|
activatePost();
|
||||||
activateWS();
|
activateWS();
|
||||||
|
|
|
@ -10,7 +10,6 @@ export const act_error = {
|
||||||
SERVER: "server", // uncaught error in server
|
SERVER: "server", // uncaught error in server
|
||||||
RECURSION: "recursion", // not allowed due to suspected remote recursion, will only appear with miss configureation
|
RECURSION: "recursion", // not allowed due to suspected remote recursion, will only appear with miss configureation
|
||||||
REMOTE: "remote", // error while remote request (like could not contact the remote server)
|
REMOTE: "remote", // error while remote request (like could not contact the remote server)
|
||||||
CONNECTION: "connection", // the current connection type is not correct
|
|
||||||
|
|
||||||
CLIENT_NOT_EXISTS: "clientnotexists", // seems like your own account does not exists (client.ts acts)
|
CLIENT_NOT_EXISTS: "clientnotexists", // seems like your own account does not exists (client.ts acts)
|
||||||
ACCOUNT_NOT_EXISTS: "accountnotexists", // referred account does not exists (admin / client trennen? )
|
ACCOUNT_NOT_EXISTS: "accountnotexists", // referred account does not exists (admin / client trennen? )
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
export const LISTENER_TYPE = {
|
|
||||||
ROOMINFO: 0,
|
|
||||||
ITEMS: 1,
|
|
||||||
CATEGORIES: 2,
|
|
||||||
PRODUCTS: 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
export const LISTENER_ACTION = {
|
|
||||||
ADD: 0,
|
|
||||||
CHANGE: 1,
|
|
||||||
DELETE: 2,
|
|
||||||
}
|
|
|
@ -37,11 +37,10 @@ export const warn = (name: string, ...args: any[]) => {
|
||||||
let dateString = (new Date()).toLocaleString();
|
let dateString = (new Date()).toLocaleString();
|
||||||
console.warn(
|
console.warn(
|
||||||
"\x1b[33m%s\x1b[0m" +
|
"\x1b[33m%s\x1b[0m" +
|
||||||
"\x1b[1m\x1b[48;5;208m%s\x1b[0m\x1b[48;5;208m",
|
"\x1b[1m\x1b[36m%s\x1b[0m",
|
||||||
dateString+" ",
|
dateString,
|
||||||
` [${name}]:`,
|
` [${name}]:`,
|
||||||
...args,
|
...args
|
||||||
"\x1b[0m"
|
|
||||||
);
|
);
|
||||||
if (global.provideLog != 0) logList.push([logID++, "warn", dateString, name, args]);
|
if (global.provideLog != 0) logList.push([logID++, "warn", dateString, name, args]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
PORT=7224
|
PORT=7224
|
||||||
PORTexposed=7224
|
PORTexposed=7224
|
||||||
PATHexposed=/
|
PATHexposed=/
|
||||||
URL=127.0.0.1
|
URL=localhost
|
||||||
CertLiveSec=2592000
|
CertLiveSec=2592000
|
||||||
|
|
||||||
[ssl]
|
[ssl]
|
||||||
|
@ -26,4 +26,3 @@ defaultMaxRooms=2
|
||||||
defaultMaxRoomSize=10
|
defaultMaxRoomSize=10
|
||||||
defaultMaxUsersPerRoom=2
|
defaultMaxUsersPerRoom=2
|
||||||
defaultViewable=true
|
defaultViewable=true
|
||||||
deletedAccountKeepSec=1728000
|
|
||||||
|
|
|
@ -18,29 +18,29 @@ const list = [
|
||||||
["signup", async (req) => {
|
["signup", async (req) => {
|
||||||
await req({}, "signup", {
|
await req({}, "signup", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
|
|
||||||
await req({}, "signup", {
|
await req({}, "signup", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.ACCOUNT_EXISTS);
|
}, "error", act_error.ACCOUNT_EXISTS);
|
||||||
|
|
||||||
await req({}, "signup", {
|
await req({}, "signup", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
|
|
||||||
await req({}, "signup", {
|
await req({}, "signup", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.config);
|
}, "error", act_error.config);
|
||||||
}], ["remote", async (req) => {
|
}], ["remote", async (req) => {
|
||||||
let signature = (await req({ "authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}` },
|
let signature = (await req({ "authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}` },
|
||||||
"createSignature", {
|
"createSignature", {
|
||||||
publicKey
|
publicKey
|
||||||
}, "ok", null)).sign;
|
}, "ok", null)).sign;
|
||||||
|
@ -51,7 +51,7 @@ const list = [
|
||||||
"authorization": `Bearer ${token}`
|
"authorization": `Bearer ${token}`
|
||||||
}, "remote1", {
|
}, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7223",
|
server: "localhost:7223",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: signature
|
sign: signature
|
||||||
}, "error", act_error.SIGNATURE);
|
}, "error", act_error.SIGNATURE);
|
||||||
|
@ -60,7 +60,7 @@ const list = [
|
||||||
"authorization": `Bearer ${token}`
|
"authorization": `Bearer ${token}`
|
||||||
}, "remote1", {
|
}, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: falseSignature
|
sign: falseSignature
|
||||||
}, "error", act_error.SIGNATURE);
|
}, "error", act_error.SIGNATURE);
|
||||||
|
@ -69,7 +69,7 @@ const list = [
|
||||||
"authorization": `Bearer ${token}`
|
"authorization": `Bearer ${token}`
|
||||||
}, "remote1", {
|
}, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: signature
|
sign: signature
|
||||||
}, "ok", null)).challenge;
|
}, "ok", null)).challenge;
|
||||||
|
@ -78,7 +78,7 @@ const list = [
|
||||||
"authorization": `Bearer ${token}`
|
"authorization": `Bearer ${token}`
|
||||||
}, "remote1", {
|
}, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: signature
|
sign: signature
|
||||||
}, "error", act_error.WRONG_STATE);
|
}, "error", act_error.WRONG_STATE);
|
||||||
|
@ -97,7 +97,7 @@ const list = [
|
||||||
|
|
||||||
}], ["account", async (req) => {
|
}], ["account", async (req) => {
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getMyAccount", {}, "ok", {
|
}, "getMyAccount", {}, "ok", {
|
||||||
rights: PERMISSIONS.ALL,
|
rights: PERMISSIONS.ALL,
|
||||||
name: name1,
|
name: name1,
|
||||||
|
@ -107,7 +107,7 @@ const list = [
|
||||||
maxUsersPerRoom: 2,
|
maxUsersPerRoom: 2,
|
||||||
});
|
});
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name2} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name2} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getMyAccount", {}, "ok", {
|
}, "getMyAccount", {}, "ok", {
|
||||||
rights: PERMISSIONS.DEFAULT,
|
rights: PERMISSIONS.DEFAULT,
|
||||||
name: name2,
|
name: name2,
|
||||||
|
@ -118,31 +118,31 @@ const list = [
|
||||||
});
|
});
|
||||||
}], ["change account", async (req) => {
|
}], ["change account", async (req) => {
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name2} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name2} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "changePassword", {
|
}, "changePassword", {
|
||||||
accountKey: accountKey + "lol"
|
accountKey: accountKey + "lol"
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req({}, "signin", {
|
await req({}, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.AUTH);
|
}, "error", act_error.AUTH);
|
||||||
await req({}, "signin", {
|
await req({}, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey: accountKey + "lol"
|
accountKey: accountKey + "lol"
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name2} server=127.0.0.1:7224 accountKey=${accountKey + "lol"}`
|
"authorization": `Digest name=${name2} server=localhost:7224 accountKey=${accountKey + "lol"}`
|
||||||
}, "deleteAccount", {}, "ok", "");
|
}, "deleteAccount", {}, "ok", "");
|
||||||
await req({}, "signin", {
|
await req({}, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey: accountKey + "lol"
|
accountKey: accountKey + "lol"
|
||||||
}, "error",act_error.AUTH);
|
}, "error",act_error.AUTH);
|
||||||
}], ["admin", async (req) => {
|
}], ["admin", async (req) => {
|
||||||
let resp = await req({
|
let resp = await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getAccounts", {}, "ok", [
|
}, "getAccounts", {}, "ok", [
|
||||||
{
|
{
|
||||||
accID: 1,
|
accID: 1,
|
||||||
|
@ -150,7 +150,6 @@ const list = [
|
||||||
name: "testUser1",
|
name: "testUser1",
|
||||||
viewable: true,
|
viewable: true,
|
||||||
deleted: false,
|
deleted: false,
|
||||||
deletedTime: 0,
|
|
||||||
maxRooms: 2,
|
maxRooms: 2,
|
||||||
maxRoomSize: 10,
|
maxRoomSize: 10,
|
||||||
maxUsersPerRoom: 2
|
maxUsersPerRoom: 2
|
||||||
|
@ -160,20 +159,19 @@ const list = [
|
||||||
name: "testUser2",
|
name: "testUser2",
|
||||||
viewable: true,
|
viewable: true,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
deletedTime: null,
|
|
||||||
maxRooms: 2,
|
maxRooms: 2,
|
||||||
maxRoomSize: 10,
|
maxRoomSize: 10,
|
||||||
maxUsersPerRoom: 2
|
maxUsersPerRoom: 2
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "setPermissions", {
|
}, "setPermissions", {
|
||||||
accID: resp[1].accID,
|
accID: resp[1].accID,
|
||||||
rights: 5
|
rights: 5
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getAccounts", {}, "ok", [
|
}, "getAccounts", {}, "ok", [
|
||||||
{
|
{
|
||||||
accID: 1,
|
accID: 1,
|
||||||
|
@ -181,31 +179,29 @@ const list = [
|
||||||
name: "testUser1",
|
name: "testUser1",
|
||||||
viewable: true,
|
viewable: true,
|
||||||
deleted: false,
|
deleted: false,
|
||||||
deletedTime: 0,
|
|
||||||
maxRooms: 2,
|
maxRooms: 2,
|
||||||
maxRoomSize: 10,
|
maxRoomSize: 10,
|
||||||
maxUsersPerRoom: 2
|
maxUsersPerRoom: 2
|
||||||
}, {
|
}, {
|
||||||
accID: 3,
|
accID: null,
|
||||||
rights: 5,
|
rights: 5,
|
||||||
name: "testUser2",
|
name: "testUser2",
|
||||||
viewable: true,
|
viewable: true,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
deletedTime: null,
|
|
||||||
maxRooms: 2,
|
maxRooms: 2,
|
||||||
maxRoomSize: 10,
|
maxRoomSize: 10,
|
||||||
maxUsersPerRoom: 2
|
maxUsersPerRoom: 2
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "addOTA", {
|
}, "addOTA", {
|
||||||
token: "12345678",
|
token: "12345678",
|
||||||
expires: uts() + 1,
|
expires: uts() + 1,
|
||||||
usesLeft: -1
|
usesLeft: -1
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getOTAs", {}, "ok", [
|
}, "getOTAs", {}, "ok", [
|
||||||
{
|
{
|
||||||
token: "12345678",
|
token: "12345678",
|
||||||
|
@ -214,7 +210,7 @@ const list = [
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "addOTA", {
|
}, "addOTA", {
|
||||||
token: "abc",
|
token: "abc",
|
||||||
expires: -1,
|
expires: -1,
|
||||||
|
@ -222,34 +218,34 @@ const list = [
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await wait(2000);
|
await wait(2000);
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getOTAs", {}, "ok", [{
|
}, "getOTAs", {}, "ok", [{
|
||||||
token: "abc",
|
token: "abc",
|
||||||
expires: -1,
|
expires: -1,
|
||||||
usesLeft: -1
|
usesLeft: -1
|
||||||
}]);
|
}]);
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "deleteOTA", { token: "abc" }, "ok", "");
|
}, "deleteOTA", { token: "abc" }, "ok", "");
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "getOTAs", {}, "ok", []);
|
}, "getOTAs", {}, "ok", []);
|
||||||
}], ["room Owner", async (req) => {
|
}], ["room Owner", async (req) => {
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "createRoom", {
|
}, "createRoom", {
|
||||||
room: room1,
|
room: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
icon: "shopping"
|
icon: "shopping"
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "createRoom", {
|
}, "createRoom", {
|
||||||
room: room1,
|
room: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
|
@ -257,20 +253,20 @@ const list = [
|
||||||
}, "error", act_error.ROOM_EXISTS);
|
}, "error", act_error.ROOM_EXISTS);
|
||||||
|
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "createRoom", {
|
}, "createRoom", {
|
||||||
room: room2,
|
room: room2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
description: "some desc 2",
|
description: "some desc 2",
|
||||||
visibility: 1,
|
visibility: 1,
|
||||||
icon: ""
|
icon: ""
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "createRoom", {
|
}, "createRoom", {
|
||||||
room: room3,
|
room: room3,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
description: "some desc 2",
|
description: "some desc 2",
|
||||||
visibility: 1,
|
visibility: 1,
|
||||||
|
@ -278,11 +274,11 @@ const list = [
|
||||||
}, "error", act_error.ROOM_LIMIT);
|
}, "error", act_error.ROOM_LIMIT);
|
||||||
|
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "listRooms", {}, "ok", [
|
}, "listRooms", {}, "ok", [
|
||||||
{
|
{
|
||||||
name: room1,
|
name: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
|
@ -293,7 +289,7 @@ const list = [
|
||||||
confirmed: true
|
confirmed: true
|
||||||
}, {
|
}, {
|
||||||
name: room2,
|
name: room2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
|
@ -305,32 +301,32 @@ const list = [
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "deleteRoom", {
|
}, "deleteRoom", {
|
||||||
room: room2 + "lol",
|
room: room2 + "lol",
|
||||||
server: "127.0.0.1:7224"
|
server: "localhost:7224"
|
||||||
}, "error", act_error.ROOM_NOT_EXISTS);
|
}, "error", act_error.ROOM_NOT_EXISTS);
|
||||||
|
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "deleteRoom", {
|
}, "deleteRoom", {
|
||||||
room: room2,
|
room: room2,
|
||||||
server: "127.0.0.1:7224"
|
server: "localhost:7224"
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
|
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "deleteRoom", {
|
}, "deleteRoom", {
|
||||||
room: room2,
|
room: room2,
|
||||||
server: "127.0.0.1:7224"
|
server: "localhost:7224"
|
||||||
}, "error", act_error.ROOM_NOT_EXISTS);
|
}, "error", act_error.ROOM_NOT_EXISTS);
|
||||||
|
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=127.0.0.1:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "listRooms", {}, "ok", [
|
}, "listRooms", {}, "ok", [
|
||||||
{
|
{
|
||||||
name: room1,
|
name: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
|
|
|
@ -17,33 +17,33 @@ const list = [
|
||||||
["signup", async (handler, req, newHandler) => {
|
["signup", async (handler, req, newHandler) => {
|
||||||
await req(handler, "signup", {
|
await req(handler, "signup", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(handler, "signup", {
|
await req(handler, "signup", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.WRONG_STATE);
|
}, "error", act_error.WRONG_STATE);
|
||||||
await req(await newHandler(), "signup", {
|
await req(await newHandler(), "signup", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.ACCOUNT_EXISTS);
|
}, "error", act_error.ACCOUNT_EXISTS);
|
||||||
await req(await newHandler(), "signup", {
|
await req(await newHandler(), "signup", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(await newHandler(), "signup", {
|
await req(await newHandler(), "signup", {
|
||||||
name: name3,
|
name: name3,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.CONFIG);
|
}, "error", act_error.CONFIG);
|
||||||
}], ["remote", async (handler, req, newHandler) => {
|
}], ["remote", async (handler, req, newHandler) => {
|
||||||
await req(handler, "signin", {
|
await req(handler, "signin", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
let signature = (await req(handler, "createSignature", {
|
let signature = (await req(handler, "createSignature", {
|
||||||
|
@ -53,25 +53,25 @@ const list = [
|
||||||
let h2 = await newHandler();
|
let h2 = await newHandler();
|
||||||
await req(h2, "remote1", {
|
await req(h2, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7223",
|
server: "localhost:7223",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: signature
|
sign: signature
|
||||||
}, "error", act_error.SIGNATURE);
|
}, "error", act_error.SIGNATURE);
|
||||||
await req(h2, "remote1", {
|
await req(h2, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: falseSignature
|
sign: falseSignature
|
||||||
}, "error", act_error.SIGNATURE);
|
}, "error", act_error.SIGNATURE);
|
||||||
let challenge = (await req(h2, "remote1", {
|
let challenge = (await req(h2, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: signature
|
sign: signature
|
||||||
}, "ok", null)).challenge;
|
}, "ok", null)).challenge;
|
||||||
await req(h2, "remote1", {
|
await req(h2, "remote1", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
publicKey,
|
publicKey,
|
||||||
sign: signature
|
sign: signature
|
||||||
}, "error", act_error.WRONG_STATE);
|
}, "error", act_error.WRONG_STATE);
|
||||||
|
@ -84,7 +84,7 @@ const list = [
|
||||||
}], ["account", async (handler, req, newHandler) => {
|
}], ["account", async (handler, req, newHandler) => {
|
||||||
await req(handler, "signin", {
|
await req(handler, "signin", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(handler, "getMyAccount", {}, "ok", {
|
await req(handler, "getMyAccount", {}, "ok", {
|
||||||
|
@ -98,7 +98,7 @@ const list = [
|
||||||
let h2 = await newHandler();
|
let h2 = await newHandler();
|
||||||
await req(h2, "signin", {
|
await req(h2, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(h2, "getMyAccount", {}, "ok", {
|
await req(h2, "getMyAccount", {}, "ok", {
|
||||||
|
@ -112,7 +112,7 @@ const list = [
|
||||||
}], ["change account", async (handler, req, newHandler) => {
|
}], ["change account", async (handler, req, newHandler) => {
|
||||||
await req(handler, "signin", {
|
await req(handler, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(handler, "changePassword", {
|
await req(handler, "changePassword", {
|
||||||
|
@ -121,12 +121,12 @@ const list = [
|
||||||
let h2 = await newHandler();
|
let h2 = await newHandler();
|
||||||
await req(h2, "signin", {
|
await req(h2, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "error", act_error.AUTH);
|
}, "error", act_error.AUTH);
|
||||||
await req(h2, "signin", {
|
await req(h2, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey: accountKey + "lol"
|
accountKey: accountKey + "lol"
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(h2, "deleteAccount", {}, "ok", "");
|
await req(h2, "deleteAccount", {}, "ok", "");
|
||||||
|
@ -134,18 +134,18 @@ const list = [
|
||||||
let h3 = await newHandler();
|
let h3 = await newHandler();
|
||||||
await req(h3, "signin", {
|
await req(h3, "signin", {
|
||||||
name: name2,
|
name: name2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey: accountKey + "lol"
|
accountKey: accountKey + "lol"
|
||||||
}, "error", act_error.AUTH);
|
}, "error", act_error.AUTH);
|
||||||
}], ["room Owner", async (handler, req, newHandler) => {
|
}], ["room Owner", async (handler, req, newHandler) => {
|
||||||
await req(handler, "signin", {
|
await req(handler, "signin", {
|
||||||
name: name1,
|
name: name1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
accountKey
|
accountKey
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(handler, "createRoom", {
|
await req(handler, "createRoom", {
|
||||||
room: room1,
|
room: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
|
@ -153,7 +153,7 @@ const list = [
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(handler, "createRoom", {
|
await req(handler, "createRoom", {
|
||||||
room: room1,
|
room: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
|
@ -162,7 +162,7 @@ const list = [
|
||||||
|
|
||||||
await req(handler, "createRoom", {
|
await req(handler, "createRoom", {
|
||||||
room: room2,
|
room: room2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
description: "some desc 2",
|
description: "some desc 2",
|
||||||
visibility: 1,
|
visibility: 1,
|
||||||
|
@ -171,7 +171,7 @@ const list = [
|
||||||
|
|
||||||
await req(handler, "createRoom", {
|
await req(handler, "createRoom", {
|
||||||
room: room3,
|
room: room3,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
description: "some desc 2",
|
description: "some desc 2",
|
||||||
visibility: 1,
|
visibility: 1,
|
||||||
|
@ -181,7 +181,7 @@ const list = [
|
||||||
await req(handler, "listRooms", {}, "ok", [
|
await req(handler, "listRooms", {}, "ok", [
|
||||||
{
|
{
|
||||||
name: room1,
|
name: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
|
@ -192,7 +192,7 @@ const list = [
|
||||||
confirmed: true
|
confirmed: true
|
||||||
}, {
|
}, {
|
||||||
name: room2,
|
name: room2,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
|
@ -205,20 +205,20 @@ const list = [
|
||||||
]);
|
]);
|
||||||
await req(handler, "deleteRoom", {
|
await req(handler, "deleteRoom", {
|
||||||
room: room2 + "lol",
|
room: room2 + "lol",
|
||||||
server: "127.0.0.1:7224"
|
server: "localhost:7224"
|
||||||
}, "error", act_error.ROOM_NOT_EXISTS);
|
}, "error", act_error.ROOM_NOT_EXISTS);
|
||||||
await req(handler, "deleteRoom", {
|
await req(handler, "deleteRoom", {
|
||||||
room: room2,
|
room: room2,
|
||||||
server: "127.0.0.1:7224"
|
server: "localhost:7224"
|
||||||
}, "ok", "");
|
}, "ok", "");
|
||||||
await req(handler, "deleteRoom", {
|
await req(handler, "deleteRoom", {
|
||||||
room: room2,
|
room: room2,
|
||||||
server: "127.0.0.1:7224"
|
server: "localhost:7224"
|
||||||
}, "error", act_error.ROOM_NOT_EXISTS);
|
}, "error", act_error.ROOM_NOT_EXISTS);
|
||||||
await req(handler, "listRooms", {}, "ok", [
|
await req(handler, "listRooms", {}, "ok", [
|
||||||
{
|
{
|
||||||
name: room1,
|
name: room1,
|
||||||
server: "127.0.0.1:7224",
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
|
|
Loading…
Reference in a new issue