Skip to content

Commit c19f16e

Browse files
authored
Merge pull request #775 from XMOJ-Script-dev/dev
sync: dev to extern-contrib
2 parents 3a27a8a + 233bcb0 commit c19f16e

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

Update.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,6 +2718,17 @@
27182718
}
27192719
],
27202720
"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."
27212732
}
27222733
}
27232734
}

XMOJ.user.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name XMOJ
3-
// @version 1.3.0
3+
// @version 1.3.1
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -41,6 +41,19 @@
4141
const CaptchaSiteKey = "0x4AAAAAAALBT58IhyDViNmv";
4242
const AdminUserList = ["zhuchenrui2", "shanwenxiao", "admin"];
4343

44+
let escapeHTML = (str) => {
45+
return str.replace(/[&<>"']/g, function (match) {
46+
const escape = {
47+
'&': '&amp;',
48+
'<': '&lt;',
49+
'>': '&gt;',
50+
'"': '&quot;',
51+
"'": '&#39;'
52+
};
53+
return escape[match];
54+
});
55+
};
56+
4457
let PurifyHTML = (Input) => {
4558
try {
4659
return DOMPurify.sanitize(Input, {
@@ -3979,7 +3992,7 @@ int main()
39793992
Temp = document.querySelector("#problemstatus > tbody").children;
39803993
for (let i = 0; i < Temp.length; i++) {
39813994
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>`;
3995+
Temp[i].children[1].innerHTML = `<a href="${Temp[i].children[5].children[0].href}">${escapeHTML(Temp[i].children[1].innerText.trim())}</a>`;
39833996
}
39843997
GetUsernameHTML(Temp[i].children[2], Temp[i].children[2].innerText);
39853998
Temp[i].children[3].remove();

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": "1.3.0",
3+
"version": "1.3.1",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)