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
*/
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,