Debug Mode: new option to promote some JIDs as admins on the MUC component.

This commit is contained in:
John Livingston
2024-02-29 15:58:41 +01:00
parent 0b299883b1
commit 9ec7167da1
4 changed files with 35 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import { getAPIKey } from '../apikey'
import { parseExternalComponents } from './config/components'
import { getRemoteServerInfosDir } from '../federation/storage'
import { BotConfiguration } from '../configuration/bot'
import { debugMucAdmins } from '../debug'
async function getWorkingDir (options: RegisterServerOptions): Promise<string> {
const peertubeHelpers = options.peertubeHelpers
@ -326,6 +327,11 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
config.useTestModule(apikey, testApiUrl)
const debugMucAdminJids = debugMucAdmins(options)
if (debugMucAdminJids) {
config.addMucAdmins(debugMucAdminJids)
}
let logLevel: ProsodyLogLevel | undefined
if (logger.level && (typeof logger.level === 'string')) {
if (logger.level === 'error' || logger.level === 'info' || logger.level === 'debug') {

View File

@ -463,6 +463,12 @@ class ProsodyConfigContent {
}
}
addMucAdmins (jids: string[]): void {
for (const jid of jids) {
this.muc.add('admins', jid)
}
}
setLog (level: ProsodyLogLevel, syslog?: ProsodyLogLevel[]): void {
let log = ''
log += 'log = {\n'