diff --git a/server/lib/configuration/bot.ts b/server/lib/configuration/bot.ts index c22f59df..9be8dcde 100644 --- a/server/lib/configuration/bot.ts +++ b/server/lib/configuration/bot.ts @@ -17,7 +17,7 @@ type ChannelCommonRoomConf = Omit */ class BotConfiguration { protected readonly options: RegisterServerOptions - protected readonly prosodyDomain: string + protected readonly mucDomain: string protected readonly confDir: string protected readonly roomConfDir: string protected readonly logger: { @@ -31,12 +31,12 @@ class BotConfiguration { constructor (params: { options: RegisterServerOptions - prosodyDomain: string + mucDomain: string confDir: string roomConfDir: string }) { this.options = params.options - this.prosodyDomain = params.prosodyDomain + this.mucDomain = params.mucDomain this.confDir = params.confDir this.roomConfDir = params.roomConfDir @@ -54,10 +54,11 @@ class BotConfiguration { */ public static async initSingleton (options: RegisterServerOptions): Promise { const prosodyDomain = await getProsodyDomain(options) + const mucDomain = 'room.' + prosodyDomain const confDir = path.resolve( options.peertubeHelpers.plugin.getDataDirectoryPath(), 'bot', - prosodyDomain + mucDomain ) const roomConfDir = path.resolve( confDir, @@ -69,7 +70,7 @@ class BotConfiguration { singleton = new BotConfiguration({ options, - prosodyDomain, + mucDomain, confDir, roomConfDir }) @@ -101,7 +102,7 @@ class BotConfiguration { const roomConf: RoomConf = Object.assign({ local: roomJID, - domain: this.prosodyDomain + domain: this.mucDomain }, conf) if (!(roomConf.enabled ?? true)) { @@ -216,7 +217,7 @@ class BotConfiguration { this.logger.error('The room JID contains multiple @, not valid') return null } - if (splits[1] !== this.prosodyDomain) { + if (splits[1] !== this.mucDomain) { this.logger.error('The room JID is not on the correct domain') return null } diff --git a/server/lib/room-channel/room-channel-class.ts b/server/lib/room-channel/room-channel-class.ts index ba0ec585..7e15516d 100644 --- a/server/lib/room-channel/room-channel-class.ts +++ b/server/lib/room-channel/room-channel-class.ts @@ -19,7 +19,7 @@ let singleton: RoomChannel | undefined */ class RoomChannel { protected readonly options: RegisterServerOptions - protected readonly prosodyDomain: string + protected readonly mucDomain: string protected readonly dataFilePath: string protected readonly logger: { debug: (s: string) => void @@ -38,11 +38,11 @@ class RoomChannel { constructor (params: { options: RegisterServerOptions - prosodyDomain: string + mucDomain: string dataFilePath: string }) { this.options = params.options - this.prosodyDomain = params.prosodyDomain + this.mucDomain = params.mucDomain this.dataFilePath = params.dataFilePath const logger = params.options.peertubeHelpers.logger @@ -59,15 +59,16 @@ class RoomChannel { */ public static async initSingleton (options: RegisterServerOptions): Promise { const prosodyDomain = await getProsodyDomain(options) + const mucDomain = 'room.' + prosodyDomain const dataFilePath = path.resolve( options.peertubeHelpers.plugin.getDataDirectoryPath(), 'room-channel', - prosodyDomain + '.json' + mucDomain + '.json' ) singleton = new RoomChannel({ options, - prosodyDomain, + mucDomain, dataFilePath }) @@ -291,7 +292,7 @@ class RoomChannel { const botConf: RoomConf = Object.assign( { local: roomJID, - domain: this.prosodyDomain + domain: this.mucDomain }, channelConfigurationOptionsToBotRoomConf(this.options, channelConfigurationOptions) ) @@ -515,7 +516,7 @@ class RoomChannel { this.logger.error('The room JID contains multiple @, not valid') return null } - if (splits[1] !== this.prosodyDomain) { + if (splits[1] !== this.mucDomain) { this.logger.error('The room JID is not on the correct domain') return null }