2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-01-11 00:29:33 +00:00
|
|
|
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
2022-10-10 16:08:20 +00:00
|
|
|
import type { ConverseJSTheme } from '../../shared/lib/types'
|
2023-09-18 13:05:21 +00:00
|
|
|
import { ensureProsodyRunning } from './prosody/ctl'
|
|
|
|
import { RoomChannel } from './room-channel'
|
2023-09-18 16:53:07 +00:00
|
|
|
import { BotsCtl } from './bots/ctl'
|
2024-04-22 11:03:31 +00:00
|
|
|
import { ExternalAuthOIDC, ExternalAuthOIDCType } from './external-auth/oidc'
|
2024-06-04 14:39:25 +00:00
|
|
|
import { Emojis } from './emojis'
|
2024-06-17 13:21:22 +00:00
|
|
|
import { LivechatProsodyAuth } from './prosody/auth'
|
2023-06-12 17:26:28 +00:00
|
|
|
import { loc } from './loc'
|
2024-04-16 15:18:14 +00:00
|
|
|
const escapeHTML = require('escape-html')
|
2023-02-15 10:54:48 +00:00
|
|
|
|
2024-08-05 21:54:22 +00:00
|
|
|
type AvatarSet = 'sepia' | 'cat' | 'bird' | 'fenec' | 'abstract' | 'legacy' | 'nctv'
|
2024-02-09 11:41:05 +00:00
|
|
|
|
2023-02-15 10:54:48 +00:00
|
|
|
async function initSettings (options: RegisterServerOptions): Promise<void> {
|
2024-04-15 13:12:14 +00:00
|
|
|
const { peertubeHelpers, settingsManager } = options
|
2024-04-16 15:18:14 +00:00
|
|
|
const logger = peertubeHelpers.logger
|
2021-04-08 00:43:13 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
initImportantNotesSettings(options)
|
|
|
|
initChatSettings(options)
|
|
|
|
initFederationSettings(options)
|
2024-06-17 13:21:22 +00:00
|
|
|
initAuth(options)
|
2024-04-15 16:29:09 +00:00
|
|
|
initExternalAuth(options)
|
2024-04-15 13:12:14 +00:00
|
|
|
initAdvancedChannelCustomizationSettings(options)
|
|
|
|
initChatBehaviourSettings(options)
|
|
|
|
initThemingSettings(options)
|
|
|
|
initChatServerAdvancedSettings(options)
|
|
|
|
|
2024-04-22 11:03:31 +00:00
|
|
|
await ExternalAuthOIDC.initSingletons(options)
|
|
|
|
const loadOidcs = (): void => {
|
|
|
|
const oidcs = ExternalAuthOIDC.allSingletons()
|
|
|
|
for (const oidc of oidcs) {
|
|
|
|
try {
|
|
|
|
const type = oidc.type
|
|
|
|
oidc.isOk().then(
|
|
|
|
() => {
|
|
|
|
logger.info(`Loading External Auth OIDC ${type}...`)
|
|
|
|
oidc.load().then(
|
|
|
|
() => {
|
|
|
|
logger.info(`External Auth OIDC ${type} loaded`)
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
logger.error(`Loading the External Auth OIDC ${type} failed`)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
logger.info(`No valid External Auth OIDC ${type}, nothing loaded`)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
} catch (err) {
|
|
|
|
logger.error(err as string)
|
|
|
|
continue
|
|
|
|
}
|
2024-04-16 15:18:14 +00:00
|
|
|
}
|
|
|
|
}
|
2024-04-22 11:03:31 +00:00
|
|
|
loadOidcs() // we don't have to wait (can take time, it will do external http requests)
|
2024-04-15 16:29:09 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
let currentProsodyRoomtype = (await settingsManager.getSettings(['prosody-room-type']))['prosody-room-type']
|
|
|
|
|
|
|
|
// ********** settings changes management
|
|
|
|
settingsManager.onSettingsChange(async (settings: any) => {
|
|
|
|
// In case the Prosody port has changed, we must rewrite the Bot configuration file.
|
|
|
|
// To avoid race condition, we will just stop and start the bots at every settings saving.
|
|
|
|
await BotsCtl.destroySingleton()
|
|
|
|
await BotsCtl.initSingleton(options)
|
2024-04-22 11:03:31 +00:00
|
|
|
loadOidcs() // we don't have to wait (can take time, it will do external http requests)
|
2024-04-15 13:12:14 +00:00
|
|
|
|
2024-04-22 11:03:31 +00:00
|
|
|
await ExternalAuthOIDC.initSingletons(options)
|
2024-04-15 16:29:09 +00:00
|
|
|
|
2024-06-04 14:39:25 +00:00
|
|
|
// recreating a Emojis singleton
|
|
|
|
await Emojis.destroySingleton()
|
|
|
|
await Emojis.initSingleton(options)
|
|
|
|
|
2024-06-17 13:21:22 +00:00
|
|
|
LivechatProsodyAuth.singleton().setUserTokensEnabled(!settings['livechat-token-disabled'])
|
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
peertubeHelpers.logger.info('Saving settings, ensuring prosody is running')
|
|
|
|
await ensureProsodyRunning(options)
|
|
|
|
|
|
|
|
await BotsCtl.singleton().start()
|
|
|
|
|
|
|
|
// In case prosody-room-type changed, we must rebuild room-channel links.
|
|
|
|
if (settings['prosody-room-type'] !== currentProsodyRoomtype) {
|
|
|
|
peertubeHelpers.logger.info('Setting prosody-room-type has changed value, must rebuild room-channel infos')
|
|
|
|
// doing it without waiting, could be long!
|
|
|
|
RoomChannel.singleton().rebuildData().then(
|
|
|
|
() => peertubeHelpers.logger.info('Room-channel info rebuild ok.'),
|
|
|
|
(err) => peertubeHelpers.logger.error(err)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
currentProsodyRoomtype = settings['prosody-room-type']
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers settings related to the "Important Notes" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initImportantNotesSettings ({ registerSetting }: RegisterServerOptions): void {
|
2021-04-12 14:31:48 +00:00
|
|
|
registerSetting({
|
2021-06-03 10:20:19 +00:00
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('important_note_title')
|
2021-06-03 10:20:19 +00:00
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('important_note_text')
|
2021-06-03 10:20:19 +00:00
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('diagnostic')
|
2021-04-12 14:31:48 +00:00
|
|
|
})
|
2021-06-03 10:20:19 +00:00
|
|
|
|
2023-05-31 16:13:35 +00:00
|
|
|
if (process.arch !== 'x64' && process.arch !== 'x86_64' && process.arch !== 'arm64') {
|
2022-12-12 18:17:43 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-arch-warning',
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
// Note: the following text as a variable in it.
|
|
|
|
// Not translating it: it should be very rare.
|
2022-12-12 18:17:43 +00:00
|
|
|
descriptionHTML: `<span class="peertube-plugin-livechat-warning">
|
|
|
|
It seems that your are using a ${process.arch} CPU,
|
|
|
|
which is not compatible with the plugin.
|
2023-02-13 17:03:23 +00:00
|
|
|
Please read
|
2022-12-12 18:17:43 +00:00
|
|
|
<a
|
2024-06-19 09:06:11 +00:00
|
|
|
href="https://livingston.frama.io/peertube-plugin-livechat/documentation/installation/cpu_compatibility/"
|
2022-12-12 18:17:43 +00:00
|
|
|
target="_blank"
|
|
|
|
>
|
2023-02-13 17:03:23 +00:00
|
|
|
this page
|
2022-12-12 18:17:43 +00:00
|
|
|
</a> for a workaround.
|
|
|
|
</span>`
|
|
|
|
})
|
|
|
|
}
|
2024-04-15 13:12:14 +00:00
|
|
|
}
|
2022-12-12 18:17:43 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
/**
|
|
|
|
* Register settings related to the "Chat" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initChatSettings ({ registerSetting }: RegisterServerOptions): void {
|
2021-06-03 10:20:19 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('chat_title')
|
2021-06-03 10:20:19 +00:00
|
|
|
})
|
2024-06-21 16:18:11 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'chat-terms',
|
|
|
|
private: true,
|
|
|
|
label: loc('chat_terms_label'),
|
|
|
|
type: 'input-textarea',
|
|
|
|
default: '',
|
|
|
|
descriptionHTML: loc('chat_terms_description')
|
|
|
|
})
|
2021-06-11 23:16:57 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-list-rooms',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('list_rooms_label'),
|
2021-06-11 23:16:57 +00:00
|
|
|
type: 'html',
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('list_rooms_description'),
|
2021-06-11 23:16:57 +00:00
|
|
|
private: true
|
|
|
|
})
|
2024-04-15 13:12:14 +00:00
|
|
|
}
|
2021-08-05 13:41:49 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
/**
|
|
|
|
* Registers settings related to the "Federation" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initFederationSettings ({ registerSetting }: RegisterServerOptions): void {
|
2023-04-20 10:13:22 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('federation_description')
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'federation-no-remote-chat',
|
|
|
|
label: loc('federation_no_remote_chat_label'),
|
|
|
|
descriptionHTML: loc('federation_no_remote_chat_description'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: false
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'federation-dont-publish-remotely',
|
|
|
|
label: loc('federation_dont_publish_remotely_label'),
|
|
|
|
descriptionHTML: loc('federation_dont_publish_remotely_description'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: true
|
|
|
|
})
|
2024-04-15 13:12:14 +00:00
|
|
|
}
|
2023-04-20 10:13:22 +00:00
|
|
|
|
2024-06-17 13:21:22 +00:00
|
|
|
/**
|
|
|
|
* Initialize settings related to authentication.
|
|
|
|
* @param options peertube server options
|
|
|
|
*/
|
|
|
|
function initAuth (options: RegisterServerOptions): void {
|
|
|
|
const registerSetting = options.registerSetting
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('auth_description')
|
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('experimental_warning')
|
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'livechat-token-disabled',
|
|
|
|
label: loc('livechat_token_disabled_label'),
|
|
|
|
descriptionHTML: loc('livechat_token_disabled_description'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-04-15 16:29:09 +00:00
|
|
|
/**
|
|
|
|
* Registers settings related to the "External Authentication" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
2024-04-16 15:18:14 +00:00
|
|
|
function initExternalAuth (options: RegisterServerOptions): void {
|
|
|
|
const registerSetting = options.registerSetting
|
|
|
|
|
2024-04-15 16:29:09 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('external_auth_description')
|
|
|
|
})
|
2024-04-16 15:18:14 +00:00
|
|
|
|
2024-04-19 09:03:50 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('external_auth_custom_oidc_title')
|
|
|
|
})
|
|
|
|
|
2024-04-16 15:18:14 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('experimental_warning')
|
|
|
|
})
|
|
|
|
|
2024-04-15 16:29:09 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-custom-oidc',
|
|
|
|
label: loc('external_auth_custom_oidc_label'),
|
|
|
|
descriptionHTML: loc('external_auth_custom_oidc_description'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: true
|
|
|
|
})
|
2024-04-16 15:18:14 +00:00
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
name: 'external-auth-custom-oidc-redirect-uris-info',
|
|
|
|
private: true,
|
2024-04-22 11:03:31 +00:00
|
|
|
descriptionHTML: loc('external_auth_oidc_redirect_uris_info_description')
|
2024-04-16 15:18:14 +00:00
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
name: 'external-auth-custom-oidc-redirect-uris',
|
|
|
|
private: true,
|
2024-04-22 11:03:31 +00:00
|
|
|
descriptionHTML: `<ul><li>${escapeHTML(ExternalAuthOIDC.redirectUrl(options, 'custom')) as string}</li></ul>`
|
2024-04-16 15:18:14 +00:00
|
|
|
})
|
|
|
|
|
2024-04-15 16:29:09 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-custom-oidc-button-label',
|
|
|
|
label: loc('external_auth_custom_oidc_button_label_label'),
|
|
|
|
descriptionHTML: loc('external_auth_custom_oidc_button_label_description'),
|
|
|
|
type: 'input',
|
|
|
|
default: '',
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-custom-oidc-discovery-url',
|
|
|
|
label: loc('external_auth_custom_oidc_discovery_url_label'),
|
|
|
|
// descriptionHTML: loc('external_auth_custom_oidc_discovery_url_description'),
|
|
|
|
type: 'input',
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-custom-oidc-client-id',
|
2024-04-22 11:03:31 +00:00
|
|
|
label: loc('external_auth_oidc_client_id_label'),
|
|
|
|
// descriptionHTML: loc('external_auth_oidc_client_id_description'),
|
2024-04-15 16:29:09 +00:00
|
|
|
type: 'input',
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-custom-oidc-client-secret',
|
2024-04-22 11:03:31 +00:00
|
|
|
label: loc('external_auth_oidc_client_secret_label'),
|
|
|
|
// descriptionHTML: loc('external_auth_oidc_client_secret_description'),
|
2024-04-15 16:29:09 +00:00
|
|
|
type: 'input-password',
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
|
2024-04-19 09:03:50 +00:00
|
|
|
// FIXME: adding settings for these?
|
|
|
|
// - scope (default: 'openid profile')
|
|
|
|
// - user-name property
|
|
|
|
// - display-name property
|
|
|
|
// - picture property
|
2024-04-22 11:03:31 +00:00
|
|
|
|
|
|
|
// Standard providers....
|
|
|
|
for (const provider of ['google', 'facebook']) {
|
|
|
|
let redirectUrl
|
|
|
|
try {
|
|
|
|
redirectUrl = ExternalAuthOIDC.redirectUrl(options, provider as ExternalAuthOIDCType)
|
|
|
|
} catch (err) {
|
|
|
|
options.peertubeHelpers.logger.error('Cant load redirect url for provider ' + provider)
|
|
|
|
options.peertubeHelpers.logger.error(err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-' + provider + '-oidc',
|
|
|
|
label: loc('external_auth_' + provider + '_oidc_label'),
|
|
|
|
descriptionHTML: loc('external_auth_' + provider + '_oidc_description'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
name: 'external-auth-' + provider + '-oidc-redirect-uris-info',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('external_auth_oidc_redirect_uris_info_description')
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
name: 'external-auth-' + provider + '-oidc-redirect-uris',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: `<ul><li>${escapeHTML(redirectUrl) as string}</li></ul>`
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-' + provider + '-oidc-client-id',
|
|
|
|
label: loc('external_auth_oidc_client_id_label'),
|
|
|
|
// descriptionHTML: loc('external_auth_' + provider + '_oidc_client_id_description'),
|
|
|
|
type: 'input',
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'external-auth-' + provider + '-oidc-client-secret',
|
|
|
|
label: loc('external_auth_oidc_client_secret_label'),
|
|
|
|
// descriptionHTML: loc('external_auth_' + provider + '_oidc_client_secret_description'),
|
|
|
|
type: 'input-password',
|
|
|
|
private: true
|
|
|
|
})
|
|
|
|
}
|
2024-04-15 16:29:09 +00:00
|
|
|
}
|
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
/**
|
|
|
|
* Registers settings related to the "Advanced channel customization" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initAdvancedChannelCustomizationSettings ({ registerSetting }: RegisterServerOptions): void {
|
2023-09-06 13:56:55 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('configuration_description')
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('experimental_warning')
|
|
|
|
})
|
|
|
|
registerSetting({
|
2023-09-18 16:53:07 +00:00
|
|
|
name: 'disable-channel-configuration',
|
|
|
|
label: loc('disable_channel_configuration_label'),
|
|
|
|
// descriptionHTML: loc('disable_channel_configuration_description'),
|
2023-09-06 13:56:55 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: false
|
|
|
|
})
|
2024-04-15 13:12:14 +00:00
|
|
|
}
|
2023-09-06 13:56:55 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
/**
|
|
|
|
* Registers settings related to the "Chat behaviour" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initChatBehaviourSettings ({ registerSetting }: RegisterServerOptions): void {
|
2022-11-15 16:19:49 +00:00
|
|
|
registerSetting({
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('chat_behaviour_description')
|
2022-11-15 16:19:49 +00:00
|
|
|
})
|
2021-08-05 13:41:49 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-room-type',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('room_type_label'),
|
2021-08-05 13:41:49 +00:00
|
|
|
type: 'select',
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('room_type_description'),
|
2021-08-05 13:41:49 +00:00
|
|
|
private: false,
|
|
|
|
default: 'video',
|
|
|
|
options: [
|
2023-02-15 10:54:48 +00:00
|
|
|
{ value: 'video', label: loc('room_type_option_video') },
|
|
|
|
{ value: 'channel', label: loc('room_type_option_channel') }
|
2021-08-05 13:41:49 +00:00
|
|
|
]
|
|
|
|
})
|
2021-06-03 10:24:09 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'chat-auto-display',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('auto_display_label'),
|
|
|
|
descriptionHTML: loc('auto_display_description'),
|
2021-06-03 10:24:09 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: true,
|
|
|
|
private: false
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'chat-open-blank',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('open_blank_label'),
|
|
|
|
descriptionHTML: loc('open_blank_description'),
|
2021-06-03 10:24:09 +00:00
|
|
|
private: false,
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: true
|
|
|
|
})
|
2022-11-15 16:19:49 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'chat-share-url',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('share_url_label'),
|
|
|
|
descriptionHTML: loc('share_url_description'),
|
2022-11-15 16:19:49 +00:00
|
|
|
private: false,
|
|
|
|
type: 'select',
|
|
|
|
default: 'owner',
|
|
|
|
options: [
|
2023-02-15 10:54:48 +00:00
|
|
|
{ value: 'nobody', label: loc('share_url_option_nobody') },
|
|
|
|
{ value: 'everyone', label: loc('share_url_option_everyone') },
|
|
|
|
{ value: 'owner', label: loc('share_url_option_owner') },
|
|
|
|
{ value: 'owner+moderators', label: loc('share_url_option_owner_moderators') }
|
2022-11-15 16:19:49 +00:00
|
|
|
]
|
|
|
|
})
|
2021-06-08 16:08:58 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'chat-per-live-video',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('per_live_video_label'),
|
2021-06-08 16:08:58 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('per_live_video_description'),
|
2021-06-08 16:08:58 +00:00
|
|
|
private: false
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'chat-per-live-video-warning',
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('per_live_video_warning_description')
|
2021-06-03 10:24:09 +00:00
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'chat-all-lives',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('all_lives_label'),
|
2021-06-03 10:24:09 +00:00
|
|
|
type: 'input-checkbox',
|
2021-06-08 16:08:58 +00:00
|
|
|
default: false,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('all_lives_description'),
|
2021-06-03 10:24:09 +00:00
|
|
|
private: false
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'chat-all-non-lives',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('all_non_lives_label'),
|
2021-06-03 10:24:09 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('all_non_lives_description'),
|
2021-06-03 10:24:09 +00:00
|
|
|
private: false
|
|
|
|
})
|
|
|
|
registerSetting({
|
|
|
|
name: 'chat-videos-list',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('videos_list_label'),
|
2021-06-03 10:24:09 +00:00
|
|
|
type: 'input-textarea',
|
|
|
|
default: '',
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('videos_list_description'),
|
2021-06-03 10:24:09 +00:00
|
|
|
private: false
|
|
|
|
})
|
2022-04-11 16:12:12 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'chat-no-anonymous',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('no_anonymous_label'),
|
2022-04-11 16:12:12 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('no_anonymous_description'),
|
2022-04-11 16:12:12 +00:00
|
|
|
private: false
|
|
|
|
})
|
2023-09-22 16:17:54 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'auto-ban-anonymous-ip',
|
|
|
|
label: loc('auto_ban_anonymous_ip_label'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
descriptionHTML: loc('auto_ban_anonymous_ip_description'),
|
|
|
|
private: true
|
|
|
|
})
|
2024-04-15 13:12:14 +00:00
|
|
|
}
|
2021-06-03 10:24:09 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
/**
|
|
|
|
* Registers settings related to the "Theming" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initThemingSettings ({ registerSetting }: RegisterServerOptions): void {
|
2021-04-08 00:43:13 +00:00
|
|
|
registerSetting({
|
2022-11-15 16:19:49 +00:00
|
|
|
name: 'theming-advanced',
|
2021-11-18 10:08:12 +00:00
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('theming_advanced_description')
|
2021-11-18 10:08:12 +00:00
|
|
|
})
|
|
|
|
|
2024-02-09 11:41:05 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'avatar-set',
|
|
|
|
label: loc('avatar_set_label'),
|
|
|
|
descriptionHTML: loc('avatar_set_description'),
|
|
|
|
type: 'select',
|
|
|
|
default: 'sepia' as AvatarSet,
|
|
|
|
private: true,
|
|
|
|
options: [
|
|
|
|
{ value: 'sepia', label: loc('avatar_set_option_sepia') },
|
2024-08-05 23:46:09 +00:00
|
|
|
{ value: 'nctv', label: loc('avatar_set_option_nctv') },
|
2024-02-09 12:17:12 +00:00
|
|
|
{ value: 'cat', label: loc('avatar_set_option_cat') },
|
2024-02-09 14:12:48 +00:00
|
|
|
{ value: 'bird', label: loc('avatar_set_option_bird') },
|
2024-02-09 14:35:40 +00:00
|
|
|
{ value: 'fenec', label: loc('avatar_set_option_fenec') },
|
2024-02-12 15:50:08 +00:00
|
|
|
{ value: 'abstract', label: loc('avatar_set_option_abstract') },
|
2024-02-09 11:41:05 +00:00
|
|
|
{ value: 'legacy', label: loc('avatar_set_option_legacy') }
|
|
|
|
] as Array<{
|
|
|
|
value: AvatarSet
|
|
|
|
label: string
|
|
|
|
}>
|
|
|
|
})
|
|
|
|
|
2021-11-18 10:08:12 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'converse-theme',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('converse_theme_label'),
|
2021-11-18 10:08:12 +00:00
|
|
|
type: 'select',
|
|
|
|
default: 'peertube' as ConverseJSTheme,
|
2021-11-19 15:45:10 +00:00
|
|
|
private: false,
|
2021-11-18 10:08:12 +00:00
|
|
|
options: [
|
2023-02-15 10:54:48 +00:00
|
|
|
{ value: 'peertube', label: loc('peertube') },
|
|
|
|
{ value: 'default', label: loc('default') },
|
|
|
|
{ value: 'concord', label: loc('concord') }
|
2021-11-18 10:08:12 +00:00
|
|
|
] as Array<{value: ConverseJSTheme, label: string}>,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('converse_theme_description')
|
2021-11-18 10:08:12 +00:00
|
|
|
})
|
|
|
|
|
2021-11-19 15:45:10 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'converse-autocolors',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('autocolors_label'),
|
2021-11-19 15:45:10 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: true,
|
|
|
|
private: false,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('autocolors_description')
|
2021-11-19 15:45:10 +00:00
|
|
|
})
|
|
|
|
|
2022-11-15 16:19:49 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'chat-style',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('chat_style_label'),
|
2022-11-15 16:19:49 +00:00
|
|
|
type: 'input-textarea',
|
|
|
|
default: '',
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('chat_style_description'),
|
2022-11-15 16:19:49 +00:00
|
|
|
private: false
|
|
|
|
})
|
2024-04-15 13:12:14 +00:00
|
|
|
}
|
2022-11-15 16:19:49 +00:00
|
|
|
|
2024-04-15 13:12:14 +00:00
|
|
|
/**
|
|
|
|
* Registers settings related to the "Chat server advanded settings" section.
|
|
|
|
* @param param0 server options
|
|
|
|
*/
|
|
|
|
function initChatServerAdvancedSettings ({ registerSetting }: RegisterServerOptions): void {
|
2021-07-13 15:40:29 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-advanced',
|
|
|
|
type: 'html',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_advanced_description')
|
2021-07-13 15:40:29 +00:00
|
|
|
})
|
|
|
|
|
2021-12-21 18:54:37 +00:00
|
|
|
registerSetting({
|
2022-11-15 16:19:49 +00:00
|
|
|
name: 'chat-help-builtin-prosody',
|
|
|
|
type: 'html',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('help_builtin_prosody_label'),
|
|
|
|
descriptionHTML: loc('help_builtin_prosody_description'),
|
2022-11-15 16:19:49 +00:00
|
|
|
private: true
|
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'use-system-prosody',
|
|
|
|
type: 'input-checkbox',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('system_prosody_label'),
|
|
|
|
descriptionHTML: loc('system_prosody_description'),
|
2022-11-15 16:19:49 +00:00
|
|
|
private: true,
|
|
|
|
default: false
|
2021-12-21 18:54:37 +00:00
|
|
|
})
|
2022-11-15 16:19:49 +00:00
|
|
|
|
2022-12-08 10:25:57 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'disable-websocket',
|
|
|
|
type: 'input-checkbox',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('disable_websocket_label'),
|
|
|
|
descriptionHTML: loc('disable_websocket_description'),
|
2022-12-08 10:25:57 +00:00
|
|
|
private: true,
|
|
|
|
default: false
|
|
|
|
})
|
|
|
|
|
2022-11-15 16:19:49 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-port',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_port_label'),
|
2022-11-15 16:19:49 +00:00
|
|
|
type: 'input',
|
|
|
|
default: '52800',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_port_description')
|
2022-11-15 16:19:49 +00:00
|
|
|
})
|
|
|
|
|
2021-07-14 17:22:25 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-peertube-uri',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_peertube_uri_label'),
|
2021-07-14 17:22:25 +00:00
|
|
|
type: 'input',
|
|
|
|
default: '',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_peertube_uri_description')
|
2021-07-14 17:22:25 +00:00
|
|
|
})
|
|
|
|
|
2021-12-01 11:57:15 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-muc-log-by-default',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_muc_log_by_default_label'),
|
2021-12-01 11:57:15 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: true,
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_muc_log_by_default_description')
|
2021-12-01 11:57:15 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-muc-expiration',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_muc_expiration_label'),
|
2021-12-01 11:57:15 +00:00
|
|
|
type: 'input',
|
|
|
|
default: '1w',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_muc_expiration_description')
|
2021-12-01 11:57:15 +00:00
|
|
|
})
|
|
|
|
|
2023-04-07 16:27:15 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-room-allow-s2s',
|
|
|
|
label: loc('prosody_room_allow_s2s_label'),
|
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
2023-04-10 16:21:32 +00:00
|
|
|
private: false,
|
2023-04-07 16:27:15 +00:00
|
|
|
descriptionHTML: loc('prosody_room_allow_s2s_description')
|
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-s2s-port',
|
|
|
|
label: loc('prosody_s2s_port_label'),
|
|
|
|
type: 'input',
|
|
|
|
default: '5269',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('prosody_s2s_port_description')
|
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-s2s-interfaces',
|
|
|
|
label: loc('prosody_s2s_interfaces_label'),
|
|
|
|
type: 'input',
|
|
|
|
default: '*, ::',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('prosody_s2s_interfaces_description')
|
|
|
|
})
|
|
|
|
|
2023-04-13 16:22:03 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-certificates-dir',
|
|
|
|
label: loc('prosody_certificates_dir_label'),
|
|
|
|
type: 'input',
|
|
|
|
default: '',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('prosody_certificates_dir_description')
|
|
|
|
})
|
|
|
|
|
2021-07-13 15:40:29 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-c2s',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_c2s_label'),
|
2021-07-13 15:40:29 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_c2s_description')
|
2021-07-13 15:40:29 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-c2s-port',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_c2s_port_label'),
|
2021-07-13 15:40:29 +00:00
|
|
|
type: 'input',
|
|
|
|
default: '52822',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_c2s_port_description')
|
2024-05-27 14:32:40 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-c2s-interfaces',
|
|
|
|
label: loc('prosody_c2s_interfaces_label'),
|
|
|
|
type: 'input',
|
|
|
|
default: '127.0.0.1, ::1',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('prosody_c2s_interfaces_description')
|
2021-12-11 18:09:01 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-components',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_components_label'),
|
2021-12-11 18:09:01 +00:00
|
|
|
type: 'input-checkbox',
|
|
|
|
default: false,
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_components_description')
|
2021-12-11 18:09:01 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-components-port',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_components_port_label'),
|
2021-12-11 18:09:01 +00:00
|
|
|
type: 'input',
|
|
|
|
default: '53470',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_components_port_description')
|
2021-12-11 18:09:01 +00:00
|
|
|
})
|
|
|
|
|
2023-08-10 12:45:04 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-components-interfaces',
|
|
|
|
label: loc('prosody_components_interfaces_label'),
|
|
|
|
type: 'input',
|
|
|
|
default: '127.0.0.1, ::1',
|
|
|
|
private: true,
|
|
|
|
descriptionHTML: loc('prosody_components_interfaces_description')
|
|
|
|
})
|
|
|
|
|
2021-12-11 18:09:01 +00:00
|
|
|
registerSetting({
|
|
|
|
name: 'prosody-components-list',
|
2023-02-15 10:54:48 +00:00
|
|
|
label: loc('prosody_components_list_label'),
|
2021-12-11 18:09:01 +00:00
|
|
|
type: 'input-textarea',
|
|
|
|
default: '',
|
|
|
|
private: true,
|
2023-02-15 10:54:48 +00:00
|
|
|
descriptionHTML: loc('prosody_components_list_description')
|
2021-07-13 15:40:29 +00:00
|
|
|
})
|
2021-04-08 00:43:13 +00:00
|
|
|
}
|
2021-06-02 17:16:27 +00:00
|
|
|
|
|
|
|
export {
|
2024-02-09 11:41:05 +00:00
|
|
|
initSettings,
|
|
|
|
AvatarSet
|
2021-06-02 17:16:27 +00:00
|
|
|
}
|