default viewable setting

This commit is contained in:
jusax23 2023-03-25 16:31:03 +01:00
parent 6f322f0150
commit b7251429b6
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
3 changed files with 12 additions and 2 deletions

View file

@ -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;

View file

@ -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" }
}
};

View file

@ -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 },