fix: bug
This commit is contained in:
27
app/static/mode-hint.js
Normal file
27
app/static/mode-hint.js
Normal file
@@ -0,0 +1,27 @@
|
||||
(() => {
|
||||
const badges = Array.from(document.querySelectorAll(".global-mode-hint"));
|
||||
if (!badges.length) return;
|
||||
|
||||
function setText(text) {
|
||||
badges.forEach((el) => {
|
||||
el.textContent = text;
|
||||
});
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const res = await fetch("/api/auth/me");
|
||||
const data = await res.json();
|
||||
if (!res.ok || !data || !data.logged_in) return;
|
||||
const vip = data.vip || {};
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
const enabled = Boolean(vip.vip_enabled);
|
||||
const hasActiveSubscription = Number(vip.cycle_started_at || 0) > 0 && Number(vip.cycle_expires_at || 0) > now;
|
||||
setText(enabled && hasActiveSubscription ? "当前模型模式:平台模型" : "当前模型模式:自由模型");
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
})();
|
||||
Reference in New Issue
Block a user