summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorCadence Ember <cadence@disroot.org>2024-11-25 16:30:10 +1300
committerCadence Ember <cadence@disroot.org>2024-11-25 16:30:10 +1300
commita63d173a9a2cdc03c129e5f8bb4e0ed57b290d3d (patch)
treec1b29a0a82591a30ac1a215cd78dfc6f0d6edee0 /scripts
parentFix existingPartZero assertion error (diff)
downloadout-of-your-element-a63d173a9a2cdc03c129e5f8bb4e0ed57b290d3d.tar.xz
Remove redundant/invalid checks from setup
Diffstat (limited to 'scripts')
-rw-r--r--scripts/setup.js13
1 files changed, 1 insertions, 12 deletions
diff --git a/scripts/setup.js b/scripts/setup.js

index f1817b7..a8b068b 100644 --- a/scripts/setup.js +++ b/scripts/setup.js
@@ -230,7 +230,6 @@ async function validateHomeserverOrigin(serverUrlPrompt, url) { // Done with user prompts, reg is now guaranteed to be valid const api = require("../src/matrix/api") const file = require("../src/matrix/file") - const utils = require("../src/m2d/converters/utils") const DiscordClient = require("../src/d2m/discord-client") const discord = new DiscordClient(reg.ooye.discord_token, "no") passthrough.discord = discord @@ -267,21 +266,11 @@ async function validateHomeserverOrigin(serverUrlPrompt, url) { const mxid = `@${reg.sender_localpart}:${reg.ooye.server_name}` - // ensure registration is correctly set... - assert(reg.sender_localpart.startsWith(reg.ooye.namespace_prefix), "appservice's localpart must be in the namespace it controls") - assert(utils.eventSenderIsFromDiscord(mxid), "appservice's mxid must be in the namespace it controls") - assert(reg.ooye.server_origin.match(/^https?:\/\//), "server origin must start with http or https") - assert.notEqual(reg.ooye.server_origin.slice(-1), "/", "server origin must not end in slash") - const botID = Buffer.from(reg.ooye.discord_token.split(".")[0], "base64").toString() - assert(botID.match(/^[0-9]{10,}$/), "discord token must follow the correct format") - assert.match(reg.url, /^https?:/, "url must start with http:// or https://") - - console.log("✅ Configuration looks good...") - // database ddl... await migrate.migrate(db) // add initial rows to database, like adding the bot to sim... + const botID = Buffer.from(reg.ooye.discord_token.split(".")[0], "base64").toString() db.prepare("INSERT OR IGNORE INTO sim (user_id, sim_name, localpart, mxid) VALUES (?, ?, ?, ?)").run(botID, reg.sender_localpart.slice(reg.ooye.namespace_prefix.length), reg.sender_localpart, mxid) console.log("✅ Database is ready...")