2024-02-14 15:38:57 +01:00
|
|
|
import { getServerConfig, getServerFeatures, type ServerConfigDto, type ServerFeaturesDto } from '@immich/sdk';
|
2023-09-09 04:51:46 +02:00
|
|
|
import { writable } from 'svelte/store';
|
|
|
|
|
|
|
|
export type FeatureFlags = ServerFeaturesDto & { loaded: boolean };
|
|
|
|
|
|
|
|
export const featureFlags = writable<FeatureFlags>({
|
|
|
|
loaded: false,
|
2024-01-29 15:51:22 +01:00
|
|
|
smartSearch: true,
|
2023-09-09 04:51:46 +02:00
|
|
|
facialRecognition: true,
|
|
|
|
sidecar: true,
|
|
|
|
map: true,
|
2023-09-26 09:03:57 +02:00
|
|
|
reverseGeocoding: true,
|
2023-09-09 04:51:46 +02:00
|
|
|
search: true,
|
|
|
|
oauth: false,
|
|
|
|
oauthAutoLaunch: false,
|
|
|
|
passwordLogin: true,
|
|
|
|
configFile: false,
|
2023-10-06 09:01:14 +02:00
|
|
|
trash: true,
|
2023-09-09 04:51:46 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export type ServerConfig = ServerConfigDto & { loaded: boolean };
|
|
|
|
|
|
|
|
export const serverConfig = writable<ServerConfig>({
|
|
|
|
loaded: false,
|
|
|
|
oauthButtonText: '',
|
|
|
|
loginPageMessage: '',
|
2023-10-06 09:01:14 +02:00
|
|
|
trashDays: 30,
|
2024-03-06 06:45:40 +01:00
|
|
|
userDeleteDelay: 7,
|
2023-10-11 04:37:13 +02:00
|
|
|
isInitialized: false,
|
2024-01-04 06:28:32 +01:00
|
|
|
isOnboarded: false,
|
2024-01-04 03:54:48 +01:00
|
|
|
externalDomain: '',
|
2023-09-09 04:51:46 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export const loadConfig = async () => {
|
2024-02-13 23:07:37 +01:00
|
|
|
const [flags, config] = await Promise.all([getServerFeatures(), getServerConfig()]);
|
2023-09-09 04:51:46 +02:00
|
|
|
|
|
|
|
featureFlags.update(() => ({ ...flags, loaded: true }));
|
|
|
|
serverConfig.update(() => ({ ...config, loaded: true }));
|
|
|
|
};
|