Replacing old settings by chat-type.
This commit is contained in:
parent
36146ee76c
commit
d0b44c3486
@ -1,7 +1,4 @@
|
|||||||
import type { ChatType } from 'shared/lib/types'
|
import type { ChatType } from 'shared/lib/types'
|
||||||
const prosodySettings = ['prosody-port']
|
|
||||||
const converseSettings = ['chat-server', 'chat-room', 'chat-bosh-uri', 'chat-ws-uri']
|
|
||||||
const otherSettings: string[] = []
|
|
||||||
|
|
||||||
function register ({ registerSettingsScript }: RegisterOptions): void {
|
function register ({ registerSettingsScript }: RegisterOptions): void {
|
||||||
registerSettingsScript({
|
registerSettingsScript({
|
||||||
@ -10,30 +7,22 @@ function register ({ registerSettingsScript }: RegisterOptions): void {
|
|||||||
switch (name) {
|
switch (name) {
|
||||||
case 'chat-type-help-disabled':
|
case 'chat-type-help-disabled':
|
||||||
return options.formValues['chat-type'] !== ('disabled' as ChatType)
|
return options.formValues['chat-type'] !== ('disabled' as ChatType)
|
||||||
|
case 'prosody-port':
|
||||||
case 'chat-type-help-builtin-prosody':
|
case 'chat-type-help-builtin-prosody':
|
||||||
return options.formValues['chat-type'] !== ('builtin-prosody' as ChatType)
|
return options.formValues['chat-type'] !== ('builtin-prosody' as ChatType)
|
||||||
|
case 'chat-server':
|
||||||
|
case 'chat-room':
|
||||||
|
case 'chat-bosh-uri':
|
||||||
|
case 'chat-ws-uri':
|
||||||
case 'chat-type-help-builtin-converse':
|
case 'chat-type-help-builtin-converse':
|
||||||
return options.formValues['chat-type'] !== ('builtin-converse' as ChatType)
|
return options.formValues['chat-type'] !== ('builtin-converse' as ChatType)
|
||||||
|
case 'chat-uri':
|
||||||
case 'chat-type-help-external-uri':
|
case 'chat-type-help-external-uri':
|
||||||
return options.formValues['chat-type'] !== ('external-uri' as ChatType)
|
return options.formValues['chat-type'] !== ('external-uri' as ChatType)
|
||||||
|
case 'chat-style':
|
||||||
|
return options.formValues['chat-type'] === 'disabled'
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rewrite the code bellow.
|
|
||||||
if (prosodySettings.includes(name)) {
|
|
||||||
return options.formValues['chat-use-prosody'] !== true
|
|
||||||
}
|
|
||||||
if (name === 'chat-use-builtin') {
|
|
||||||
return options.formValues['chat-use-prosody'] === true
|
|
||||||
}
|
|
||||||
if (converseSettings.includes(name)) {
|
|
||||||
return options.formValues['chat-use-builtin'] !== true || options.formValues['chat-use-prosody'] === true
|
|
||||||
}
|
|
||||||
if (name === 'chat-uri') {
|
|
||||||
return options.formValues['chat-use-prosody'] === true || options.formValues['chat-use-builtin'] === true
|
|
||||||
}
|
|
||||||
if (otherSettings.includes(name)) {
|
|
||||||
return options.formValues['chat-use-builtin'] === true || options.formValues['chat-use-prosody'] === true
|
|
||||||
}
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { videoHasWebchat } from 'shared/lib/video'
|
import { videoHasWebchat } from 'shared/lib/video'
|
||||||
|
import type { ChatType } from 'shared/lib/types'
|
||||||
|
|
||||||
interface VideoWatchLoadedHookOptions {
|
interface VideoWatchLoadedHookOptions {
|
||||||
videojs: any
|
videojs: any
|
||||||
@ -33,10 +34,11 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
let iframeUri = ''
|
let iframeUri = ''
|
||||||
if (settings['chat-use-prosody'] || settings['chat-use-builtin']) {
|
const chatType: ChatType = (settings['chat-type'] ?? 'disabled') as ChatType
|
||||||
|
if (chatType === 'builtin-prosody' || chatType === 'builtin-converse') {
|
||||||
// Using the builtin converseJS
|
// Using the builtin converseJS
|
||||||
iframeUri = getBaseRoute() + '/webchat/room/' + encodeURIComponent(uuid)
|
iframeUri = getBaseRoute() + '/webchat/room/' + encodeURIComponent(uuid)
|
||||||
} else if (!settings['chat-use-builtin']) {
|
} else if (chatType === 'external-uri') {
|
||||||
iframeUri = settings['chat-uri'] || ''
|
iframeUri = settings['chat-uri'] || ''
|
||||||
iframeUri = iframeUri.replace(/{{VIDEO_UUID}}/g, encodeURIComponent(uuid))
|
iframeUri = iframeUri.replace(/{{VIDEO_UUID}}/g, encodeURIComponent(uuid))
|
||||||
if (!/^https?:\/\//.test(iframeUri)) {
|
if (!/^https?:\/\//.test(iframeUri)) {
|
||||||
@ -44,7 +46,7 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error('Dont known which url use for the iframe.')
|
logger.error('Chat disabled.')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (iframeUri === '') {
|
if (iframeUri === '') {
|
||||||
|
@ -1,27 +1,29 @@
|
|||||||
import { newResult, TestResult } from './utils'
|
import { newResult, TestResult } from './utils'
|
||||||
|
import type { ChatType } from '../../../shared/lib/types'
|
||||||
|
|
||||||
export async function diagChatType (test: string, { settingsManager }: RegisterServerOptions): Promise<TestResult> {
|
export async function diagChatType (test: string, { settingsManager }: RegisterServerOptions): Promise<TestResult> {
|
||||||
const result = newResult(test)
|
const result = newResult(test)
|
||||||
const typeSettings = await settingsManager.getSettings([
|
const typeSettings = await settingsManager.getSettings([
|
||||||
'chat-use-prosody',
|
'chat-type'
|
||||||
'chat-use-builtin',
|
|
||||||
'chat-uri'
|
|
||||||
])
|
])
|
||||||
result.label = 'Webchat type'
|
result.label = 'Webchat type'
|
||||||
if (typeSettings['chat-use-prosody'] as boolean) {
|
const chatType: ChatType = (typeSettings['chat-type'] ?? 'disabled') as ChatType
|
||||||
|
if (chatType === 'builtin-prosody') {
|
||||||
result.messages.push('Using builtin Prosody')
|
result.messages.push('Using builtin Prosody')
|
||||||
result.ok = true
|
result.ok = true
|
||||||
result.next = 'prosody'
|
result.next = 'prosody'
|
||||||
} else if (typeSettings['chat-use-builtin'] as boolean) {
|
} else if (chatType === 'builtin-converse') {
|
||||||
result.messages.push('Using builtin ConverseJS to connect to an external XMPP server')
|
result.messages.push('Using builtin ConverseJS to connect to an external XMPP server')
|
||||||
result.ok = true
|
result.ok = true
|
||||||
result.next = 'converse'
|
result.next = 'converse'
|
||||||
} else if (((typeSettings['chat-uri'] || '') as string) !== '') {
|
} else if (chatType === 'external-uri') {
|
||||||
result.messages.push('Using an external uri')
|
result.messages.push('Using an external uri')
|
||||||
result.ok = true
|
result.ok = true
|
||||||
result.next = 'use-uri'
|
result.next = 'use-uri'
|
||||||
|
} else if (chatType === 'disabled') {
|
||||||
|
result.messages.push('Webchat disabled')
|
||||||
} else {
|
} else {
|
||||||
result.messages.push('No webchat configuration')
|
result.messages.push('Unknown chat type value: ' + (chatType as string))
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { getProsodyConfig, getProsodyFilePaths, writeProsodyConfig } from './config'
|
import { getProsodyConfig, getProsodyFilePaths, writeProsodyConfig } from './config'
|
||||||
import { startProsodyLogRotate, stopProsodyLogRotate } from './logrotate'
|
import { startProsodyLogRotate, stopProsodyLogRotate } from './logrotate'
|
||||||
import { changeHttpBindRoute } from '../routers/webchat'
|
import { changeHttpBindRoute } from '../routers/webchat'
|
||||||
|
import type { ChatType } from '../../../shared/lib/types'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as child_process from 'child_process'
|
import * as child_process from 'child_process'
|
||||||
|
|
||||||
@ -142,9 +143,9 @@ async function ensureProsodyRunning (options: RegisterServerOptions): Promise<vo
|
|||||||
logger.debug('Calling ensureProsodyRunning')
|
logger.debug('Calling ensureProsodyRunning')
|
||||||
|
|
||||||
logger.debug('Checking if prosody should be active')
|
logger.debug('Checking if prosody should be active')
|
||||||
const setting = await settingsManager.getSetting('chat-use-prosody')
|
const setting = await settingsManager.getSetting('chat-type')
|
||||||
if (!setting) {
|
if (setting !== ('builtin-prosody' as ChatType)) {
|
||||||
logger.info('Prosody is not activated, we wont launch it')
|
logger.info('Chat type is not set to builtin-prosody, we wont launch it')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import { prosodyCheckUserPassword, prosodyRegisterUser, prosodyUserRegistered }
|
|||||||
import { getUserNickname } from '../helpers'
|
import { getUserNickname } from '../helpers'
|
||||||
import { Affiliations, getVideoAffiliations } from '../prosody/config/affiliations'
|
import { Affiliations, getVideoAffiliations } from '../prosody/config/affiliations'
|
||||||
import { getProsodyDomain } from '../prosody/config/domain'
|
import { getProsodyDomain } from '../prosody/config/domain'
|
||||||
|
import type { ChatType } from '../../../shared/lib/types'
|
||||||
|
|
||||||
// See here for description: https://modules.prosody.im/mod_muc_http_defaults.html
|
// See here for description: https://modules.prosody.im/mod_muc_http_defaults.html
|
||||||
interface RoomDefaults {
|
interface RoomDefaults {
|
||||||
@ -46,13 +47,13 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
|
|||||||
}
|
}
|
||||||
// check settings (chat enabled for this video?)
|
// check settings (chat enabled for this video?)
|
||||||
const settings = await options.settingsManager.getSettings([
|
const settings = await options.settingsManager.getSettings([
|
||||||
'chat-use-prosody',
|
'chat-type',
|
||||||
'chat-only-locals',
|
'chat-only-locals',
|
||||||
'chat-all-lives',
|
'chat-all-lives',
|
||||||
'chat-all-non-lives',
|
'chat-all-non-lives',
|
||||||
'chat-videos-list'
|
'chat-videos-list'
|
||||||
])
|
])
|
||||||
if (!settings['chat-use-prosody']) {
|
if (settings['chat-type'] !== ('builtin-prosody' as ChatType)) {
|
||||||
logger.warn('Prosody chat is not active')
|
logger.warn('Prosody chat is not active')
|
||||||
res.sendStatus(403)
|
res.sendStatus(403)
|
||||||
return
|
return
|
||||||
@ -121,13 +122,13 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
|
|||||||
router.get('/user/check_password', asyncMiddleware(
|
router.get('/user/check_password', asyncMiddleware(
|
||||||
async (req: Request, res: Response, _next: NextFunction) => {
|
async (req: Request, res: Response, _next: NextFunction) => {
|
||||||
const settings = await options.settingsManager.getSettings([
|
const settings = await options.settingsManager.getSettings([
|
||||||
'chat-use-prosody',
|
'chat-type',
|
||||||
'chat-only-locals',
|
'chat-only-locals',
|
||||||
'chat-all-lives',
|
'chat-all-lives',
|
||||||
'chat-all-non-lives',
|
'chat-all-non-lives',
|
||||||
'chat-videos-list'
|
'chat-videos-list'
|
||||||
])
|
])
|
||||||
if (!settings['chat-use-prosody']) {
|
if (settings['chat-type'] !== ('builtin-prosody' as ChatType)) {
|
||||||
logger.warn('Prosody chat is not active')
|
logger.warn('Prosody chat is not active')
|
||||||
res.status(200).send('false')
|
res.status(200).send('false')
|
||||||
return
|
return
|
||||||
@ -152,13 +153,13 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
|
|||||||
router.get('/user/user_exists', asyncMiddleware(
|
router.get('/user/user_exists', asyncMiddleware(
|
||||||
async (req: Request, res: Response, _next: NextFunction) => {
|
async (req: Request, res: Response, _next: NextFunction) => {
|
||||||
const settings = await options.settingsManager.getSettings([
|
const settings = await options.settingsManager.getSettings([
|
||||||
'chat-use-prosody',
|
'chat-type',
|
||||||
'chat-only-locals',
|
'chat-only-locals',
|
||||||
'chat-all-lives',
|
'chat-all-lives',
|
||||||
'chat-all-non-lives',
|
'chat-all-non-lives',
|
||||||
'chat-videos-list'
|
'chat-videos-list'
|
||||||
])
|
])
|
||||||
if (!settings['chat-use-prosody']) {
|
if (settings['chat-type'] !== ('builtin-prosody' as ChatType)) {
|
||||||
logger.warn('Prosody chat is not active')
|
logger.warn('Prosody chat is not active')
|
||||||
res.status(200).send('false')
|
res.status(200).send('false')
|
||||||
return
|
return
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { Router, RequestHandler, Request, Response, NextFunction } from 'express'
|
import type { Router, RequestHandler, Request, Response, NextFunction } from 'express'
|
||||||
import type { ProxyOptions } from 'express-http-proxy'
|
import type { ProxyOptions } from 'express-http-proxy'
|
||||||
|
import type { ChatType } from '../../../shared/lib/types'
|
||||||
import { getBaseRouterRoute, getBaseStaticRoute } from '../helpers'
|
import { getBaseRouterRoute, getBaseStaticRoute } from '../helpers'
|
||||||
import { asyncMiddleware } from '../middlewares/async'
|
import { asyncMiddleware } from '../middlewares/async'
|
||||||
import { getProsodyDomain } from '../prosody/config/domain'
|
import { getProsodyDomain } from '../prosody/config/domain'
|
||||||
@ -27,9 +28,10 @@ async function initWebchatRouter (options: RegisterServerOptions): Promise<Route
|
|||||||
res.removeHeader('X-Frame-Options') // this route can be opened in an iframe
|
res.removeHeader('X-Frame-Options') // this route can be opened in an iframe
|
||||||
|
|
||||||
const settings = await settingsManager.getSettings([
|
const settings = await settingsManager.getSettings([
|
||||||
'chat-use-prosody', 'chat-use-builtin', 'chat-room', 'chat-server',
|
'chat-type', 'chat-room', 'chat-server',
|
||||||
'chat-bosh-uri', 'chat-ws-uri'
|
'chat-bosh-uri', 'chat-ws-uri'
|
||||||
])
|
])
|
||||||
|
const chatType: ChatType = (settings['chat-type'] ?? 'disabled') as ChatType
|
||||||
|
|
||||||
let server: string
|
let server: string
|
||||||
let room: string
|
let room: string
|
||||||
@ -37,7 +39,7 @@ async function initWebchatRouter (options: RegisterServerOptions): Promise<Route
|
|||||||
let wsUri: string
|
let wsUri: string
|
||||||
let authenticationUrl: string = ''
|
let authenticationUrl: string = ''
|
||||||
let advancedControls: boolean = false
|
let advancedControls: boolean = false
|
||||||
if (settings['chat-use-prosody']) {
|
if (chatType === 'builtin-prosody') {
|
||||||
const prosodyDomain = await getProsodyDomain(options)
|
const prosodyDomain = await getProsodyDomain(options)
|
||||||
server = 'anon.' + prosodyDomain
|
server = 'anon.' + prosodyDomain
|
||||||
room = '{{VIDEO_UUID}}@room.' + prosodyDomain
|
room = '{{VIDEO_UUID}}@room.' + prosodyDomain
|
||||||
@ -47,7 +49,7 @@ async function initWebchatRouter (options: RegisterServerOptions): Promise<Route
|
|||||||
getBaseRouterRoute(options) +
|
getBaseRouterRoute(options) +
|
||||||
'api/auth'
|
'api/auth'
|
||||||
advancedControls = true
|
advancedControls = true
|
||||||
} else if (settings['chat-use-builtin']) {
|
} else if (chatType === 'builtin-converse') {
|
||||||
if (!settings['chat-server']) {
|
if (!settings['chat-server']) {
|
||||||
throw new Error('Missing chat-server settings.')
|
throw new Error('Missing chat-server settings.')
|
||||||
}
|
}
|
||||||
|
@ -162,19 +162,9 @@ Before asking for help, please use this diagnostic tool:
|
|||||||
private: true
|
private: true
|
||||||
})
|
})
|
||||||
|
|
||||||
registerSetting({
|
|
||||||
name: 'chat-use-prosody',
|
|
||||||
label: 'Use builtin Prosody XMPP Server',
|
|
||||||
type: 'input-checkbox',
|
|
||||||
// /!\ dont auto-activate on existing settups. FIXME: how to do this?
|
|
||||||
default: false, // TODO: set to true when we have a way to know if the plugin was previously installed.
|
|
||||||
private: false,
|
|
||||||
descriptionHTML: 'If checked, this will use a builtin XMPP server. This is the recommanded setup.'
|
|
||||||
})
|
|
||||||
|
|
||||||
registerSetting({
|
registerSetting({
|
||||||
name: 'prosody-port',
|
name: 'prosody-port',
|
||||||
label: 'Builtin prosody: Prosody port',
|
label: 'Prosody port',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: '52800',
|
default: '52800',
|
||||||
private: true,
|
private: true,
|
||||||
@ -183,35 +173,20 @@ Before asking for help, please use this diagnostic tool:
|
|||||||
'You can close this port on your firewall, it will not be accessed from the outer world.'
|
'You can close this port on your firewall, it will not be accessed from the outer world.'
|
||||||
})
|
})
|
||||||
|
|
||||||
registerSetting({
|
|
||||||
name: 'chat-use-builtin',
|
|
||||||
label: 'Use builtin ConverseJS',
|
|
||||||
type: 'input-checkbox',
|
|
||||||
default: false,
|
|
||||||
private: false,
|
|
||||||
descriptionHTML: 'If checked, use a builtin ConverseJS iframe.<br>' +
|
|
||||||
'You still have to configure an external XMPP service. Please see the ' +
|
|
||||||
'<a href="https://github.com/JohnXLivingston/peertube-plugin-livechat" target="_blank">documentation<a>.<br>' +
|
|
||||||
'If you have no running webchat service, you can follow this ' +
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
'<a href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/documentation/tutorials/prosody.md" target="blank_">tutorial</a>.'
|
|
||||||
})
|
|
||||||
registerSetting({
|
registerSetting({
|
||||||
name: 'chat-server',
|
name: 'chat-server',
|
||||||
label: 'Builtin webchat: XMPP service server',
|
label: 'XMPP service server',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: '',
|
default: '',
|
||||||
descriptionHTML: 'When using the built-in converseJS webchat:<br>' +
|
descriptionHTML: 'Your XMPP server. Without any scheme. Example : peertube.im.your_domain.',
|
||||||
'Your XMPP server. Without any scheme. Example : peertube.im.your_domain.',
|
|
||||||
private: true
|
private: true
|
||||||
})
|
})
|
||||||
registerSetting({
|
registerSetting({
|
||||||
name: 'chat-room',
|
name: 'chat-room',
|
||||||
label: 'Builtin webchat: XMPP room template',
|
label: 'XMPP room template',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: '',
|
default: '',
|
||||||
descriptionHTML: 'When using the built-in converseJS webchat:<br>' +
|
descriptionHTML: 'Your XMPP room. You can use the placeholder {{VIDEO_UUID}} to add the video UUID.' +
|
||||||
'Your XMPP room. You can use the placeholder {{VIDEO_UUID}} to add the video UUID.' +
|
|
||||||
'Without this placeholder, all videos will point to the same chat room.<br>' +
|
'Without this placeholder, all videos will point to the same chat room.<br>' +
|
||||||
'Example: public@room.peertube.im.your_domain<br>' +
|
'Example: public@room.peertube.im.your_domain<br>' +
|
||||||
'Example: public_{{VIDEO_UUID}}@room.peertube.im.your_domain',
|
'Example: public_{{VIDEO_UUID}}@room.peertube.im.your_domain',
|
||||||
@ -219,21 +194,21 @@ Before asking for help, please use this diagnostic tool:
|
|||||||
})
|
})
|
||||||
registerSetting({
|
registerSetting({
|
||||||
name: 'chat-bosh-uri',
|
name: 'chat-bosh-uri',
|
||||||
label: 'Builtin webchat: BOSH uri',
|
label: 'BOSH uri',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: '',
|
default: '',
|
||||||
descriptionHTML: 'When using the built-in converseJS webchat:<br>' +
|
descriptionHTML: 'URI of the external BOSH server. ' +
|
||||||
'URI of the external BOSH server. Please make sure it accept cross origin request from your domain.<br>' +
|
'Please make sure it accept cross origin request from your domain.<br>' +
|
||||||
'You must at least have a BOSH or a Websocket uri.',
|
'You must at least have a BOSH or a Websocket uri.',
|
||||||
private: true
|
private: true
|
||||||
})
|
})
|
||||||
registerSetting({
|
registerSetting({
|
||||||
name: 'chat-ws-uri',
|
name: 'chat-ws-uri',
|
||||||
label: 'Builtin webchat: WS uri',
|
label: 'Websocket uri',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: '',
|
default: '',
|
||||||
descriptionHTML: 'When using the built-in converseJS webchat:<br>' +
|
descriptionHTML: 'URI of the external WS server. ' +
|
||||||
'URI of the external WS server. Please make sure it accept cross origin request from your domain.<br>' +
|
'Please make sure it accept cross origin request from your domain.<br>' +
|
||||||
'You must at least have a BOSH or a Websocket uri.',
|
'You must at least have a BOSH or a Websocket uri.',
|
||||||
private: true
|
private: true
|
||||||
})
|
})
|
||||||
@ -243,8 +218,7 @@ Before asking for help, please use this diagnostic tool:
|
|||||||
label: 'Webchat url',
|
label: 'Webchat url',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: '',
|
default: '',
|
||||||
descriptionHTML: '<b>If you dont want to use the builtin ConverseJS webchat:</b><br>' +
|
descriptionHTML: 'Put here your webchat url. An iframe will be created pointing to this url. ' +
|
||||||
'Put here your webchat url. An iframe will be created pointing to this url. ' +
|
|
||||||
'The placeholder {{VIDEO_UUID}} will be replace by the video UUID if present. ' +
|
'The placeholder {{VIDEO_UUID}} will be replace by the video UUID if present. ' +
|
||||||
'Example : https://my_domain/conversejs.html?room=video_{{VIDEO_UUID}}.<br>' +
|
'Example : https://my_domain/conversejs.html?room=video_{{VIDEO_UUID}}.<br>' +
|
||||||
'If this field is empty, it will use the builtin ConverseJS webchat.',
|
'If this field is empty, it will use the builtin ConverseJS webchat.',
|
||||||
@ -264,11 +238,12 @@ Before asking for help, please use this diagnostic tool:
|
|||||||
// settings changes management
|
// settings changes management
|
||||||
|
|
||||||
settingsManager.onSettingsChange(async (settings: any) => {
|
settingsManager.onSettingsChange(async (settings: any) => {
|
||||||
if ('chat-use-prosody' in settings) {
|
if ('chat-type' in settings) {
|
||||||
if (settings['chat-use-prosody'] === true) {
|
const chatType: ChatType = settings['chat-type'] ?? 'disabled'
|
||||||
|
if (chatType === 'builtin-prosody') {
|
||||||
peertubeHelpers.logger.info('Saving settings, ensuring prosody is running')
|
peertubeHelpers.logger.info('Saving settings, ensuring prosody is running')
|
||||||
await ensureProsodyRunning(options)
|
await ensureProsodyRunning(options)
|
||||||
} else if (settings['chat-use-prosody'] === false) {
|
} else {
|
||||||
peertubeHelpers.logger.info('Saving settings, ensuring prosody is not running')
|
peertubeHelpers.logger.info('Saving settings, ensuring prosody is not running')
|
||||||
await ensureProsodyNotRunning(options)
|
await ensureProsodyNotRunning(options)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user