Remove redundant/invalid checks from setup
This commit is contained in:
		| @@ -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...") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Cadence Ember
					Cadence Ember