Merge branch 'main' of https://github.com/JohnXLivingston/peertube-plugin-livechat
This commit is contained in:
@ -19,6 +19,7 @@ import { BotConfiguration } from '../configuration/bot'
|
||||
import { debugMucAdmins } from '../debug'
|
||||
import { ExternalAuthOIDC } from '../external-auth/oidc'
|
||||
import { listModFirewallFiles } from '../firewall/config'
|
||||
import { Emojis } from '../emojis'
|
||||
|
||||
async function getWorkingDir (options: RegisterServerOptions): Promise<string> {
|
||||
const peertubeHelpers = options.peertubeHelpers
|
||||
@ -122,7 +123,7 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
|
||||
}
|
||||
|
||||
return {
|
||||
dir: dir,
|
||||
dir,
|
||||
pid: path.resolve(dir, 'prosody.pid'),
|
||||
error: path.resolve(dir, 'prosody.err'),
|
||||
log: path.resolve(dir, 'prosody.log'),
|
||||
@ -216,7 +217,7 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
|
||||
? settings['chat-terms']
|
||||
: undefined
|
||||
|
||||
let useExternal: boolean = false
|
||||
let useExternal = false
|
||||
try {
|
||||
const oidcs = ExternalAuthOIDC.allSingletons()
|
||||
for (const oidc of oidcs) {
|
||||
@ -376,7 +377,7 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
|
||||
config.useBotsVirtualHost(paths.botAvatars, paths.botAvatarsFiles)
|
||||
bots.moderation = await BotConfiguration.singleton().getModerationBotGlobalConf()
|
||||
if (bots.moderation?.connection?.password && typeof bots.moderation.connection.password === 'string') {
|
||||
valuesToHideInDiagnostic.set('BotPassword', bots.moderation.connection.password)
|
||||
valuesToHideInDiagnostic.set('BotPassword', bots.moderation.connection.password as string)
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,6 +390,13 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
|
||||
config.useModFirewall(modFirewallFiles)
|
||||
}
|
||||
|
||||
const commonEmojisRegexp = Emojis.singletonSafe()?.getCommonEmojisRegexp()
|
||||
if (commonEmojisRegexp) {
|
||||
config.useRestrictMessage(commonEmojisRegexp)
|
||||
} else {
|
||||
logger.error('Fail to load common emojis regexp, disabling restrict message module.')
|
||||
}
|
||||
|
||||
config.useTestModule(apikey, testApiUrl)
|
||||
|
||||
const debugMucAdminJids = debugMucAdmins(options)
|
||||
@ -500,6 +508,11 @@ function getProsodyConfigContentForDiagnostic (config: ProsodyConfig, content?:
|
||||
// replaceAll not available, using trick:
|
||||
r = r.split(value).join(`***${key}***`)
|
||||
}
|
||||
// We also replace `peertubelivechat_restrict_message_common_emoji_regexp` because it could be a very long line
|
||||
r = r.replace(
|
||||
/^(?:(\s*peertubelivechat_restrict_message_common_emoji_regexp\s*=\s*.{0,10}).*)$/gm,
|
||||
'$1 ***long line truncated***'
|
||||
)
|
||||
return r
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user