From 8dabd5167b9f0d217c750bf8f1124eed29492050 Mon Sep 17 00:00:00 2001 From: ildyria Date: Wed, 19 Feb 2025 19:15:22 +0100 Subject: [PATCH] Add cache checks + disable password albums when cache is enabled + add diagnostic check --- app/Actions/Diagnostics/Errors.php | 2 + .../Pipes/Checks/CachePasswordCheck.php | 38 ++++++++++++++++ .../Resources/Rights/AlbumRightsResource.php | 3 ++ lang/cz/dialogs.php | 1 + lang/cz/settings.php | 2 + lang/de/dialogs.php | 1 + lang/de/settings.php | 2 + lang/el/dialogs.php | 1 + lang/el/settings.php | 2 + lang/en/dialogs.php | 1 + lang/en/settings.php | 2 + lang/es/dialogs.php | 1 + lang/es/settings.php | 2 + lang/fr/dialogs.php | 1 + lang/fr/settings.php | 2 + lang/hu/dialogs.php | 1 + lang/hu/settings.php | 2 + lang/it/dialogs.php | 1 + lang/it/settings.php | 2 + lang/ja/dialogs.php | 1 + lang/ja/settings.php | 2 + lang/nl/dialogs.php | 1 + lang/nl/settings.php | 2 + lang/no/dialogs.php | 1 + lang/no/settings.php | 2 + lang/pl/dialogs.php | 1 + lang/pl/settings.php | 2 + lang/pt/dialogs.php | 1 + lang/pt/settings.php | 2 + lang/ru/dialogs.php | 1 + lang/ru/settings.php | 2 + lang/sk/dialogs.php | 1 + lang/sk/settings.php | 2 + lang/sv/dialogs.php | 1 + lang/sv/settings.php | 2 + lang/vi/dialogs.php | 1 + lang/vi/settings.php | 2 + lang/zh_CN/dialogs.php | 1 + lang/zh_CN/settings.php | 2 + lang/zh_TW/dialogs.php | 1 + lang/zh_TW/settings.php | 2 + .../forms/album/AlbumVisibility.vue | 43 ++++++++++++------- .../js/components/settings/EasySettings.vue | 11 ++++- resources/js/lychee.d.ts | 1 + 44 files changed, 138 insertions(+), 17 deletions(-) create mode 100644 app/Actions/Diagnostics/Pipes/Checks/CachePasswordCheck.php diff --git a/app/Actions/Diagnostics/Errors.php b/app/Actions/Diagnostics/Errors.php index e6d53412fbd..181cc34dca0 100644 --- a/app/Actions/Diagnostics/Errors.php +++ b/app/Actions/Diagnostics/Errors.php @@ -11,6 +11,7 @@ use App\Actions\Diagnostics\Pipes\Checks\AdminUserExistsCheck; use App\Actions\Diagnostics\Pipes\Checks\AppUrlMatchCheck; use App\Actions\Diagnostics\Pipes\Checks\BasicPermissionCheck; +use App\Actions\Diagnostics\Pipes\Checks\CachePasswordCheck; use App\Actions\Diagnostics\Pipes\Checks\ConfigSanityCheck; use App\Actions\Diagnostics\Pipes\Checks\CountSizeVariantsCheck; use App\Actions\Diagnostics\Pipes\Checks\DBIntegrityCheck; @@ -54,6 +55,7 @@ class Errors SmallMediumExistsCheck::class, PlaceholderExistsCheck::class, CountSizeVariantsCheck::class, + CachePasswordCheck::class, SupporterCheck::class, ]; diff --git a/app/Actions/Diagnostics/Pipes/Checks/CachePasswordCheck.php b/app/Actions/Diagnostics/Pipes/Checks/CachePasswordCheck.php new file mode 100644 index 00000000000..35e42ef4a16 --- /dev/null +++ b/app/Actions/Diagnostics/Pipes/Checks/CachePasswordCheck.php @@ -0,0 +1,38 @@ +whereNotNull('password')->count() > 0) { + $data[] = DiagnosticData::warn('Response cache is enabled and some albums are password protected.', self::class, ['Due to response caching, unlocking those albums will reveal their content to other annonymous users.']); + } + + return $next($data); + } +} diff --git a/app/Http/Resources/Rights/AlbumRightsResource.php b/app/Http/Resources/Rights/AlbumRightsResource.php index 342ad72a0da..89cc8e329f3 100644 --- a/app/Http/Resources/Rights/AlbumRightsResource.php +++ b/app/Http/Resources/Rights/AlbumRightsResource.php @@ -10,6 +10,7 @@ use App\Contracts\Models\AbstractAlbum; use App\Models\Album; +use App\Models\Configs; use App\Policies\AlbumPolicy; use Illuminate\Support\Facades\Gate; use Spatie\LaravelData\Data; @@ -27,6 +28,7 @@ class AlbumRightsResource extends Data public bool $can_delete = false; public bool $can_transfer = false; public bool $can_access_original = false; + public bool $can_pasword_protect = false; /** * Given an album, returns the access rights associated to it. @@ -42,5 +44,6 @@ public function __construct(?AbstractAlbum $abstractAlbum) $this->can_delete = Gate::check(AlbumPolicy::CAN_DELETE, [AbstractAlbum::class, $abstractAlbum]); $this->can_transfer = Gate::check(AlbumPolicy::CAN_TRANSFER, [AbstractAlbum::class, $abstractAlbum]); $this->can_access_original = Gate::check(AlbumPolicy::CAN_ACCESS_FULL_PHOTO, [AbstractAlbum::class, $abstractAlbum]); + $this->can_pasword_protect = !Configs::getValueAsBool('cache_enabled'); } } diff --git a/lang/cz/dialogs.php b/lang/cz/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/cz/dialogs.php +++ b/lang/cz/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/cz/settings.php b/lang/cz/settings.php index fd197f11135..00559112486 100644 --- a/lang/cz/settings.php +++ b/lang/cz/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/de/dialogs.php b/lang/de/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/de/dialogs.php +++ b/lang/de/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/de/settings.php b/lang/de/settings.php index fd197f11135..00559112486 100644 --- a/lang/de/settings.php +++ b/lang/de/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/el/dialogs.php b/lang/el/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/el/dialogs.php +++ b/lang/el/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/el/settings.php b/lang/el/settings.php index fd197f11135..00559112486 100644 --- a/lang/el/settings.php +++ b/lang/el/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/en/dialogs.php b/lang/en/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/en/dialogs.php +++ b/lang/en/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/en/settings.php b/lang/en/settings.php index fd197f11135..00559112486 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/es/dialogs.php b/lang/es/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/es/dialogs.php +++ b/lang/es/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/es/settings.php b/lang/es/settings.php index fd197f11135..00559112486 100644 --- a/lang/es/settings.php +++ b/lang/es/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/fr/dialogs.php b/lang/fr/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/fr/dialogs.php +++ b/lang/fr/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/fr/settings.php b/lang/fr/settings.php index fd197f11135..00559112486 100644 --- a/lang/fr/settings.php +++ b/lang/fr/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/hu/dialogs.php b/lang/hu/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/hu/dialogs.php +++ b/lang/hu/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/hu/settings.php b/lang/hu/settings.php index fd197f11135..00559112486 100644 --- a/lang/hu/settings.php +++ b/lang/hu/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/it/dialogs.php b/lang/it/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/it/dialogs.php +++ b/lang/it/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/it/settings.php b/lang/it/settings.php index fd197f11135..00559112486 100644 --- a/lang/it/settings.php +++ b/lang/it/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/ja/dialogs.php b/lang/ja/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/ja/dialogs.php +++ b/lang/ja/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/ja/settings.php b/lang/ja/settings.php index fd197f11135..00559112486 100644 --- a/lang/ja/settings.php +++ b/lang/ja/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/nl/dialogs.php b/lang/nl/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/nl/dialogs.php +++ b/lang/nl/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/nl/settings.php b/lang/nl/settings.php index fd197f11135..00559112486 100644 --- a/lang/nl/settings.php +++ b/lang/nl/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/no/dialogs.php b/lang/no/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/no/dialogs.php +++ b/lang/no/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/no/settings.php b/lang/no/settings.php index fd197f11135..00559112486 100644 --- a/lang/no/settings.php +++ b/lang/no/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/pl/dialogs.php b/lang/pl/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/pl/dialogs.php +++ b/lang/pl/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/pl/settings.php b/lang/pl/settings.php index fd197f11135..00559112486 100644 --- a/lang/pl/settings.php +++ b/lang/pl/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/pt/dialogs.php b/lang/pt/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/pt/dialogs.php +++ b/lang/pt/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/pt/settings.php b/lang/pt/settings.php index fd197f11135..00559112486 100644 --- a/lang/pt/settings.php +++ b/lang/pt/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/ru/dialogs.php b/lang/ru/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/ru/dialogs.php +++ b/lang/ru/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/ru/settings.php b/lang/ru/settings.php index fd197f11135..00559112486 100644 --- a/lang/ru/settings.php +++ b/lang/ru/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/sk/dialogs.php b/lang/sk/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/sk/dialogs.php +++ b/lang/sk/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/sk/settings.php b/lang/sk/settings.php index fd197f11135..00559112486 100644 --- a/lang/sk/settings.php +++ b/lang/sk/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/sv/dialogs.php b/lang/sv/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/sv/dialogs.php +++ b/lang/sv/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/sv/settings.php b/lang/sv/settings.php index fd197f11135..00559112486 100644 --- a/lang/sv/settings.php +++ b/lang/sv/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/vi/dialogs.php b/lang/vi/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/vi/dialogs.php +++ b/lang/vi/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/vi/settings.php b/lang/vi/settings.php index fd197f11135..00559112486 100644 --- a/lang/vi/settings.php +++ b/lang/vi/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/zh_CN/dialogs.php b/lang/zh_CN/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/zh_CN/dialogs.php +++ b/lang/zh_CN/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/zh_CN/settings.php b/lang/zh_CN/settings.php index fd197f11135..00559112486 100644 --- a/lang/zh_CN/settings.php +++ b/lang/zh_CN/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/lang/zh_TW/dialogs.php b/lang/zh_TW/dialogs.php index 4afd65fae3f..d2ac537c259 100644 --- a/lang/zh_TW/dialogs.php +++ b/lang/zh_TW/dialogs.php @@ -107,6 +107,7 @@ 'password' => 'Password', 'password_prot' => 'Password protected', 'password_prot_expl' => 'Anonymous users need a shared password to access this album.', + 'password_prop_not_compatible' => 'Response cache is conflicting with this setting.
Due to response caching, unlocking this album will
also reveal its content to other annonymous users.', 'nsfw' => 'Sensitive', 'nsfw_expl' => 'Album contains sensitive content.', 'visibility_updated' => 'Visibility updated.', diff --git a/lang/zh_TW/settings.php b/lang/zh_TW/settings.php index fd197f11135..00559112486 100644 --- a/lang/zh_TW/settings.php +++ b/lang/zh_TW/settings.php @@ -35,6 +35,8 @@ 'language' => 'Language used by Lychee', 'nsfw_album_visibility' => 'Make Sensitive albums visible by default.', 'nsfw_album_explanation' => 'If the album is public, it is still accessible, just hidden from the view and can be revealed by pressing H.', + 'cache_enabled' => 'Enable caching of responses.', + 'cache_enabled_details' => 'This will significantly speed up the response time of Lychee.
If you are using password protected albums, you should not enable this.', ], 'lychee_se' => [ 'header' => 'Lychee SE', diff --git a/resources/js/components/forms/album/AlbumVisibility.vue b/resources/js/components/forms/album/AlbumVisibility.vue index 4c03ed6ced0..fcdca53f909 100644 --- a/resources/js/components/forms/album/AlbumVisibility.vue +++ b/resources/js/components/forms/album/AlbumVisibility.vue @@ -13,9 +13,8 @@ :class="is_public ? 'text-muted-color-emphasis' : 'text-muted-color'" > @@ -26,13 +25,7 @@ class="relative h-12 my-4 pl-9 transition-color duration-300" :class="is_public ? 'text-muted-color-emphasis' : 'text-muted-color'" > - +

{{ $t("dialogs.visibility.hidden_expl") }}

@@ -41,9 +34,8 @@ :class="is_public ? 'text-muted-color-emphasis' : 'text-muted-color'" > @@ -51,13 +43,31 @@

{{ $t("dialogs.visibility.downloadable_expl") }}

+ + +

+
+
@@ -75,7 +85,7 @@
-import { ref, watch } from "vue"; +import { ref } from "vue"; import Card from "primevue/card"; import ToggleSwitch from "primevue/toggleswitch"; import FloatLabel from "primevue/floatlabel"; @@ -119,6 +129,7 @@ const grants_full_photo_access = ref(props.album.policy.grants_full_pho const grants_download = ref(props.album.policy.grants_download); const is_password_required = ref(props.album.policy.is_password_required); const password = ref(""); +const can_pasword_protect = ref(props.album.rights.can_pasword_protect); function save() { const data: UpdateProtectionPolicyData = { @@ -128,7 +139,7 @@ function save() { is_nsfw: is_nsfw.value, grants_full_photo_access: grants_full_photo_access.value, grants_download: grants_download.value, - password: password.value, + password: is_password_required.value ? password.value : undefined, }; AlbumService.updateProtectionPolicy(data).then(() => { diff --git a/resources/js/components/settings/EasySettings.vue b/resources/js/components/settings/EasySettings.vue index cf69d40fe64..776d37c3774 100644 --- a/resources/js/components/settings/EasySettings.vue +++ b/resources/js/components/settings/EasySettings.vue @@ -10,10 +10,17 @@ />
- +

+
@@ -311,6 +318,7 @@ const layout = ref(undefin const nsfwVisible = ref(undefined); const dark_mode_enabled = ref(undefined); +const cache_enabled = ref(undefined); const map_display = ref(undefined); const map_display_public = ref(undefined); @@ -362,6 +370,7 @@ function load() { dark_mode_enabled.value = configurations.find((config) => config.key === "dark_mode_enabled"); nsfwVisible.value = configurations.find((config) => config.key === "nsfw_visible")?.value === "1"; dropbox_key.value = configurations.find((config) => config.key === "dropbox_key")?.value ?? ""; + cache_enabled.value = configurations.find((config) => config.key === "cache_enabled"); photoSortingColumn.value = configurations.find((config) => config.key === "sorting_photos_col"); photoSortingOrder.value = configurations.find((config) => config.key === "sorting_photos_order"); diff --git a/resources/js/lychee.d.ts b/resources/js/lychee.d.ts index 456452acb1b..e79de2bbdb9 100644 --- a/resources/js/lychee.d.ts +++ b/resources/js/lychee.d.ts @@ -573,6 +573,7 @@ declare namespace App.Http.Resources.Rights { can_delete: boolean; can_transfer: boolean; can_access_original: boolean; + can_pasword_protect: boolean; }; export type GlobalRightsResource = { root_album: App.Http.Resources.Rights.RootAlbumRightsResource;