summary refs log tree commit diff
path: root/scripts/first_setup.js
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-23 18:58:55 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-23 19:00:40 +0200
commite0e0b74788ab52586d9ffe2c152d9e5518c2d4bb (patch)
tree254cf1238adea372014b55555e22db6637683d72 /scripts/first_setup.js
parentImprove first setup, make server load initial configuraiton (diff)
downloadserver-e0e0b74788ab52586d9ffe2c152d9e5518c2d4bb.tar.xz
New db migration script - multiplatform, fix mariadb migrations
Diffstat (limited to 'scripts/first_setup.js')
-rwxr-xr-xscripts/first_setup.js23
1 files changed, 5 insertions, 18 deletions
diff --git a/scripts/first_setup.js b/scripts/first_setup.js

index d320445d..4ce6e7de 100755 --- a/scripts/first_setup.js +++ b/scripts/first_setup.js
@@ -2,10 +2,10 @@ const path = require("path"); const fs = require("fs"); const { stdout, exit } = require("process"); -const readline = require("readline"); const { execIn } = require("./utils.js"); +const { ask } = require("./utils/ask.js"); + -const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); const data = { env: [], config: { register: {} }, extra_pkgs: [] }; let rights = []; @@ -128,7 +128,7 @@ async function main() { printTitle("Step 5: extra options"); if (/y?/i.test(await ask("Use fast BCrypt implementation (requires a compiler) (Y/n): "))) data.extra_pkgs.push("bcrypt"); - if (/y?/.test(await ask("Enable support for widgets (requires compiler, known to fail on some ARM devices.) (Y/n): "))) + if (/y?/i.test(await ask("Enable support for widgets (requires compiler, known to fail on some ARM devices.) (Y/n): "))) data.extra_pkgs.push("canvas"); printTitle("Step 6: finalizing..."); @@ -201,12 +201,7 @@ async function askRights() { return selectedRights; } -async function askRight(right) { - let answer = await ask(`${right}: `); - if (answer == "y") return true; - else if (answer == "n") return false; - else return askRight(right); -} + function printTitle(input) { let width = stdout.columns / 2 - 1; //40 @@ -214,15 +209,7 @@ function printTitle(input) { console.log("-".repeat(width - input.length / 2), input, "-".repeat(width - input.length / 2)); console.log(); } -async function ask(question) { - return new Promise((resolve, _reject) => { - return rl.question(question, (answer) => { - resolve(answer); - }); - }).catch((err) => { - console.log(err); - }); -} + function BitFlag(int) { return 1n << BigInt(int);