Update qtx.js

This commit is contained in:
smallfawn
2023-07-06 16:16:27 +08:00
committed by GitHub
parent 32afde90ac
commit 1484d7eb2f

38
qtx.js
View File

@@ -300,29 +300,27 @@ function httpRequest(options, method) {
}) })
}) })
} }
async function notice() { /**
* 获取远程通知
*/
async function getNotice() {
try { try {
let options = { const urls = [
url: `https://ghproxy.com/https://raw.githubusercontent.com/smallfawn/api/main/notice.json`, "https://cdn.jsdelivr.net/gh/smallfawn/Note@main/Notice.json",
headers: { "https://ghproxy.com/https://raw.githubusercontent.com/smallfawn/Note/main/Notice.json",
'User-Agent': '' "https://fastly.jsdelivr.net/gh/smallfawn/Note@main/Notice.json",
}, "https://gitee.com/smallfawn/Note/raw/master/Notice.json",
} ];
//console.log(options); let notice = null;
let result = await httpRequest(options); for (const url of urls) {
//console.log(result); const options = { url, headers: { "User-Agent": "" }, };
if (result) { const result = await httpRequest(options);
if ('notice' in result) { if (result && "notice" in result) {
DoubleLog(`${result.notice}`); notice = result.notice.replace(/\\n/g, "\n");
} else { break;
options.url = `https://gitee.com/smallfawn/api/raw/master/notice.json`
result = await httpRequest(options);
if ('notice' in result) {
DoubleLog(`${result.notice}`);
}
} }
} else {
} }
if (notice) { $.DoubleLog(notice); }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }