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>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* 读取门户写入的远程配置缓存(与 ~/lib/use-remote-config CACHE_KEY 对齐)
|
|
* VIP 垂直仓不直接依赖门户路径,只读 localStorage。
|
|
*/
|
|
const WEB_CACHE_KEY = "nomadro_web_remote_config_v1";
|
|
|
|
export type VipRemoteCopy = {
|
|
vipPriceFen?: number;
|
|
vipProductId?: string;
|
|
vipCta?: string;
|
|
payEnabled?: boolean;
|
|
};
|
|
|
|
export function readPortalRemoteCopy(): VipRemoteCopy {
|
|
if (typeof window === "undefined") return {};
|
|
try {
|
|
const raw = localStorage.getItem(WEB_CACHE_KEY);
|
|
if (!raw) return {};
|
|
const parsed = JSON.parse(raw) as {
|
|
config?: {
|
|
copy?: {
|
|
vipPriceFen?: number;
|
|
vipProductId?: string;
|
|
vipCta?: string;
|
|
};
|
|
flags?: { payEnabled?: boolean };
|
|
};
|
|
};
|
|
const copy = parsed?.config?.copy || {};
|
|
const flags = parsed?.config?.flags || {};
|
|
return {
|
|
vipPriceFen: Number(copy.vipPriceFen) || undefined,
|
|
vipProductId: copy.vipProductId,
|
|
vipCta: copy.vipCta,
|
|
payEnabled: flags.payEnabled,
|
|
};
|
|
} catch {
|
|
return {};
|
|
}
|
|
}
|