WIP on Prosody integration.
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
import { getBaseRouter } from './helpers'
|
||||
import { ensureProsodyRunning, ensureProsodyNotRunning } from './prosody/ctl'
|
||||
|
||||
export function initSettings (options: RegisterServerOptions): void {
|
||||
const { peertubeHelpers, registerSetting, settingsManager } = options
|
||||
|
||||
export function initSettings ({
|
||||
registerSetting
|
||||
}: RegisterServerOptions): void {
|
||||
registerSetting({
|
||||
name: 'chat-read-documentation',
|
||||
label: 'I have read the documentation',
|
||||
@ -157,4 +158,20 @@ export function initSettings ({
|
||||
'Example: height:400px;',
|
||||
private: false
|
||||
})
|
||||
|
||||
// settings changes management
|
||||
|
||||
// FIXME: Peertube <= 3.1.0 wrongly consider that the callback should not be async
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
settingsManager.onSettingsChange(async (settings: any) => {
|
||||
if ('chat-use-prosody' in settings) {
|
||||
if (settings['chat-use-prosody'] === true) {
|
||||
peertubeHelpers.logger.info('Saving settings, ensuring prosody is running')
|
||||
await ensureProsodyRunning(options)
|
||||
} else if (settings['chat-use-prody'] === false) {
|
||||
peertubeHelpers.logger.info('Saving settings, ensuring prosody is not running')
|
||||
await ensureProsodyNotRunning(options)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user