send ebug state
This commit is contained in:
parent
0b366d41cf
commit
af6768125a
6 changed files with 32 additions and 15 deletions
|
@ -178,7 +178,7 @@ export const listPublicRooms = {
|
||||||
let description = d[rooms.description];
|
let description = d[rooms.description];
|
||||||
let icon = d[rooms.icon];
|
let icon = d[rooms.icon];
|
||||||
if (name != null && visibility != null && title != null && description != null && icon != null) {
|
if (name != null && visibility != null && title != null && description != null && icon != null) {
|
||||||
return { name, server: selfTag.tag, visibility, title, description, icon };
|
return { name, server: selfTag.tag, visibility, title, description, icon, debug: global.debug };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,7 +40,7 @@ export const listRooms: Act = {
|
||||||
let icon = d[rooms.icon];
|
let icon = d[rooms.icon];
|
||||||
let server = selfTag.tag;
|
let server = selfTag.tag;
|
||||||
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null) {
|
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null) {
|
||||||
return { name, server, owner, rights, visibility, title, description, icon };
|
return { name, server, owner, rights, visibility, title, description, icon, debug: global.debug };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
|
@ -53,9 +53,9 @@ export const listRooms: Act = {
|
||||||
let resp = await client.pass(server[remoteRooms.server], "listRooms", {});
|
let resp = await client.pass(server[remoteRooms.server], "listRooms", {});
|
||||||
if (resp.state == "ok" && Array.isArray(resp.data)) {
|
if (resp.state == "ok" && Array.isArray(resp.data)) {
|
||||||
out.push(...resp.data.map(d => {
|
out.push(...resp.data.map(d => {
|
||||||
let { name, owner, rights, visibility, title, description, icon, server } = d;
|
let { name, owner, rights, visibility, title, description, icon, server, debug } = d;
|
||||||
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null) {
|
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null && debug != null) {
|
||||||
return { name, server, owner, rights, visibility, title, description, icon };
|
return { name, server, owner, rights, visibility, title, description, icon, debug };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -47,7 +47,7 @@ var Methods: ([string, (req: Request, res: Response) => Promise<void>])[] = [
|
||||||
let description = d[rooms.description];
|
let description = d[rooms.description];
|
||||||
let icon = d[rooms.icon];
|
let icon = d[rooms.icon];
|
||||||
if (name != null && title != null && description != null && icon != null) {
|
if (name != null && title != null && description != null && icon != null) {
|
||||||
return { name, server: selfTag.tag, title, description, icon };
|
return { name, server: selfTag.tag, title, description, icon, debug: global.debug };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
12
src/main.ts
12
src/main.ts
|
@ -11,7 +11,7 @@ import { WebSocketServer } from "ws";
|
||||||
import { Command } from "commander";
|
import { Command } from "commander";
|
||||||
import { oConf } from "./sys/config.js";
|
import { oConf } from "./sys/config.js";
|
||||||
import { generateTag } from "./sys/selfTag.js"
|
import { generateTag } from "./sys/selfTag.js"
|
||||||
import { error, log } from "./sys/log.js";
|
import { error, log, warn } from "./sys/log.js";
|
||||||
import { connectToDB } from "./sys/db.js";
|
import { connectToDB } from "./sys/db.js";
|
||||||
import bruteforce from "./sys/bruteforce.js";
|
import bruteforce from "./sys/bruteforce.js";
|
||||||
import { fullSetup, partiellSetup } from "./setup/config.js";
|
import { fullSetup, partiellSetup } from "./setup/config.js";
|
||||||
|
@ -43,6 +43,7 @@ program
|
||||||
global.debug = debug != null;
|
global.debug = debug != null;
|
||||||
global.provideLog = provideLog != null ? provideLog : 0;
|
global.provideLog = provideLog != null ? provideLog : 0;
|
||||||
if (global.debug) {
|
if (global.debug) {
|
||||||
|
warn("System", "Starting in debug mode: Server should not be used in production!");
|
||||||
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
||||||
}
|
}
|
||||||
if (config) {
|
if (config) {
|
||||||
|
@ -111,7 +112,14 @@ async function complete_loaded() {
|
||||||
await startUpdateCert();
|
await startUpdateCert();
|
||||||
await wait(500);
|
await wait(500);
|
||||||
let succ = await generateTag();
|
let succ = await generateTag();
|
||||||
if (!succ) error("Outbag", "Could not check own Server Tag. Remote-Auth may not work! Check if the Server is reachable and the config ist correct!");
|
if (!succ) {
|
||||||
|
error("Outbag", "Could not check own Server Tag. Remote-Auth may not work! Check if the Server is reachable and the config ist correct!");
|
||||||
|
if (!global.debug) {
|
||||||
|
await nman.shutdown();
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
warn("Outbag", "Keep running tue to debug Mode");
|
||||||
|
}
|
||||||
activatePost();
|
activatePost();
|
||||||
activateWS();
|
activateWS();
|
||||||
log("Server", 'Listening...');
|
log("Server", 'Listening...');
|
||||||
|
|
|
@ -192,7 +192,8 @@ const list = [
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
icon: "shopping"
|
icon: "shopping",
|
||||||
|
debug: true
|
||||||
}, {
|
}, {
|
||||||
name: room2,
|
name: room2,
|
||||||
server: "localhost:7224",
|
server: "localhost:7224",
|
||||||
|
@ -201,7 +202,8 @@ const list = [
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
description: "some desc 2",
|
description: "some desc 2",
|
||||||
visibility: 1,
|
visibility: 1,
|
||||||
icon: ""
|
icon: "",
|
||||||
|
debug: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
await req({
|
await req({
|
||||||
|
@ -210,7 +212,7 @@ const list = [
|
||||||
room: room2 + "lol",
|
room: room2 + "lol",
|
||||||
server: "localhost:7224"
|
server: "localhost:7224"
|
||||||
}, "error", "existence");
|
}, "error", "existence");
|
||||||
|
|
||||||
await req({
|
await req({
|
||||||
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||||
}, "deleteRoom", {
|
}, "deleteRoom", {
|
||||||
|
@ -236,7 +238,8 @@ const list = [
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
icon: "shopping"
|
icon: "shopping",
|
||||||
|
debug: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -180,20 +180,24 @@ const list = [
|
||||||
await req(handler, "listRooms", {}, "ok", [
|
await req(handler, "listRooms", {}, "ok", [
|
||||||
{
|
{
|
||||||
name: room1,
|
name: room1,
|
||||||
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
icon: "shopping"
|
icon: "shopping",
|
||||||
|
debug: true
|
||||||
}, {
|
}, {
|
||||||
name: room2,
|
name: room2,
|
||||||
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 2",
|
title: "Test Room 2",
|
||||||
description: "some desc 2",
|
description: "some desc 2",
|
||||||
visibility: 1,
|
visibility: 1,
|
||||||
icon: ""
|
icon: "",
|
||||||
|
debug: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
await req(handler, "deleteRoom", {
|
await req(handler, "deleteRoom", {
|
||||||
|
@ -211,12 +215,14 @@ const list = [
|
||||||
await req(handler, "listRooms", {}, "ok", [
|
await req(handler, "listRooms", {}, "ok", [
|
||||||
{
|
{
|
||||||
name: room1,
|
name: room1,
|
||||||
|
server: "localhost:7224",
|
||||||
owner: name1,
|
owner: name1,
|
||||||
rights: 0b11111,
|
rights: 0b11111,
|
||||||
title: "Test Room 1",
|
title: "Test Room 1",
|
||||||
description: "some desc",
|
description: "some desc",
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
icon: "shopping"
|
icon: "shopping",
|
||||||
|
debug: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue