更新 Scripts/AddMsGames.js

This commit is contained in:
2026-04-26 00:10:29 +09:00
parent 87ba6b6a86
commit 828b56eade

View File

@@ -526,18 +526,57 @@ ${failedHtml}
});
}
function doneWithPage(title, message, type = "warn") {
const color = type === "error" ? "#e05050" : type === "warn" ? "#e8a838" : "#52b043";
const icon = type === "error" ? "❌" : type === "warn" ? "⚠️" : "✅";
const html = `<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<title>Xbox · ${flag}${label}</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Noto+Sans+SC:wght@400;500&display=swap');
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{background:#0b0b0b;color:#ddd;font-family:'Noto Sans SC',sans-serif;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px 18px;-webkit-font-smoothing:antialiased}
.card{width:100%;max-width:420px;background:#141414;border:1px solid #222;border-top:3px solid ${color};border-radius:4px;padding:24px 20px 20px}
.icon{font-size:32px;margin-bottom:12px}
.title{font-family:'Barlow Condensed',sans-serif;font-size:20px;font-weight:700;color:#fff;letter-spacing:1px;margin-bottom:8px}
.msg{font-size:13px;color:#888;line-height:1.7}
.footer{margin-top:20px;display:flex;align-items:center;justify-content:space-between}
.sub{font-size:11px;color:#2a2a2a;letter-spacing:1.5px;text-transform:uppercase}
a{display:inline-block;padding:8px 18px;border:1px solid ${color};color:${color};border-radius:3px;font-family:'Barlow Condensed',sans-serif;font-size:13px;font-weight:600;letter-spacing:1px;text-decoration:none}
</style>
</head>
<body>
<div class="card">
<div class="icon">${icon}</div>
<div class="title">${title}</div>
<div class="msg">${message}</div>
<div class="footer">
<span class="sub">Xbox · ${flag}${label}</span>
<a href="https://addmsgames.com">← 返回</a>
</div>
</div>
</body>
</html>`;
$done({ response: { status: 200, headers: { "Content-Type": "text/html;charset=utf-8", "Cache-Control": "no-store, no-cache, must-revalidate", "Pragma": "no-cache" }, body: html } });
}
function startTask() {
if (!MUID || !MS_CV) {
$notification.post(`❌ Xbox ${label} 错误`, `缺少 MUID 或 CV`, `请写入 ${MUID_KEY} / ${CV_KEY}`);
$done({});
doneWithPage("缺少必要参数", `未找到 MUID 或 MS-CV请确认已正确写入<br><br><code>${MUID_KEY}</code><br><code>${CV_KEY}</code>`, "error");
return;
}
if (productList.length === 0) {
$notification.post(`⚠️ Xbox ${label}`, "列表为空,无需执行", `来源: ${sourceLabel}`);
if (useRemote) {
$httpClient.post({ url: REMOTE_COMMIT_URL, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ remaining: {} }) }, () => $done({}));
$httpClient.post({ url: REMOTE_COMMIT_URL, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ remaining: {} }) }, () => {
doneWithPage("暂无商品", `远程队列与本地列表均为空,无需加购。<br><br>来源: ${sourceLabel}`, "warn");
});
} else {
$done({});
doneWithPage("暂无商品", `远程队列与本地列表均为空,无需加购。<br><br>来源: ${sourceLabel}`, "warn");
}
return;
}