Adds /api/health, ntfy notify on config save, /admin/analytics charts, and deploy smoke for miniprogram config/API. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
827 B
TypeScript
26 lines
827 B
TypeScript
/**
|
||
* 主题初始化 - 在 React 水合前执行,避免主题闪烁
|
||
* 优先读全局 nomadro-theme,回退 nomadvip-theme;默认夜间
|
||
*/
|
||
export const themeInitScript = `
|
||
(function() {
|
||
try {
|
||
var theme = localStorage.getItem('nomadro-theme') || localStorage.getItem('nomadvip-theme');
|
||
var resolved = theme === 'light'
|
||
? 'light'
|
||
: (theme === 'dark'
|
||
? 'dark'
|
||
: (theme === 'system'
|
||
? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
|
||
: 'dark'));
|
||
var root = document.documentElement;
|
||
root.classList.remove('light', 'dark');
|
||
root.classList.add(resolved);
|
||
root.dataset.theme = resolved;
|
||
} catch (e) {
|
||
document.documentElement.classList.add('dark');
|
||
document.documentElement.dataset.theme = 'dark';
|
||
}
|
||
})();
|
||
`;
|