From b7251429b6157de8d12b894fe35abe627f4abea1 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sat, 25 Mar 2023 16:31:03 +0100 Subject: [PATCH] default viewable setting --- src/setup/config.ts | 9 ++++++++- src/sys/config.ts | 1 + src/sys/db.ts | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/setup/config.ts b/src/setup/config.ts index 41deb4a..f53fe64 100644 --- a/src/setup/config.ts +++ b/src/setup/config.ts @@ -26,7 +26,7 @@ const loading = () => { let P = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"; var x = 0; let intID = setInterval(function () { - process.stdout.write("\r\x1b[1m" + P[(x++) % P.length]+" "); + process.stdout.write("\r\x1b[1m" + P[(x++) % P.length] + " "); }, 150); return () => { process.stdout.write("\r\x1b[0m"); @@ -251,6 +251,11 @@ const outbag = async () => { message: "Please enter default maximum number of Users per Room!", initial: oConf.get("Settings", "defaultMaxUsersPerRoom"), validate: i => i >= -1 + }, { + type: "confirm", + name: "defaultViewable", + message: "Should outbag accounts be viewable by default?", + initial: oConf.get("Settings", "defaultViewable"), }, ]); @@ -259,6 +264,7 @@ const outbag = async () => { || resp.defaultMaxRooms == null || resp.defaultMaxRoomSize == null || resp.defaultMaxUsersPerRoom == null + || resp.defaultViewable == null ) { warn("Setup", "You have to provide all informations!"); return false; @@ -278,6 +284,7 @@ const outbag = async () => { oConf.set("Settings", "defaultMaxRooms", resp.defaultMaxRooms); oConf.set("Settings", "defaultMaxRoomSize", resp.defaultMaxRoomSize); oConf.set("Settings", "defaultMaxUsersPerRoom", resp.defaultMaxUsersPerRoom); + oConf.set("Settings", "defaultViewable", resp.defaultViewable); oConf.save(); return true; diff --git a/src/sys/config.ts b/src/sys/config.ts index 843084c..2544532 100644 --- a/src/sys/config.ts +++ b/src/sys/config.ts @@ -26,6 +26,7 @@ const conf_struct = { defaultMaxRooms: { type: "number", default: 3, env: "OUTBAG_DEFAULT_MAX_ROOMS" },//Infinity = -1 defaultMaxRoomSize: { type: "number", default: 10000, env: "OUTBAG_DEFAULT_MAX_ROOMS_SIZE" },//Infinity = -1 defaultMaxUsersPerRoom: { type: "number", default: 5, env: "OUTBAG_DEFAULT_MAX_USERS_PER_ROOM" },//Infinity = -1 + defaultViewable: { type: "boolean", default: false, env: "OUTBAG_DEFAULT_VIEWABLE" } } }; diff --git a/src/sys/db.ts b/src/sys/db.ts index 8aced86..5b437c7 100644 --- a/src/sys/db.ts +++ b/src/sys/db.ts @@ -17,6 +17,7 @@ export const connectToDB = async () => { accounts.maxRooms.ops.default = oConf.get("Settings", "defaultMaxRooms"); accounts.maxRoomSize.ops.default = oConf.get("Settings", "defaultMaxRoomSize"); accounts.maxUsersPerRoom.ops.default = oConf.get("Settings", "defaultMaxUsersPerRoom"); + accounts.viewable.ops.default = oConf.get("Settings", "defaultViewable"); try { await db.sync(true); log("Database", "Connected to Database!"); @@ -34,6 +35,7 @@ export const connectToDBCredentials = async (host: string, port: number, user: s accounts.maxRooms.ops.default = oConf.get("Settings", "defaultMaxRooms"); accounts.maxRoomSize.ops.default = oConf.get("Settings", "defaultMaxRoomSize"); accounts.maxUsersPerRoom.ops.default = oConf.get("Settings", "defaultMaxUsersPerRoom"); + accounts.viewable.ops.default = oConf.get("Settings", "defaultViewable"); try { await db.sync(true); } catch (e) { @@ -53,7 +55,7 @@ accounts.addAttributes({ accountKeySalt: { type: VARCHAR(64) }, accountKey: { type: VARCHAR(64) }, - viewable: { type: BOOL, default: true }, + viewable: { type: BOOL, default: false }, deleted: { type: BOOL, default: false },