Update storage.js via upload script - 2026-08-13 11:00:10
This commit is contained in:
parent
dabe7e71da
commit
7c37a4e171
42
storage.js
42
storage.js
|
|
@ -164,46 +164,4 @@ export async function translateTerms(terms, targetLang) {
|
||||||
return data.translations;
|
return data.translations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------ Telegram config ---------------------------- */
|
|
||||||
|
|
||||||
export async function getTelegramConfig() {
|
|
||||||
const res = await fetch('/api/telegram-config');
|
|
||||||
return res.json().catch(() => ({ hasToken: false, chatId: '' }));
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function saveTelegramConfig(botToken, chatId) {
|
|
||||||
const res = await fetch('/api/telegram-config', {
|
|
||||||
method: 'PUT',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ botToken, chatId }),
|
|
||||||
});
|
|
||||||
const data = await res.json().catch(() => ({}));
|
|
||||||
if (!res.ok) throw new Error(data.error || 'save failed');
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function deleteTelegramConfig() {
|
|
||||||
const res = await fetch('/api/telegram-config', { method: 'DELETE' });
|
|
||||||
return res.json().catch(() => ({}));
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function testTelegramConfig() {
|
|
||||||
const res = await fetch('/api/telegram-config/test', { method: 'POST' });
|
|
||||||
const data = await res.json().catch(() => ({}));
|
|
||||||
if (!res.ok) throw new Error(data.error || 'test failed');
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------- JMS api --------------------------------- */
|
|
||||||
|
|
||||||
// 对单条线路立即做一次连通性检测(SS/VMess/VLESS Reality走TCP测试,VLESS-CDN走HTTP状态码+真实WS握手)
|
|
||||||
export async function checkJmsLine(line) {
|
|
||||||
const res = await fetch('/api/jms/check-line', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ line }),
|
|
||||||
});
|
|
||||||
const data = await res.json().catch(() => ({}));
|
|
||||||
if (!res.ok) throw new Error(data.error || 'check failed');
|
|
||||||
return data; // { status: 'normal' | 'abnormal', checkedAt }
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue