xmoj-script 1.2.75 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AddonScript.js +6 -1
- package/Update/UpdateToRelease.js +1 -1
- package/Update/UpdateVersion.js +6 -0
- package/Update.json +37 -0
- package/XMOJ.user.js +23 -14
- package/package.json +1 -1
package/AddonScript.js
CHANGED
@@ -58,7 +58,7 @@ if (LastType == "Release") {
|
|
58
58
|
if (LastJSVersion != NpmVersion) {
|
59
59
|
console.warn("Assuming you manually ran npm version.");
|
60
60
|
} else {
|
61
|
-
execSync("npm version
|
61
|
+
execSync("npm version minor");
|
62
62
|
}
|
63
63
|
var CurrentVersion = execSync("jq -r '.version' package.json").toString().trim();
|
64
64
|
console.log("Current version : " + CurrentVersion);
|
package/Update/UpdateVersion.js
CHANGED
@@ -14,6 +14,12 @@ var JSFileContent = readFileSync(JSFileName, "utf8");
|
|
14
14
|
execSync("git config --global user.email \"github-actions[bot]@users.noreply.github.com\"");
|
15
15
|
execSync("git config --global user.name \"github-actions[bot]\"");
|
16
16
|
if (JSONFileContent.includes('//!ci-no-touch')) {
|
17
|
+
var updatedContent = JSONFileContent.replace('//!ci-no-touch', '');
|
18
|
+
writeFileSync(JSONFileName, updatedContent, "utf8");
|
19
|
+
execSync("git config pull.rebase false");
|
20
|
+
execSync("git pull");
|
21
|
+
execSync("git commit -a -m \"remove //!ci-no-touch\"");
|
22
|
+
execSync("git push -f");
|
17
23
|
console.log('I won\'t touch this. Exiting process.');
|
18
24
|
process.exit(0);
|
19
25
|
}
|
package/Update.json
CHANGED
@@ -2703,6 +2703,43 @@
|
|
2703
2703
|
}
|
2704
2704
|
],
|
2705
2705
|
"Notes": "No release notes were provided for this release."
|
2706
|
+
},
|
2707
|
+
"1.3.0": {
|
2708
|
+
"UpdateDate": 1738976786495,
|
2709
|
+
"Prerelease": false,
|
2710
|
+
"UpdateContents": [
|
2711
|
+
{
|
2712
|
+
"PR": 762,
|
2713
|
+
"Description": "讨论回复跳转优化"
|
2714
|
+
},
|
2715
|
+
{
|
2716
|
+
"PR": 767,
|
2717
|
+
"Description": "进入讨论后给出题目的链接 "
|
2718
|
+
}
|
2719
|
+
],
|
2720
|
+
"Notes": "If you are curious why the version number is v1.3.0, it's because we changed our versioning strategy! Click <a href=\"https://github.com/orgs/XMOJ-Script-dev/discussions/771\"> here </a> for more details."
|
2721
|
+
},
|
2722
|
+
"1.3.1": {
|
2723
|
+
"UpdateDate": 1739060055956,
|
2724
|
+
"Prerelease": true,
|
2725
|
+
"UpdateContents": [
|
2726
|
+
{
|
2727
|
+
"PR": 774,
|
2728
|
+
"Description": "Fix code scanning alert - DOM text reinterpreted as HTML"
|
2729
|
+
}
|
2730
|
+
],
|
2731
|
+
"Notes": "No release notes were provided for this release."
|
2732
|
+
},
|
2733
|
+
"1.3.2": {
|
2734
|
+
"UpdateDate": 1739187728351,
|
2735
|
+
"Prerelease": true,
|
2736
|
+
"UpdateContents": [
|
2737
|
+
{
|
2738
|
+
"PR": 778,
|
2739
|
+
"Description": "Change how we load addonscript (transition from GitHub pages to Cloudflare KV) + Fix *that* console error"
|
2740
|
+
}
|
2741
|
+
],
|
2742
|
+
"Notes": "No release notes were provided for this release."
|
2706
2743
|
}
|
2707
2744
|
}
|
2708
2745
|
}
|
package/XMOJ.user.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// ==UserScript==
|
2
2
|
// @name XMOJ
|
3
|
-
// @version 1.2
|
3
|
+
// @version 1.3.2
|
4
4
|
// @description XMOJ增强脚本
|
5
5
|
// @author @XMOJ-Script-dev, @langningchen and the community
|
6
6
|
// @namespace https://github/langningchen
|
@@ -41,6 +41,19 @@
|
|
41
41
|
const CaptchaSiteKey = "0x4AAAAAAALBT58IhyDViNmv";
|
42
42
|
const AdminUserList = ["zhuchenrui2", "shanwenxiao", "admin"];
|
43
43
|
|
44
|
+
let escapeHTML = (str) => {
|
45
|
+
return str.replace(/[&<>"']/g, function (match) {
|
46
|
+
const escape = {
|
47
|
+
'&': '&',
|
48
|
+
'<': '<',
|
49
|
+
'>': '>',
|
50
|
+
'"': '"',
|
51
|
+
"'": '''
|
52
|
+
};
|
53
|
+
return escape[match];
|
54
|
+
});
|
55
|
+
};
|
56
|
+
|
44
57
|
let PurifyHTML = (Input) => {
|
45
58
|
try {
|
46
59
|
return DOMPurify.sanitize(Input, {
|
@@ -452,10 +465,7 @@ let RequestAPI = (Action, Data, CallBack) => {
|
|
452
465
|
try {
|
453
466
|
CallBack(JSON.parse(Response.responseText));
|
454
467
|
} catch (Error) {
|
455
|
-
console.
|
456
|
-
CallBack({
|
457
|
-
"Success": false, "Message": "JSON解析错误:" + Error, "Data": null
|
458
|
-
});
|
468
|
+
console.error(Response.responseText);
|
459
469
|
}
|
460
470
|
}
|
461
471
|
});
|
@@ -1140,14 +1150,13 @@ async function main() {
|
|
1140
1150
|
new bootstrap.Modal(document.getElementById("UpdateModal")).show();
|
1141
1151
|
}
|
1142
1152
|
});
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
}
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1153
|
+
RequestAPI("GetAddOnScript", {}, (Response) => {
|
1154
|
+
if (Response.Success) {
|
1155
|
+
eval(Response.Data["Script"]);
|
1156
|
+
} else {
|
1157
|
+
console.warn("Fetch AddOnScript failed: " + Response.Message);
|
1158
|
+
}
|
1159
|
+
});
|
1151
1160
|
let ToastContainer = document.createElement("div");
|
1152
1161
|
ToastContainer.classList.add("toast-container", "position-fixed", "bottom-0", "end-0", "p-3");
|
1153
1162
|
document.body.appendChild(ToastContainer);
|
@@ -3979,7 +3988,7 @@ int main()
|
|
3979
3988
|
Temp = document.querySelector("#problemstatus > tbody").children;
|
3980
3989
|
for (let i = 0; i < Temp.length; i++) {
|
3981
3990
|
if (Temp[i].children[5].children[0] != null) {
|
3982
|
-
Temp[i].children[1].innerHTML = `<a href="${Temp[i].children[5].children[0].href}">${Temp[i].children[1].innerText.trim()}</a>`;
|
3991
|
+
Temp[i].children[1].innerHTML = `<a href="${Temp[i].children[5].children[0].href}">${escapeHTML(Temp[i].children[1].innerText.trim())}</a>`;
|
3983
3992
|
}
|
3984
3993
|
GetUsernameHTML(Temp[i].children[2], Temp[i].children[2].innerText);
|
3985
3994
|
Temp[i].children[3].remove();
|