diff --git a/CHANGELOG.md b/CHANGELOG.md index c07af460..31697e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Minor changes and fixes +* Avatar set for anonymous users: new 'none' choice (that will fallback to Converse new colorized avatars). * New translation: Albanian. * Translation updates: Crotian, Japanese. diff --git a/languages/en.yml b/languages/en.yml index 35c2d624..caa4808a 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -181,6 +181,7 @@ avatar_set_option_fenec: "Fenecs (Mobilizon mascot)" avatar_set_option_abstract: Abstract avatar_set_option_legacy: "Legacy Sepia avatars (those included in previous plugin versions)" +avatar_set_option_none: None converse_theme_label: "ConverseJS theme" converse_theme_description: "Please choose the converseJS theme you want to use." diff --git a/server/lib/external-auth/oidc.ts b/server/lib/external-auth/oidc.ts index a694d00e..b2780450 100644 --- a/server/lib/external-auth/oidc.ts +++ b/server/lib/external-auth/oidc.ts @@ -87,8 +87,8 @@ class ExternalAuthOIDC { private readonly redirectUrl: string private readonly connectUrl: string private readonly externalVirtualhost: string - private readonly avatarsDir: string - private readonly avatarsFiles: string[] + private readonly avatarsDir: string | undefined + private readonly avatarsFiles: string[] | undefined private readonly encryptionOptions = { algorithm: 'aes256' as string, @@ -129,8 +129,8 @@ class ExternalAuthOIDC { connectUrl: string redirectUrl: string externalVirtualhost: string - avatarsDir: string - avatarsFiles: string[] + avatarsDir?: string + avatarsFiles?: string[] }) { this.logger = { debug: (s) => params.logger.debug('[ExternalAuthOIDC] ' + s), @@ -591,8 +591,8 @@ class ExternalAuthOIDC { */ private async getRandomAvatar (): Promise { try { - if (!this.avatarsDir || !this.avatarsFiles.length) { - throw new Error('Seems there is no default avatars') + if (!this.avatarsDir || !this.avatarsFiles?.length) { + return undefined } const file = this.avatarsFiles[Math.floor(Math.random() * this.avatarsFiles.length)] diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index 97cd17d0..9bf45d64 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -102,14 +102,23 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise { const { peertubeHelpers, settingsManager } = options @@ -510,7 +510,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