diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-18 22:17:36 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-09-04 10:48:54 +0200 |
commit | c0c939fb800488fe7bc5cab38079e35dea232652 (patch) | |
tree | b003eb76a2c67e5c61489a2fa9a61a1092e5d816 | |
parent | Add fallback to bcryptjs, make canvas optional (diff) | |
download | server-c0c939fb800488fe7bc5cab38079e35dea232652.tar.xz |
Add mostly-functional initial setup script
-rw-r--r-- | scripts/rights.js | 2 | ||||
-rw-r--r-- | src/plugins/PluginIndex.ts | 5 | ||||
-rw-r--r-- | src/util/util/Config.ts | 9 |
3 files changed, 12 insertions, 4 deletions
diff --git a/scripts/rights.js b/scripts/rights.js index a6d23855..5ae576ef 100644 --- a/scripts/rights.js +++ b/scripts/rights.js @@ -12,7 +12,7 @@ let lines3 = lines2.filter((y) => y.includes(": BitFlag(")); let lines4 = lines3.map((x) => x.split("//")[0].trim()); function BitFlag(int) { - return 1n << eval(`${int}n`); + return 1n << BigInt(int); } let rights = []; diff --git a/src/plugins/PluginIndex.ts b/src/plugins/PluginIndex.ts index 502161a1..2688d0bf 100644 --- a/src/plugins/PluginIndex.ts +++ b/src/plugins/PluginIndex.ts @@ -1,6 +1,5 @@ -import { Plugin } from "util/plugin"; import * as example_plugin from "./example-plugin/TestPlugin"; export const PluginIndex: any = { - "example-plugin": new example_plugin.default(), -}; \ No newline at end of file + "example-plugin": new example_plugin.default() +}; diff --git a/src/util/util/Config.ts b/src/util/util/Config.ts index 49a1f3f8..2879b955 100644 --- a/src/util/util/Config.ts +++ b/src/util/util/Config.ts @@ -5,6 +5,7 @@ import { ConfigValue } from "../config"; import { ConfigEntity } from "../entities/Config"; const overridePath = process.env.CONFIG_PATH ?? ""; +const initialPath = path.join(process.cwd(), "initial.json"); let config: ConfigValue; let pairs: ConfigEntity[]; @@ -28,6 +29,14 @@ export const Config = { } catch (error) { fs.writeFileSync(overridePath, JSON.stringify(config, null, 4)); } + if (fs.existsSync(initialPath)) { + console.log("[Config] Importing initial configuration..."); + try { + const overrideConfig = JSON.parse(fs.readFileSync(initialPath, { encoding: "utf8" })); + config = overrideConfig.merge(config); + fs.rmSync(initialPath); + } catch (error) {} + } if (fs.existsSync(path.join(process.cwd(), "initial.json"))) try { |