2022-12-09 15:51:42 -05:00
|
|
|
<script lang="ts">
|
2023-07-01 00:50:47 -04:00
|
|
|
import { page } from '$app/stores';
|
|
|
|
|
import FFmpegSettings from '$lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte';
|
|
|
|
|
import JobSettings from '$lib/components/admin-page/settings/job-settings/job-settings.svelte';
|
2023-08-25 00:15:03 -04:00
|
|
|
import MachineLearningSettings from '$lib/components/admin-page/settings/machine-learning-settings/machine-learning-settings.svelte';
|
2023-09-08 22:51:46 -04:00
|
|
|
import MapSettings from '$lib/components/admin-page/settings/map-settings/map-settings.svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
import OAuthSettings from '$lib/components/admin-page/settings/oauth/oauth-settings.svelte';
|
|
|
|
|
import PasswordLoginSettings from '$lib/components/admin-page/settings/password-login/password-login-settings.svelte';
|
|
|
|
|
import SettingAccordion from '$lib/components/admin-page/settings/setting-accordion.svelte';
|
|
|
|
|
import StorageTemplateSettings from '$lib/components/admin-page/settings/storage-template/storage-template-settings.svelte';
|
2023-08-25 00:15:03 -04:00
|
|
|
import ThumbnailSettings from '$lib/components/admin-page/settings/thumbnail/thumbnail-settings.svelte';
|
2024-01-03 21:54:48 -05:00
|
|
|
import ServerSettings from '$lib/components/admin-page/settings/server/server-settings.svelte';
|
2023-10-13 11:02:28 -04:00
|
|
|
import TrashSettings from '$lib/components/admin-page/settings/trash-settings/trash-settings.svelte';
|
2023-10-23 11:38:41 -07:00
|
|
|
import ThemeSettings from '$lib/components/admin-page/settings/theme/theme-settings.svelte';
|
2023-10-13 11:02:28 -04:00
|
|
|
import LinkButton from '$lib/components/elements/buttons/link-button.svelte';
|
|
|
|
|
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
2023-08-25 19:44:52 +02:00
|
|
|
import { downloadManager } from '$lib/stores/download';
|
2023-09-08 22:51:46 -04:00
|
|
|
import { featureFlags } from '$lib/stores/server-config.store';
|
2023-08-25 19:44:52 +02:00
|
|
|
import { downloadBlob } from '$lib/utils/asset-utils';
|
2024-01-20 13:47:41 -05:00
|
|
|
import { type SystemConfigDto, copyToClipboard } from '@api';
|
2023-10-25 09:48:25 -04:00
|
|
|
import Icon from '$lib/components/elements/icon.svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
import type { PageData } from './$types';
|
2023-10-24 17:05:42 +02:00
|
|
|
import NewVersionCheckSettings from '$lib/components/admin-page/settings/new-version-check-settings/new-version-check-settings.svelte';
|
2023-10-31 21:19:12 +01:00
|
|
|
import LibrarySettings from '$lib/components/admin-page/settings/library-settings/library-settings.svelte';
|
2023-12-14 11:55:40 -05:00
|
|
|
import LoggingSettings from '$lib/components/admin-page/settings/logging-settings/logging-settings.svelte';
|
2023-10-25 09:48:25 -04:00
|
|
|
import { mdiAlert, mdiContentCopy, mdiDownload } from '@mdi/js';
|
2024-01-12 18:44:11 +01:00
|
|
|
import _ from 'lodash';
|
|
|
|
|
import AdminSettings from '$lib/components/admin-page/settings/admin-settings.svelte';
|
2022-12-09 15:51:42 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
export let data: PageData;
|
2023-01-09 16:32:58 -05:00
|
|
|
|
2024-01-12 18:44:11 +01:00
|
|
|
let config = data.configs;
|
|
|
|
|
let openSettings = ($page.url.searchParams.get('open')?.split(',') || []) as Array<keyof SystemConfigDto>;
|
2023-08-25 19:44:52 +02:00
|
|
|
|
2023-10-13 11:02:28 -04:00
|
|
|
const downloadConfig = () => {
|
2024-01-12 18:44:11 +01:00
|
|
|
const blob = new Blob([JSON.stringify(config, null, 2)], { type: 'application/json' });
|
2023-08-25 19:44:52 +02:00
|
|
|
const downloadKey = 'immich-config.json';
|
|
|
|
|
downloadManager.add(downloadKey, blob.size);
|
|
|
|
|
downloadManager.update(downloadKey, blob.size);
|
|
|
|
|
downloadBlob(blob, downloadKey);
|
|
|
|
|
setTimeout(() => downloadManager.clear(downloadKey), 5_000);
|
|
|
|
|
};
|
2024-01-12 18:44:11 +01:00
|
|
|
|
|
|
|
|
const settings = [
|
|
|
|
|
{
|
|
|
|
|
item: JobSettings,
|
|
|
|
|
title: 'Job Settings',
|
|
|
|
|
subtitle: 'Manage job concurrency',
|
|
|
|
|
isOpen: openSettings.includes('job'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: LibrarySettings,
|
|
|
|
|
title: 'Library',
|
|
|
|
|
subtitle: 'Manage library settings',
|
|
|
|
|
isOpen: openSettings.includes('library'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: LoggingSettings,
|
|
|
|
|
title: 'Logging',
|
|
|
|
|
subtitle: 'Manage log settings',
|
|
|
|
|
isOpen: openSettings.includes('logging'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: MachineLearningSettings,
|
|
|
|
|
title: 'Machine Learning Settings',
|
|
|
|
|
subtitle: 'Manage machine learning features and settings',
|
|
|
|
|
isOpen: openSettings.includes('machineLearning'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: MapSettings,
|
|
|
|
|
title: 'Map & GPS Settings',
|
|
|
|
|
subtitle: 'Manage map related features and setting',
|
|
|
|
|
isOpen: openSettings.some((key) => ['map', 'reverseGeocoding'].includes(key)),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: OAuthSettings,
|
|
|
|
|
title: 'OAuth Authentication',
|
|
|
|
|
subtitle: 'Manage the login with OAuth settings',
|
|
|
|
|
isOpen: openSettings.includes('oauth'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: PasswordLoginSettings,
|
|
|
|
|
title: 'Password Authentication',
|
|
|
|
|
subtitle: 'Manage the login with password settings',
|
|
|
|
|
isOpen: openSettings.includes('passwordLogin'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: ServerSettings,
|
|
|
|
|
title: 'Server Settings',
|
|
|
|
|
subtitle: 'Manage server settings',
|
|
|
|
|
isOpen: openSettings.includes('server'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: StorageTemplateSettings,
|
|
|
|
|
title: 'Storage Template',
|
|
|
|
|
subtitle: 'Manage the folder structure and file name of the upload asset',
|
|
|
|
|
isOpen: openSettings.includes('storageTemplate'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: ThemeSettings,
|
|
|
|
|
title: 'Theme Settings',
|
|
|
|
|
subtitle: 'Manage customization of the Immich web interface',
|
|
|
|
|
isOpen: openSettings.includes('theme'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: ThumbnailSettings,
|
|
|
|
|
title: 'Thumbnail Settings',
|
|
|
|
|
subtitle: 'Manage the resolution of thumbnail sizes',
|
|
|
|
|
isOpen: openSettings.includes('thumbnail'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: TrashSettings,
|
|
|
|
|
title: 'Trash Settings',
|
|
|
|
|
subtitle: 'Manage trash settings',
|
|
|
|
|
isOpen: openSettings.includes('trash'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: NewVersionCheckSettings,
|
|
|
|
|
title: 'Version Check',
|
|
|
|
|
subtitle: 'Enable/disable the new version notification',
|
|
|
|
|
isOpen: openSettings.includes('newVersionCheck'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
item: FFmpegSettings,
|
|
|
|
|
title: 'Video Transcoding Settings',
|
|
|
|
|
subtitle: 'Manage the resolution and encoding information of the video files',
|
|
|
|
|
isOpen: openSettings.includes('ffmpeg'),
|
|
|
|
|
},
|
|
|
|
|
];
|
2022-12-09 15:51:42 -05:00
|
|
|
</script>
|
|
|
|
|
|
2024-02-01 13:05:30 -08:00
|
|
|
<div class="h-svh flex flex-col overflow-hidden">
|
|
|
|
|
{#if $featureFlags.configFile}
|
|
|
|
|
<div class="flex flex-row items-center gap-2 bg-gray-100 p-3 dark:bg-gray-800">
|
|
|
|
|
<Icon path={mdiAlert} class="text-yellow-400" size={18} />
|
|
|
|
|
<h2 class="text-md text-immich-primary dark:text-immich-dark-primary">
|
|
|
|
|
Config is currently set by a config file
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2023-08-25 19:44:52 +02:00
|
|
|
|
2024-02-01 13:05:30 -08:00
|
|
|
<UserPageLayout title={data.meta.title} admin>
|
|
|
|
|
<div class="flex justify-end gap-2" slot="buttons">
|
|
|
|
|
<LinkButton on:click={() => copyToClipboard(JSON.stringify(config, null, 2))}>
|
|
|
|
|
<div class="flex place-items-center gap-2 text-sm">
|
|
|
|
|
<Icon path={mdiContentCopy} size="18" />
|
|
|
|
|
Copy to Clipboard
|
|
|
|
|
</div>
|
|
|
|
|
</LinkButton>
|
|
|
|
|
<LinkButton on:click={() => downloadConfig()}>
|
|
|
|
|
<div class="flex place-items-center gap-2 text-sm">
|
|
|
|
|
<Icon path={mdiDownload} size="18" />
|
|
|
|
|
Export as JSON
|
|
|
|
|
</div>
|
|
|
|
|
</LinkButton>
|
|
|
|
|
</div>
|
2023-08-29 09:58:00 -04:00
|
|
|
|
2024-02-01 13:05:30 -08:00
|
|
|
<AdminSettings bind:config let:handleReset let:handleSave let:savedConfig let:defaultConfig>
|
|
|
|
|
<section id="setting-content" class="flex place-content-center sm:mx-4">
|
|
|
|
|
<section class="w-full pb-28 sm:w-5/6 md:w-[850px]">
|
|
|
|
|
{#each settings as { item, title, subtitle, isOpen }}
|
|
|
|
|
<SettingAccordion {title} {subtitle} {isOpen}>
|
|
|
|
|
<svelte:component
|
|
|
|
|
this={item}
|
|
|
|
|
on:save={({ detail }) => handleSave(detail)}
|
|
|
|
|
on:reset={({ detail }) => handleReset(detail)}
|
|
|
|
|
disabled={$featureFlags.configFile}
|
|
|
|
|
{defaultConfig}
|
|
|
|
|
{config}
|
|
|
|
|
{savedConfig}
|
|
|
|
|
/>
|
|
|
|
|
</SettingAccordion>
|
|
|
|
|
{/each}
|
|
|
|
|
</section>
|
2024-01-12 18:44:11 +01:00
|
|
|
</section>
|
2024-02-01 13:05:30 -08:00
|
|
|
</AdminSettings>
|
|
|
|
|
</UserPageLayout>
|
|
|
|
|
</div>
|