From d6de57f0c36bd7c01255f642bd099e7e56c2881c Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 26 Sep 2024 02:16:50 +1200 Subject: [PATCH] Factor out namespace_prefix --- src/matrix/read-registration.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/matrix/read-registration.js b/src/matrix/read-registration.js index fec434fe..9fb05359 100644 --- a/src/matrix/read-registration.js +++ b/src/matrix/read-registration.js @@ -29,6 +29,7 @@ function writeRegistration(reg) { * @returns {import("../types").InitialAppServiceRegistrationConfig} reg */ function getTemplateRegistration(serverName) { + const namespace_prefix = "_ooye_" return { id: "ooye", as_token: crypto.randomBytes(32).toString("hex"), @@ -36,21 +37,21 @@ function getTemplateRegistration(serverName) { namespaces: { users: [{ exclusive: true, - regex: `@_ooye_.*:${serverName}` + regex: `@${namespace_prefix}.*:${serverName}` }], aliases: [{ exclusive: true, - regex: `#_ooye_.*:${serverName}` + regex: `#${namespace_prefix}.*:${serverName}` }] }, protocols: [ "discord" ], - sender_localpart: "_ooye_bot", + sender_localpart: `${namespace_prefix}bot`, rate_limited: false, socket: 6693, ooye: { - namespace_prefix: "_ooye_", + namespace_prefix, max_file_size: 5000000, content_length_workaround: false, include_user_id_in_mxid: false,