This commit is contained in:
2024-09-05 22:17:17 -04:00
251 changed files with 30235 additions and 6952 deletions

View File

@ -11,9 +11,10 @@ import { ExternalAuthOIDC, ExternalAuthOIDCType } from './external-auth/oidc'
import { Emojis } from './emojis'
import { LivechatProsodyAuth } from './prosody/auth'
import { loc } from './loc'
import { canEditFirewallConfig } from './firewall/config'
const escapeHTML = require('escape-html')
type AvatarSet = 'sepia' | 'cat' | 'bird' | 'fenec' | 'abstract' | 'legacy' | 'nctv'
type AvatarSet = 'sepia' | 'cat' | 'bird' | 'fenec' | 'abstract' | 'legacy' | 'nctv' | 'none'
async function initSettings (options: RegisterServerOptions): Promise<void> {
const { peertubeHelpers, settingsManager } = options
@ -27,7 +28,7 @@ async function initSettings (options: RegisterServerOptions): Promise<void> {
initAdvancedChannelCustomizationSettings(options)
initChatBehaviourSettings(options)
initThemingSettings(options)
initChatServerAdvancedSettings(options)
await initChatServerAdvancedSettings(options)
await ExternalAuthOIDC.initSingletons(options)
const loadOidcs = (): void => {
@ -511,7 +512,8 @@ function initThemingSettings ({ registerSetting }: RegisterServerOptions): void
{ value: 'bird', label: loc('avatar_set_option_bird') },
{ value: 'fenec', label: loc('avatar_set_option_fenec') },
{ value: 'abstract', label: loc('avatar_set_option_abstract') },
{ value: 'legacy', label: loc('avatar_set_option_legacy') }
{ value: 'legacy', label: loc('avatar_set_option_legacy') },
{ value: 'none', label: loc('avatar_set_option_none') }
] as Array<{
value: AvatarSet
label: string
@ -525,9 +527,9 @@ function initThemingSettings ({ registerSetting }: RegisterServerOptions): void
default: 'peertube' as ConverseJSTheme,
private: false,
options: [
{ value: 'peertube', label: loc('peertube') },
{ value: 'default', label: loc('default') },
{ value: 'concord', label: loc('concord') }
{ value: 'peertube', label: loc('converse_theme_option_peertube') },
{ value: 'default', label: loc('converse_theme_option_default') },
{ value: 'cyberpunk', label: loc('converse_theme_option_cyberpunk') }
] as Array<{value: ConverseJSTheme, label: string}>,
descriptionHTML: loc('converse_theme_description')
})
@ -555,7 +557,9 @@ function initThemingSettings ({ registerSetting }: RegisterServerOptions): void
* Registers settings related to the "Chat server advanded settings" section.
* @param param0 server options
*/
function initChatServerAdvancedSettings ({ registerSetting }: RegisterServerOptions): void {
async function initChatServerAdvancedSettings (options: RegisterServerOptions): Promise<void> {
const { registerSetting } = options
registerSetting({
name: 'prosody-advanced',
type: 'html',
@ -723,6 +727,23 @@ function initChatServerAdvancedSettings ({ registerSetting }: RegisterServerOpti
private: true,
descriptionHTML: loc('prosody_components_list_description')
})
registerSetting({
name: 'prosody-firewall-enabled',
label: loc('prosody_firewall_label'),
type: 'input-checkbox',
default: false,
private: true,
descriptionHTML: loc('prosody_firewall_description')
})
if (await canEditFirewallConfig(options)) {
registerSetting({
type: 'html',
name: 'prosody-firewall-configure-button',
private: true,
descriptionHTML: loc('prosody_firewall_configure_button')
})
}
}
export {