mirror of
https://github.com/immich-app/immich.git
synced 2025-01-10 13:56:47 +01:00
38 lines
973 B
TypeScript
38 lines
973 B
TypeScript
|
import { api, ServerConfigDto, ServerFeaturesDto } from '@api';
|
||
|
import { writable } from 'svelte/store';
|
||
|
|
||
|
export type FeatureFlags = ServerFeaturesDto & { loaded: boolean };
|
||
|
|
||
|
export const featureFlags = writable<FeatureFlags>({
|
||
|
loaded: false,
|
||
|
clipEncode: true,
|
||
|
facialRecognition: true,
|
||
|
sidecar: true,
|
||
|
tagImage: true,
|
||
|
map: true,
|
||
|
search: true,
|
||
|
oauth: false,
|
||
|
oauthAutoLaunch: false,
|
||
|
passwordLogin: true,
|
||
|
configFile: false,
|
||
|
});
|
||
|
|
||
|
export type ServerConfig = ServerConfigDto & { loaded: boolean };
|
||
|
|
||
|
export const serverConfig = writable<ServerConfig>({
|
||
|
loaded: false,
|
||
|
oauthButtonText: '',
|
||
|
mapTileUrl: '',
|
||
|
loginPageMessage: '',
|
||
|
});
|
||
|
|
||
|
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 }));
|
||
|
};
|