Factor out namespace_prefix

This commit is contained in:
Cadence Ember 2024-09-26 02:16:50 +12:00
parent 734c9a5838
commit d6de57f0c3

View file

@ -29,6 +29,7 @@ function writeRegistration(reg) {
* @returns {import("../types").InitialAppServiceRegistrationConfig} reg * @returns {import("../types").InitialAppServiceRegistrationConfig} reg
*/ */
function getTemplateRegistration(serverName) { function getTemplateRegistration(serverName) {
const namespace_prefix = "_ooye_"
return { return {
id: "ooye", id: "ooye",
as_token: crypto.randomBytes(32).toString("hex"), as_token: crypto.randomBytes(32).toString("hex"),
@ -36,21 +37,21 @@ function getTemplateRegistration(serverName) {
namespaces: { namespaces: {
users: [{ users: [{
exclusive: true, exclusive: true,
regex: `@_ooye_.*:${serverName}` regex: `@${namespace_prefix}.*:${serverName}`
}], }],
aliases: [{ aliases: [{
exclusive: true, exclusive: true,
regex: `#_ooye_.*:${serverName}` regex: `#${namespace_prefix}.*:${serverName}`
}] }]
}, },
protocols: [ protocols: [
"discord" "discord"
], ],
sender_localpart: "_ooye_bot", sender_localpart: `${namespace_prefix}bot`,
rate_limited: false, rate_limited: false,
socket: 6693, socket: 6693,
ooye: { ooye: {
namespace_prefix: "_ooye_", namespace_prefix,
max_file_size: 5000000, max_file_size: 5000000,
content_length_workaround: false, content_length_workaround: false,
include_user_id_in_mxid: false, include_user_id_in_mxid: false,