From c80e458afb63915163467fe9b3b147b3b4e4657d Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 12 Oct 2021 13:50:40 +0200 Subject: [PATCH] extend client-overrides with default images (#4392) * extend client-overrides with default images Add: * default-playlist.png * default-avatar-account.png * default-avatar-videochannel.png solves #4108 * Rename to default-avatar-video-channel.png Co-authored-by: Chocobozzz --- .../video-channel/video-channel.model.ts | 2 +- ...channel.png => default-avatar-video-channel.png} | Bin config/default.yaml | 8 +++++++- config/production.yaml.example | 8 +++++++- server/controllers/client.ts | 5 ++++- support/docker/production/config/production.yaml | 8 +++++++- support/nginx/peertube | 2 +- 7 files changed, 27 insertions(+), 6 deletions(-) rename client/src/assets/images/{default-avatar-videochannel.png => default-avatar-video-channel.png} (100%) diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts index 66d4cac68..ac2679b42 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts @@ -41,7 +41,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel { } static GET_DEFAULT_AVATAR_URL () { - return `${window.location.origin}/client/assets/images/default-avatar-videochannel.png` + return `${window.location.origin}/client/assets/images/default-avatar-video-channel.png` } constructor (hash: Partial) { diff --git a/client/src/assets/images/default-avatar-videochannel.png b/client/src/assets/images/default-avatar-video-channel.png similarity index 100% rename from client/src/assets/images/default-avatar-videochannel.png rename to client/src/assets/images/default-avatar-video-channel.png diff --git a/config/default.yaml b/config/default.yaml index eb96b6bbb..707187b7c 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -89,7 +89,13 @@ storage: captions: 'storage/captions/' cache: 'storage/cache/' plugins: 'storage/plugins/' - # Overridable client files : logo.svg, favicon.png and icons/*.png (PWA) in client/dist/assets/images + # Overridable client files in client/dist/assets/images : + # - logo.svg + # - favicon.png + # - default-playlist.jpg + # - default-avatar-account.png + # - default-avatar-video-channel.png + # - and icons/*.png (PWA) # Could contain for example assets/images/favicon.png # If the file exists, peertube will serve it # If not, peertube will fallback to the default fil diff --git a/config/production.yaml.example b/config/production.yaml.example index 082c75e53..e405daa71 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -87,7 +87,13 @@ storage: captions: '/var/www/peertube/storage/captions/' cache: '/var/www/peertube/storage/cache/' plugins: '/var/www/peertube/storage/plugins/' - # Overridable client files : logo.svg, favicon.png and icons/*.png (PWA) in client/dist/assets/images + # Overridable client files in client/dist/assets/images : + # - logo.svg + # - favicon.png + # - default-playlist.jpg + # - default-avatar-account.png + # - default-avatar-video-channel.png + # - and icons/*.png (PWA) # Could contain for example assets/images/favicon.png # If the file exists, peertube will serve it # If not, peertube will fallback to the default file diff --git a/server/controllers/client.ts b/server/controllers/client.ts index cdc556da2..86ac5fbbc 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -65,7 +65,10 @@ const staticClientOverrides = [ 'assets/images/icons/icon-96x96.png', 'assets/images/icons/icon-144x144.png', 'assets/images/icons/icon-192x192.png', - 'assets/images/icons/icon-512x512.png' + 'assets/images/icons/icon-512x512.png', + 'assets/images/default-playlist.jpg', + 'assets/images/default-avatar-account.png', + 'assets/images/default-avatar-video-channel.png' ] for (const staticClientOverride of staticClientOverrides) { diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml index 8c8f8d6bc..3bff8a0b0 100644 --- a/support/docker/production/config/production.yaml +++ b/support/docker/production/config/production.yaml @@ -55,7 +55,13 @@ storage: captions: '../data/captions/' cache: '../data/cache/' plugins: '../data/plugins/' - # Overridable client files : logo.svg, favicon.png and icons/*.png (PWA) in client/dist/assets/images + # Overridable client files in client/dist/assets/images : + # - logo.svg + # - favicon.png + # - default-playlist.jpg + # - default-avatar-account.png + # - default-avatar-video-channel.png + # - and icons/*.png (PWA) # Could contain for example assets/images/favicon.png # If the file exists, peertube will serve it # If not, peertube will fallback to the default fil diff --git a/support/nginx/peertube b/support/nginx/peertube index 3ef62367c..2b1600d97 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube @@ -172,7 +172,7 @@ server { # Bypass PeerTube for performance reasons. Optional. # Should be consistent with client-overrides assets list in /server/controllers/client.ts - location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png))$ { + location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-video-channel\.png))$ { add_header Cache-Control "public, max-age=31536000, immutable"; # Cache 1 year root /var/www/peertube;