mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-16 22:59:04 +02:00
- Add GET /api/config endpoint exposing cdn_domain from CLOUDFRONT_DOMAIN - Create packages/core/config/ zustand store, fetched at app startup - Extract file card preprocessing to packages/ui/markdown/file-cards.ts with isCdnUrl(url, cdnDomain) using exact hostname match - Add file card support to packages/ui/markdown/Markdown.tsx (was missing) - Remove hardcoded .copilothub.ai hostname check from file-card.tsx - Fix LocalStorage.CdnDomain() to return hostname not full URL - Always run preprocessFileCards regardless of cdnDomain availability (!file syntax works without CDN domain, only legacy matching needs it) - Use useConfigStore hook in common/markdown.tsx for reactive updates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
19 lines
586 B
TypeScript
19 lines
586 B
TypeScript
import { createStore } from "zustand/vanilla";
|
|
import { useStore } from "zustand";
|
|
|
|
interface ConfigState {
|
|
cdnDomain: string;
|
|
setCdnDomain: (domain: string) => void;
|
|
}
|
|
|
|
export const configStore = createStore<ConfigState>((set) => ({
|
|
cdnDomain: "",
|
|
setCdnDomain: (domain) => set({ cdnDomain: domain }),
|
|
}));
|
|
|
|
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);
|
|
}
|