send ebug state

This commit is contained in:
jusax23 2023-03-20 21:48:44 +01:00
parent 0b366d41cf
commit af6768125a
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
6 changed files with 32 additions and 15 deletions

View file

@ -178,7 +178,7 @@ export const listPublicRooms = {
let description = d[rooms.description];
let icon = d[rooms.icon];
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;
});

View file

@ -40,7 +40,7 @@ export const listRooms: Act = {
let icon = d[rooms.icon];
let server = selfTag.tag;
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;
})
@ -53,9 +53,9 @@ export const listRooms: Act = {
let resp = await client.pass(server[remoteRooms.server], "listRooms", {});
if (resp.state == "ok" && Array.isArray(resp.data)) {
out.push(...resp.data.map(d => {
let { name, owner, rights, visibility, title, description, icon, server } = d;
if (name != null && owner != null && rights != null && visibility != null && title != null && description != null && icon != null) {
return { name, server, owner, rights, visibility, title, description, icon };
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 && debug != null) {
return { name, server, owner, rights, visibility, title, description, icon, debug };
}
return null;
}))

View file

@ -47,7 +47,7 @@ var Methods: ([string, (req: Request, res: Response) => Promise<void>])[] = [
let description = d[rooms.description];
let icon = d[rooms.icon];
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;
});

View file

@ -11,7 +11,7 @@ import { WebSocketServer } from "ws";
import { Command } from "commander";
import { oConf } from "./sys/config.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 bruteforce from "./sys/bruteforce.js";
import { fullSetup, partiellSetup } from "./setup/config.js";
@ -43,6 +43,7 @@ program
global.debug = debug != null;
global.provideLog = provideLog != null ? provideLog : 0;
if (global.debug) {
warn("System", "Starting in debug mode: Server should not be used in production!");
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
}
if (config) {
@ -111,7 +112,14 @@ async function complete_loaded() {
await startUpdateCert();
await wait(500);
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();
activateWS();
log("Server", 'Listening...');

View file

@ -192,7 +192,8 @@ const list = [
title: "Test Room 1",
description: "some desc",
visibility: 0,
icon: "shopping"
icon: "shopping",
debug: true
}, {
name: room2,
server: "localhost:7224",
@ -201,7 +202,8 @@ const list = [
title: "Test Room 2",
description: "some desc 2",
visibility: 1,
icon: ""
icon: "",
debug: true
}
]);
await req({
@ -236,7 +238,8 @@ const list = [
title: "Test Room 1",
description: "some desc",
visibility: 0,
icon: "shopping"
icon: "shopping",
debug: true
}
]);
}]

View file

@ -180,20 +180,24 @@ const list = [
await req(handler, "listRooms", {}, "ok", [
{
name: room1,
server: "localhost:7224",
owner: name1,
rights: 0b11111,
title: "Test Room 1",
description: "some desc",
visibility: 0,
icon: "shopping"
icon: "shopping",
debug: true
}, {
name: room2,
server: "localhost:7224",
owner: name1,
rights: 0b11111,
title: "Test Room 2",
description: "some desc 2",
visibility: 1,
icon: ""
icon: "",
debug: true
}
]);
await req(handler, "deleteRoom", {
@ -211,12 +215,14 @@ const list = [
await req(handler, "listRooms", {}, "ok", [
{
name: room1,
server: "localhost:7224",
owner: name1,
rights: 0b11111,
title: "Test Room 1",
description: "some desc",
visibility: 0,
icon: "shopping"
icon: "shopping",
debug: true
}
]);