mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-28 05:46:58 +02:00
Publish stable GHCR self-host images, switch self-host deploys to official image pulls with a source-build fallback, and move self-host signup / Google OAuth config onto runtime /api/config.
26 lines
866 B
TypeScript
26 lines
866 B
TypeScript
import { createStore } from "zustand/vanilla";
|
|
import { useStore } from "zustand";
|
|
|
|
interface ConfigState {
|
|
cdnDomain: string;
|
|
allowSignup: boolean;
|
|
googleClientId: string;
|
|
setCdnDomain: (domain: string) => void;
|
|
setAuthConfig: (config: { allowSignup: boolean; googleClientId?: string }) => void;
|
|
}
|
|
|
|
export const configStore = createStore<ConfigState>((set) => ({
|
|
cdnDomain: "",
|
|
allowSignup: true,
|
|
googleClientId: "",
|
|
setCdnDomain: (domain) => set({ cdnDomain: domain }),
|
|
setAuthConfig: ({ allowSignup, googleClientId = "" }) =>
|
|
set({ allowSignup, googleClientId }),
|
|
}));
|
|
|
|
export function useConfigStore(): ConfigState;
|
|
export function useConfigStore<T>(selector: (state: ConfigState) => T): T;
|
|
export function useConfigStore<T>(selector?: (state: ConfigState) => T) {
|
|
return useStore(configStore, selector as (state: ConfigState) => T);
|
|
}
|