An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
export const isThemeFrontendSupported = (
frontends: string[] | null | undefined,
frontend: string,
) => {
if (!frontends?.length) {
return !["mobile", "browser-mobile"].includes(frontend);
}
if (frontends.includes("all")) {
return true;
}
return frontends.includes(frontend);
};
export const getCurrentAppearanceTheme = (appearance: Config.IAppearance) => {
const themeName = appearance.mode === 1 ? appearance.themeDark : appearance.themeLight;
const themes = appearance.mode === 1 ? appearance.darkThemes : appearance.lightThemes;
return themes?.find((item) => item.name === themeName);
};
export const getCurrentThemeName = (appearance: Config.IAppearance) => {
return appearance.mode === 1 ? appearance.themeDark : appearance.themeLight;
};
export const isCurrentThemeSupported = (appearance: Config.IAppearance, frontend: string) => {
const name = getCurrentThemeName(appearance);
if (name === "daylight" || name === "midnight") {
return true;
}
const theme = getCurrentAppearanceTheme(appearance);
return !!theme && isThemeFrontendSupported(theme.frontends, frontend);
};
export const shouldUnloadThemeScript = (
previous: Config.IAppearance,
next: Config.IAppearance,
frontend: string,
) => {
const previousThemeScriptLoaded = previous.themeJS && isCurrentThemeSupported(previous, frontend);
return previousThemeScriptLoaded && (previous.mode !== next.mode ||
getCurrentThemeName(previous) !== getCurrentThemeName(next) ||
previous.themeVer !== next.themeVer ||
!next.themeJS ||
!isCurrentThemeSupported(next, frontend));
};