High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat: make memories slideshow duration configurable (#22783)
Mees Frensel9cc88ed2a6df
diff --git a/i18n/en.json b/i18n/en.jsonindex 30c8949aef..735e942dda 100644--- a/i18n/en.json+++ b/i18n/en.json@@ -2027,6 +2027,7 @@"third_party_resources": "Third-Party Resources","time": "Time","time_based_memories": "Time-based memories",+ "time_based_memories_duration": "Number of seconds to display each image.","timeline": "Timeline","timezone": "Timezone","to_archive": "Archive",diff --git a/mobile/openapi/lib/model/memories_response.dart b/mobile/openapi/lib/model/memories_response.dartindex b9f8b5d8b1..cb42f596a6 100644--- a/mobile/openapi/lib/model/memories_response.dart+++ b/mobile/openapi/lib/model/memories_response.dart@@ -13,25 +13,31 @@ part of openapi.api;class MemoriesResponse {/// Returns a new [MemoriesResponse] instance.MemoriesResponse({+ this.duration = 5,this.enabled = true,});+ int duration;+bool enabled;@overridebool operator ==(Object other) => identical(this, other) || other is MemoriesResponse &&+ other.duration == duration &&other.enabled == enabled;@overrideint get hashCode =>// ignore: unnecessary_parenthesis+ (duration.hashCode) +(enabled.hashCode);@override- String toString() => 'MemoriesResponse[enabled=$enabled]';+ String toString() => 'MemoriesResponse[duration=$duration, enabled=$enabled]';Map<String, dynamic> toJson() {final json = <String, dynamic>{};+ json[r'duration'] = this.duration;json[r'enabled'] = this.enabled;return json;}@@ -45,6 +51,7 @@ class MemoriesResponse {final json = value.cast<String, dynamic>();return MemoriesResponse(+ duration: mapValueOfType<int>(json, r'duration')!,enabled: mapValueOfType<bool>(json, r'enabled')!,);}@@ -93,6 +100,7 @@ class MemoriesResponse {/// The list of required keys that must be present in a JSON.static const requiredKeys = <String>{+ 'duration','enabled',};}diff --git a/mobile/openapi/lib/model/memories_update.dart b/mobile/openapi/lib/model/memories_update.dartindex 71efd71ae7..39c46ffd2f 100644--- a/mobile/openapi/lib/model/memories_update.dart+++ b/mobile/openapi/lib/model/memories_update.dart@@ -13,9 +13,19 @@ part of openapi.api;class MemoriesUpdate {/// Returns a new [MemoriesUpdate] instance.MemoriesUpdate({+ this.duration,this.enabled,});+ /// Minimum value: 1+ ///+ /// Please note: This property should have been non-nullable! Since the specification file+ /// does not include a default value (using the "default:" property), however, the generated+ /// source code must fall back to having a nullable type.+ /// Consider adding a "default:" property in the specification file to hide this note.+ ///+ int? duration;+////// Please note: This property should have been non-nullable! Since the specification file/// does not include a default value (using the "default:" property), however, the generated@@ -26,18 +36,25 @@ class MemoriesUpdate {@overridebool operator ==(Object other) => identical(this, other) || other is MemoriesUpdate &&+ other.duration == duration &&other.enabled == enabled;@overrideint get hashCode =>// ignore: unnecessary_parenthesis+ (duration == null ? 0 : duration!.hashCode) +(enabled == null ? 0 : enabled!.hashCode);@override- String toString() => 'MemoriesUpdate[enabled=$enabled]';+ String toString() => 'MemoriesUpdate[duration=$duration, enabled=$enabled]';Map<String, dynamic> toJson() {final json = <String, dynamic>{};+ if (this.duration != null) {+ json[r'duration'] = this.duration;+ } else {+ // json[r'duration'] = null;+ }if (this.enabled != null) {json[r'enabled'] = this.enabled;} else {@@ -55,6 +72,7 @@ class MemoriesUpdate {final json = value.cast<String, dynamic>();return MemoriesUpdate(+ duration: mapValueOfType<int>(json, r'duration'),enabled: mapValueOfType<bool>(json, r'enabled'),);}diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.jsonindex d16e4c4e10..6076b43bfd 100644--- a/open-api/immich-openapi-specs.json+++ b/open-api/immich-openapi-specs.json@@ -12646,18 +12646,27 @@},"MemoriesResponse": {"properties": {+ "duration": {+ "default": 5,+ "type": "integer"+ },"enabled": {"default": true,"type": "boolean"}},"required": [+ "duration","enabled"],"type": "object"},"MemoriesUpdate": {"properties": {+ "duration": {+ "minimum": 1,+ "type": "integer"+ },"enabled": {"type": "boolean"}diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.tsindex 435e10046a..1ed65e4f25 100644--- a/open-api/typescript-sdk/src/fetch-client.ts+++ b/open-api/typescript-sdk/src/fetch-client.ts@@ -152,6 +152,7 @@ export type FoldersResponse = {sidebarWeb: boolean;};export type MemoriesResponse = {+ duration: number;enabled: boolean;};export type PeopleResponse = {@@ -209,6 +210,7 @@ export type FoldersUpdate = {sidebarWeb?: boolean;};export type MemoriesUpdate = {+ duration?: number;enabled?: boolean;};export type PeopleUpdate = {diff --git a/server/src/dtos/user-preferences.dto.ts b/server/src/dtos/user-preferences.dto.tsindex b258158ae2..452384b423 100644--- a/server/src/dtos/user-preferences.dto.ts+++ b/server/src/dtos/user-preferences.dto.ts@@ -13,6 +13,12 @@ class AvatarUpdate {class MemoriesUpdate {@ValidateBoolean({ optional: true })enabled?: boolean;++ @Optional()+ @IsInt()+ @IsPositive()+ @ApiProperty({ type: 'integer' })+ duration?: number;}class RatingsUpdate {@@ -166,6 +172,9 @@ class RatingsResponse {class MemoriesResponse {enabled: boolean = true;++ @ApiProperty({ type: 'integer' })+ duration: number = 5;}class FoldersResponse {diff --git a/server/src/types.ts b/server/src/types.tsindex 66045521d0..0a2dd46d7f 100644--- a/server/src/types.ts+++ b/server/src/types.ts@@ -497,6 +497,7 @@ export interface UserPreferences {};memories: {enabled: boolean;+ duration: number;};people: {enabled: boolean;diff --git a/server/src/utils/preferences.ts b/server/src/utils/preferences.tsindex 121bf2826d..b25369670a 100644--- a/server/src/utils/preferences.ts+++ b/server/src/utils/preferences.ts@@ -16,6 +16,7 @@ const getDefaultPreferences = (): UserPreferences => {},memories: {enabled: true,+ duration: 5,},people: {enabled: true,diff --git a/web/src/lib/components/memory-page/memory-viewer.svelte b/web/src/lib/components/memory-page/memory-viewer.svelteindex fe3569f916..cfe11e1026 100644--- a/web/src/lib/components/memory-page/memory-viewer.svelte+++ b/web/src/lib/components/memory-page/memory-viewer.svelte@@ -102,7 +102,7 @@});} else {progressBarController = new Tween<number>(0, {- duration: (from: number, to: number) => (to ? 5000 * (to - from) : 0),+ duration: (from: number, to: number) => (to ? $preferences.memories.duration * 1000 * (to - from) : 0),});}};diff --git a/web/src/lib/components/user-settings-page/feature-settings.svelte b/web/src/lib/components/user-settings-page/feature-settings.svelteindex 31a29be975..82a40161b5 100644--- a/web/src/lib/components/user-settings-page/feature-settings.svelte+++ b/web/src/lib/components/user-settings-page/feature-settings.svelte@@ -1,7 +1,9 @@<script lang="ts">import SettingAccordion from '$lib/components/shared-components/settings/setting-accordion.svelte';+ import SettingInputField from '$lib/components/shared-components/settings/setting-input-field.svelte';import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';+ import { SettingInputFieldType } from '$lib/constants';import { preferences } from '$lib/stores/user.store';import { handleError } from '$lib/utils/handle-error';import { AssetOrder, updateMyPreferences } from '@immich/sdk';@@ -18,6 +20,7 @@// Memorieslet memoriesEnabled = $state($preferences?.memories?.enabled ?? true);+ let memoriesDuration = $state($preferences?.memories?.duration ?? 5);// Peoplelet peopleEnabled = $state($preferences?.people?.enabled ?? false);@@ -43,7 +46,7 @@userPreferencesUpdateDto: {albums: { defaultAssetOrder },folders: { enabled: foldersEnabled, sidebarWeb: foldersSidebar },- memories: { enabled: memoriesEnabled },+ memories: { enabled: memoriesEnabled, duration: memoriesDuration },people: { enabled: peopleEnabled, sidebarWeb: peopleSidebar },ratings: { enabled: ratingsEnabled },sharedLinks: { enabled: sharedLinksEnabled, sidebarWeb: sharedLinkSidebar },@@ -103,6 +106,14 @@<div class="ms-4 mt-6"><SettingSwitch title={$t('enable')} bind:checked={memoriesEnabled} /></div>+ <div class="ms-4 mt-6">+ <SettingInputField+ inputType={SettingInputFieldType.NUMBER}+ label={$t('duration')}+ description={$t('time_based_memories_duration')}+ bind:value={memoriesDuration}+ />+ </div></SettingAccordion><SettingAccordion key="people" title={$t('people')} subtitle={$t('people_feature_description')}>diff --git a/web/src/test-data/factories/preferences-factory.ts b/web/src/test-data/factories/preferences-factory.tsindex e7d556b00b..f8ab8615bf 100644--- a/web/src/test-data/factories/preferences-factory.ts+++ b/web/src/test-data/factories/preferences-factory.ts@@ -23,6 +23,7 @@ export const preferencesFactory = Sync.makeFactory<UserPreferencesResponseDto>({},memories: {enabled: false,+ duration: 5,},people: {enabled: false,