2024-01-20 19:47:41 +01:00
|
|
|
import { api, type ServerConfigDto, type ServerFeaturesDto } from '@api';
|
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,
|
|
|
|
clipEncode: true,
|
|
|
|
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,
|
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 () => {
|
|
|
|
const [{ data: flags }, { data: config }] = await Promise.all([
|
|
|
|
api.serverInfoApi.getServerFeatures(),
|
|
|
|
api.serverInfoApi.getServerConfig(),
|
|
|
|
]);
|
|
|
|
|
|
|
|
featureFlags.update(() => ({ ...flags, loaded: true }));
|
|
|
|
serverConfig.update(() => ({ ...config, loaded: true }));
|
|
|
|
};
|