Files
multica/packages/core/config/index.ts
devv-eve fbf41bde73 feat(selfhost): ship public GHCR deployment flow
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.
2026-04-22 16:58:42 +08:00

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);
}