Skip to content

Commit 6e920c5

Browse files
authored
Merge pull request #865 from XMOJ-Script-dev/boomzero/rmAD
删除获取数据功能
2 parents 13831f4 + d5a6690 commit 6e920c5

3 files changed

Lines changed: 14 additions & 118 deletions

File tree

Update.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,6 +3102,17 @@
31023102
}
31033103
],
31043104
"Notes": "修复“NaN年前“"
3105+
},
3106+
"2.4.3": {
3107+
"UpdateDate": 1759414259108,
3108+
"Prerelease": true,
3109+
"UpdateContents": [
3110+
{
3111+
"PR": 865,
3112+
"Description": "删除获取数据功能"
3113+
}
3114+
],
3115+
"Notes": "因为它利用的bug被修复了"
31053116
}
31063117
}
31073118
}

XMOJ.user.js

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name XMOJ
3-
// @version 2.4.2
3+
// @version 2.4.3
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -1469,7 +1469,7 @@ async function main() {
14691469
"Name": "恢复讨论与短消息功能"
14701470
}, {
14711471
"ID": "MoreSTD", "Type": "F", "Name": "查看到更多标程"
1472-
}, {"ID": "ApplyData", "Type": "A", "Name": "获取数据功能"}, {
1472+
}, {
14731473
"ID": "AutoCheat", "Type": "A", "Name": "自动提交当年代码"
14741474
}, {"ID": "Rating", "Type": "A", "Name": "添加用户评分和用户名颜色"}, {
14751475
"ID": "AutoRefresh", "Type": "A", "Name": "比赛列表、比赛排名界面自动刷新"
@@ -3420,121 +3420,6 @@ async function main() {
34203420
if (document.getElementById("apply_data")) {
34213421
let ApplyDiv = document.getElementById("apply_data").parentElement;
34223422
console.log("启动!!!");
3423-
if (UtilityEnabled("ApplyData")) {
3424-
let GetDataButton = document.createElement("button");
3425-
GetDataButton.className = "ms-2 btn btn-outline-secondary";
3426-
GetDataButton.innerText = "获取数据";
3427-
console.log("按钮创建成功");
3428-
ApplyDiv.appendChild(GetDataButton);
3429-
GetDataButton.addEventListener("click", async () => {
3430-
GetDataButton.disabled = true;
3431-
GetDataButton.innerText = "正在获取数据...";
3432-
let PID = localStorage.getItem("UserScript-Solution-" + SearchParams.get("sid") + "-Problem");
3433-
if (PID == null) {
3434-
GetDataButton.innerText = "失败! 无法获取PID";
3435-
GetDataButton.disabled = false;
3436-
await new Promise((resolve) => {
3437-
setTimeout(resolve, 800);
3438-
});
3439-
GetDataButton.innerText = "获取数据";
3440-
return;
3441-
}
3442-
let Code = "";
3443-
if (localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`) !== null) {
3444-
Code = `#define IOFile "${localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`)}"\n`;
3445-
}
3446-
Code += `//XMOJ-Script 获取数据代码
3447-
#include <bits/stdc++.h>
3448-
using namespace std;
3449-
string Base64Encode(string Input)
3450-
{
3451-
const string Base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
3452-
string Output;
3453-
for (int i = 0; i < Input.length(); i += 3)
3454-
{
3455-
Output.push_back(i + 0 > Input.length() ? '=' : Base64Chars[(Input[i + 0] & 0xfc) >> 2]);
3456-
Output.push_back(i + 1 > Input.length() ? '=' : Base64Chars[((Input[i + 0] & 0x03) << 4) + ((Input[i + 1] & 0xf0) >> 4)]);
3457-
Output.push_back(i + 2 > Input.length() ? '=' : Base64Chars[((Input[i + 1] & 0x0f) << 2) + ((Input[i + 2] & 0xc0) >> 6)]);
3458-
Output.push_back(i + 3 > Input.length() ? '=' : Base64Chars[Input[i + 2] & 0x3f]);
3459-
}
3460-
return Output;
3461-
}
3462-
int main()
3463-
{
3464-
#ifdef IOFile
3465-
freopen(IOFile ".in", "r", stdin);
3466-
freopen(IOFile ".out", "w", stdout);
3467-
#endif
3468-
string Input;
3469-
while (1)
3470-
{
3471-
char Data = getchar();
3472-
if (Data == EOF)
3473-
break;
3474-
Input.push_back(Data);
3475-
}
3476-
throw runtime_error("[" + Base64Encode(Input.c_str()) + "]");
3477-
return 0;
3478-
}`;
3479-
3480-
await fetch("https://www.xmoj.tech/submit.php", {
3481-
"headers": {
3482-
"content-type": "application/x-www-form-urlencoded"
3483-
},
3484-
"referrer": "https://www.xmoj.tech/submitpage.php?id=" + PID,
3485-
"method": "POST",
3486-
"body": "id=" + PID + "&" + "language=1&" + "source=" + encodeURIComponent(Code) + "&" + "enable_O2=on"
3487-
});
3488-
3489-
let SID = await fetch("https://www.xmoj.tech/status.php").then((Response) => {
3490-
return Response.text();
3491-
}).then((Response) => {
3492-
let ParsedDocument = new DOMParser().parseFromString(Response, "text/html");
3493-
return ParsedDocument.querySelector("#result-tab > tbody > tr:nth-child(1) > td:nth-child(2)").innerText;
3494-
});
3495-
3496-
await new Promise((Resolve) => {
3497-
let Interval = setInterval(async () => {
3498-
await fetch("status-ajax.php?solution_id=" + SID).then((Response) => {
3499-
return Response.text();
3500-
}).then((Response) => {
3501-
if (Response.split(",")[0] >= 4) {
3502-
clearInterval(Interval);
3503-
Resolve();
3504-
}
3505-
});
3506-
}, 500);
3507-
});
3508-
3509-
await fetch(`https://www.xmoj.tech/reinfo.php?sid=${SID}`).then((Response) => {
3510-
return Response.text();
3511-
}).then((Response) => {
3512-
let ParsedDocument = new DOMParser().parseFromString(Response, "text/html");
3513-
let ErrorData = ParsedDocument.getElementById("errtxt").innerText;
3514-
let MatchResult = ErrorData.match(/\what\(\): \[([A-Za-z0-9+\/=]+)\]/g);
3515-
if (MatchResult === null) {
3516-
GetDataButton.innerText = "获取数据失败";
3517-
GetDataButton.disabled = false;
3518-
return;
3519-
}
3520-
for (let i = 0; i < MatchResult.length; i++) {
3521-
let Data = CryptoJS.enc.Base64.parse(MatchResult[i].substring(10, MatchResult[i].length - 1)).toString(CryptoJS.enc.Utf8);
3522-
ApplyDiv.appendChild(document.createElement("hr"));
3523-
ApplyDiv.appendChild(document.createTextNode("数据" + (i + 1) + ":"));
3524-
let CodeElement = document.createElement("div");
3525-
ApplyDiv.appendChild(CodeElement);
3526-
CodeMirror(CodeElement, {
3527-
value: Data,
3528-
theme: (UtilityEnabled("DarkMode") ? "darcula" : "default"),
3529-
lineNumbers: true,
3530-
readOnly: true
3531-
}).setSize("100%", "auto");
3532-
}
3533-
GetDataButton.innerText = "获取数据成功";
3534-
GetDataButton.disabled = false;
3535-
});
3536-
});
3537-
}
35383423
document.getElementById("apply_data").addEventListener("click", () => {
35393424
let ApplyElements = document.getElementsByClassName("data");
35403425
for (let i = 0; i < ApplyElements.length; i++) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xmoj-script",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)