From 3b4873f59aae28c1055557ffe71140a0983dba1d Mon Sep 17 00:00:00 2001 From: boomzero Date: Thu, 2 Oct 2025 22:06:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XMOJ.user.js | 117 +-------------------------------------------------- 1 file changed, 1 insertion(+), 116 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 76e939a4..33c8a789 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1469,7 +1469,7 @@ async function main() { "Name": "恢复讨论与短消息功能" }, { "ID": "MoreSTD", "Type": "F", "Name": "查看到更多标程" - }, {"ID": "ApplyData", "Type": "A", "Name": "获取数据功能"}, { + }, { "ID": "AutoCheat", "Type": "A", "Name": "自动提交当年代码" }, {"ID": "Rating", "Type": "A", "Name": "添加用户评分和用户名颜色"}, { "ID": "AutoRefresh", "Type": "A", "Name": "比赛列表、比赛排名界面自动刷新" @@ -3420,121 +3420,6 @@ async function main() { if (document.getElementById("apply_data")) { let ApplyDiv = document.getElementById("apply_data").parentElement; console.log("启动!!!"); - if (UtilityEnabled("ApplyData")) { - let GetDataButton = document.createElement("button"); - GetDataButton.className = "ms-2 btn btn-outline-secondary"; - GetDataButton.innerText = "获取数据"; - console.log("按钮创建成功"); - ApplyDiv.appendChild(GetDataButton); - GetDataButton.addEventListener("click", async () => { - GetDataButton.disabled = true; - GetDataButton.innerText = "正在获取数据..."; - let PID = localStorage.getItem("UserScript-Solution-" + SearchParams.get("sid") + "-Problem"); - if (PID == null) { - GetDataButton.innerText = "失败! 无法获取PID"; - GetDataButton.disabled = false; - await new Promise((resolve) => { - setTimeout(resolve, 800); - }); - GetDataButton.innerText = "获取数据"; - return; - } - let Code = ""; - if (localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`) !== null) { - Code = `#define IOFile "${localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`)}"\n`; - } - Code += `//XMOJ-Script 获取数据代码 - #include -using namespace std; -string Base64Encode(string Input) -{ - const string Base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - string Output; - for (int i = 0; i < Input.length(); i += 3) - { - Output.push_back(i + 0 > Input.length() ? '=' : Base64Chars[(Input[i + 0] & 0xfc) >> 2]); - Output.push_back(i + 1 > Input.length() ? '=' : Base64Chars[((Input[i + 0] & 0x03) << 4) + ((Input[i + 1] & 0xf0) >> 4)]); - Output.push_back(i + 2 > Input.length() ? '=' : Base64Chars[((Input[i + 1] & 0x0f) << 2) + ((Input[i + 2] & 0xc0) >> 6)]); - Output.push_back(i + 3 > Input.length() ? '=' : Base64Chars[Input[i + 2] & 0x3f]); - } - return Output; -} -int main() -{ -#ifdef IOFile - freopen(IOFile ".in", "r", stdin); - freopen(IOFile ".out", "w", stdout); -#endif - string Input; - while (1) - { - char Data = getchar(); - if (Data == EOF) - break; - Input.push_back(Data); - } - throw runtime_error("[" + Base64Encode(Input.c_str()) + "]"); - return 0; -}`; - - await fetch("https://www.xmoj.tech/submit.php", { - "headers": { - "content-type": "application/x-www-form-urlencoded" - }, - "referrer": "https://www.xmoj.tech/submitpage.php?id=" + PID, - "method": "POST", - "body": "id=" + PID + "&" + "language=1&" + "source=" + encodeURIComponent(Code) + "&" + "enable_O2=on" - }); - - let SID = await fetch("https://www.xmoj.tech/status.php").then((Response) => { - return Response.text(); - }).then((Response) => { - let ParsedDocument = new DOMParser().parseFromString(Response, "text/html"); - return ParsedDocument.querySelector("#result-tab > tbody > tr:nth-child(1) > td:nth-child(2)").innerText; - }); - - await new Promise((Resolve) => { - let Interval = setInterval(async () => { - await fetch("status-ajax.php?solution_id=" + SID).then((Response) => { - return Response.text(); - }).then((Response) => { - if (Response.split(",")[0] >= 4) { - clearInterval(Interval); - Resolve(); - } - }); - }, 500); - }); - - await fetch(`https://www.xmoj.tech/reinfo.php?sid=${SID}`).then((Response) => { - return Response.text(); - }).then((Response) => { - let ParsedDocument = new DOMParser().parseFromString(Response, "text/html"); - let ErrorData = ParsedDocument.getElementById("errtxt").innerText; - let MatchResult = ErrorData.match(/\what\(\): \[([A-Za-z0-9+\/=]+)\]/g); - if (MatchResult === null) { - GetDataButton.innerText = "获取数据失败"; - GetDataButton.disabled = false; - return; - } - for (let i = 0; i < MatchResult.length; i++) { - let Data = CryptoJS.enc.Base64.parse(MatchResult[i].substring(10, MatchResult[i].length - 1)).toString(CryptoJS.enc.Utf8); - ApplyDiv.appendChild(document.createElement("hr")); - ApplyDiv.appendChild(document.createTextNode("数据" + (i + 1) + ":")); - let CodeElement = document.createElement("div"); - ApplyDiv.appendChild(CodeElement); - CodeMirror(CodeElement, { - value: Data, - theme: (UtilityEnabled("DarkMode") ? "darcula" : "default"), - lineNumbers: true, - readOnly: true - }).setSize("100%", "auto"); - } - GetDataButton.innerText = "获取数据成功"; - GetDataButton.disabled = false; - }); - }); - } document.getElementById("apply_data").addEventListener("click", () => { let ApplyElements = document.getElementsByClassName("data"); for (let i = 0; i < ApplyElements.length; i++) { From 037a14eeb12b4a814fb660b7f1ee37d4bf5af0fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 14:10:58 +0000 Subject: [PATCH 2/3] 2.4.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 96024050..8bee29cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.2", + "version": "2.4.3", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From d5a66904c3efae720dea5c952766287408653940 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 14:11:04 +0000 Subject: [PATCH 3/3] Update version info to 2.4.3 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 2d12bb6d..b1d2d6cf 100644 --- a/Update.json +++ b/Update.json @@ -3102,6 +3102,17 @@ } ], "Notes": "修复“NaN年前“" + }, + "2.4.3": { + "UpdateDate": 1759414259108, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 865, + "Description": "删除获取数据功能" + } + ], + "Notes": "因为它利用的bug被修复了" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 33c8a789..812c41a0 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.2 +// @version 2.4.3 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen