Update storage.js via upload script - 2026-08-01 00:10:08

This commit is contained in:
mike 2026-08-01 00:10:29 +08:00
parent 4f93f9b480
commit 3292dd7552
1 changed files with 0 additions and 13 deletions

View File

@ -207,16 +207,3 @@ export async function checkJmsLine(line) {
if (!res.ok) throw new Error(data.error || 'check failed'); if (!res.ok) throw new Error(data.error || 'check failed');
return data; // { status: 'normal' | 'abnormal', checkedAt } return data; // { status: 'normal' | 'abnormal', checkedAt }
} }
// 让服务器代为请求JMS的标准订阅地址解析Subscription-Userinfo拿到流量信息
// 浏览器直接fetch会被CORS挡住服务器端没有这个限制
export async function fetchJmsTraffic(subscriptionUrl) {
const res = await fetch('/api/jms/fetch-traffic', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ subscriptionUrl }),
});
const data = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(data.error || 'fetch traffic failed');
return data; // { ok, upload, download, total, expire } 或 { ok:false, error }
}