configuration option to auto-invite matrix users

This commit is contained in:
Cadence Ember 2023-09-12 23:08:33 +12:00
parent 47b8d44010
commit 9263bdb754
4 changed files with 7 additions and 1 deletions

View file

@ -2,6 +2,7 @@
const assert = require("assert").strict
const DiscordTypes = require("discord-api-types/v10")
const reg = require("../../matrix/read-registration")
const passthrough = require("../../passthrough")
const { discord, sync, db } = passthrough
@ -32,7 +33,7 @@ async function createSpace(guild, kstate) {
events_default: 100, // space can only be managed by bridge
invite: 0 // any existing member can invite others
},
invite: [],
invite: reg.ooye.invite,
topic,
creation_content: {
type: "m.space"

View file

@ -6,7 +6,9 @@ const yaml = require("js-yaml")
/** @ts-ignore @type {import("../types").AppServiceRegistrationConfig} */
const reg = yaml.load(fs.readFileSync("registration.yaml", "utf8"))
reg["ooye"].invite = (reg.ooye.invite || []).filter(mxid => mxid.endsWith(`:${reg.ooye.server_name}`)) // one day I will understand why typescript disagrees with dot notation on this line
assert(reg.ooye.max_file_size)
assert(reg.ooye.namespace_prefix)
assert(reg.ooye.server_name)
module.exports = reg

View file

@ -18,3 +18,5 @@ ooye:
max_file_size: 5000000
server_name: [the part after the colon in your matrix id, like cadence.moe]
server_origin: [the full protocol and domain of your actual matrix server's location, with no trailing slash, like https://matrix.cadence.moe]
invite:
# - @cadence:cadence.moe # uncomment this to auto-invite the named user to newly created spaces

1
types.d.ts vendored
View file

@ -21,6 +21,7 @@ export type AppServiceRegistrationConfig = {
max_file_size: number
server_name: string
server_origin: string
invite: string[]
}
old_bridge?: {
as_token: string