Skip to content

Commit 0a526dc

Browse files
authored
Add option to disable slideshow (#3383)
1 parent 49fc128 commit 0a526dc

7 files changed

Lines changed: 42 additions & 6 deletions

File tree

app/Http/Resources/GalleryConfigs/InitConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class InitConfig extends Data
6969

7070
// Slideshow setting
7171
public int $slideshow_timeout;
72+
public bool $is_slideshow_enabled;
7273

7374
// Timeline settings
7475
public bool $is_timeline_left_border_visible;
@@ -132,6 +133,7 @@ public function __construct()
132133

133134
// Slideshow settings
134135
$this->slideshow_timeout = Configs::getValueAsInt('slideshow_timeout');
136+
$this->is_slideshow_enabled = Configs::getValueAsBool('slideshow_enabled');
135137

136138
// Timeline settings
137139
$this->is_timeline_left_border_visible = Configs::getValueAsBool('timeline_left_border_enabled');
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2025 LycheeOrg.
7+
*/
8+
9+
use App\Models\Extensions\BaseConfigMigration;
10+
11+
return new class() extends BaseConfigMigration {
12+
public const CAT = 'Gallery';
13+
14+
public function getConfigs(): array
15+
{
16+
return [
17+
[
18+
'key' => 'slideshow_enabled',
19+
'value' => '1',
20+
'cat' => self::CAT,
21+
'type_range' => self::BOOL,
22+
'description' => 'Enable the slideshow functionality.',
23+
'details' => '',
24+
'is_expert' => true,
25+
'is_secret' => true,
26+
'level' => 0,
27+
'order' => 37,
28+
],
29+
];
30+
}
31+
};

resources/js/components/gallery/albumModule/AlbumHero.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<a
8080
v-tooltip.bottom="'Start slideshow'"
8181
@click="emits('toggleSlideShow')"
82-
v-if="props.album.photos.length > 0"
82+
v-if="props.album.photos.length > 0 && is_slideshow_enabled"
8383
class="shrink-0 px-3 cursor-pointer text-muted-color inline-block transform duration-300 hover:scale-150 hover:text-color"
8484
>
8585
<i class="pi pi-play" />
@@ -136,7 +136,7 @@ import { computed } from "vue";
136136
137137
const auth = useAuthStore();
138138
const lycheeStore = useLycheeStateStore();
139-
const { is_se_enabled, is_se_preview_enabled, are_nsfw_visible } = storeToRefs(lycheeStore);
139+
const { is_se_enabled, is_se_preview_enabled, are_nsfw_visible, is_slideshow_enabled } = storeToRefs(lycheeStore);
140140
const { user } = storeToRefs(auth);
141141
142142
const props = defineProps<{

resources/js/components/headers/PhotoHeader.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</template>
1414
<template #end>
1515
<div :class="is_slideshow_active ? 'hidden' : 'flex'">
16-
<Button text icon="pi pi-play" class="mr-2" severity="secondary" @click="emits('toggleSlideShow')" />
16+
<Button v-if="is_slideshow_enabled" text icon="pi pi-play" class="mr-2" severity="secondary" @click="emits('toggleSlideShow')" />
1717
<Button
1818
v-if="props.photo.rights.can_access_full_photo && props.photo.size_variants.original?.url"
1919
text
@@ -76,7 +76,7 @@ const togglableStore = useTogglablesStateStore();
7676
const { is_full_screen, is_photo_edit_open, are_details_open, is_slideshow_active } = storeToRefs(togglableStore);
7777
const isDownloadOpen = ref(false);
7878
const lycheeStore = useLycheeStateStore();
79-
const { is_exif_disabled } = storeToRefs(lycheeStore);
79+
const { is_exif_disabled, is_slideshow_enabled } = storeToRefs(lycheeStore);
8080
8181
function openInNewTab(url: string) {
8282
window?.open(url, "_blank")?.focus();

resources/js/lychee.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ declare namespace App.Http.Resources.GalleryConfigs {
262262
is_medium2x_download_enabled: boolean;
263263
clockwork_url: string | null;
264264
slideshow_timeout: number;
265+
is_slideshow_enabled: boolean;
265266
is_timeline_left_border_visible: boolean;
266267
title: string;
267268
dropbox_api_key: string;

resources/js/stores/LycheeState.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const useLycheeStateStore = defineStore("lychee-store", {
1414

1515
// Photo config
1616
slideshow_timeout: 5,
17+
is_slideshow_enabled: true,
1718

1819
// configs for nsfw
1920
are_nsfw_visible: false,
@@ -119,6 +120,7 @@ export const useLycheeStateStore = defineStore("lychee-store", {
119120
this.clockwork_url = data.clockwork_url;
120121

121122
this.slideshow_timeout = data.slideshow_timeout;
123+
this.is_slideshow_enabled = data.is_slideshow_enabled;
122124

123125
this.is_timeline_left_border_visible = data.is_timeline_left_border_visible;
124126

resources/js/views/gallery-panels/Album.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ const lycheeStore = useLycheeStateStore();
194194
195195
lycheeStore.init();
196196
197-
const { are_nsfw_visible, slideshow_timeout } = storeToRefs(lycheeStore);
197+
const { are_nsfw_visible, slideshow_timeout, is_slideshow_enabled } = storeToRefs(lycheeStore);
198198
const {
199199
is_photo_edit_open,
200200
are_details_open,
@@ -307,7 +307,7 @@ onKeyStroke([getModKey(), "a"], () => !shouldIgnoreKeystroke() && photo.value ==
307307
onKeyStroke("ArrowLeft", () => !shouldIgnoreKeystroke() && photo.value !== undefined && hasPrevious() && previous(true));
308308
onKeyStroke("ArrowRight", () => !shouldIgnoreKeystroke() && photo.value !== undefined && hasNext() && next(true));
309309
onKeyStroke("o", () => !shouldIgnoreKeystroke() && photo.value !== undefined && rotateOverlay());
310-
onKeyStroke(" ", () => !shouldIgnoreKeystroke() && photo.value !== undefined && slideshow());
310+
onKeyStroke(" ", () => !shouldIgnoreKeystroke() && photo.value !== undefined && is_slideshow_enabled.value && slideshow());
311311
onKeyStroke("i", () => !shouldIgnoreKeystroke() && photo.value !== undefined && toggleDetails());
312312
onKeyStroke("f", () => !shouldIgnoreKeystroke() && photo.value !== undefined && togglableStore.toggleFullScreen());
313313
onKeyStroke("Escape", () => !shouldIgnoreKeystroke() && photo.value !== undefined && is_slideshow_active.value && stop());

0 commit comments

Comments
 (0)