xmoj-script 1.2.74 → 1.3.1

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.
@@ -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 patch");
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);
@@ -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
@@ -2692,6 +2692,43 @@
2692
2692
  }
2693
2693
  ],
2694
2694
  "Notes": "This was so hard......"
2695
+ },
2696
+ "1.2.75": {
2697
+ "UpdateDate": 1738974525711,
2698
+ "Prerelease": true,
2699
+ "UpdateContents": [
2700
+ {
2701
+ "PR": 767,
2702
+ "Description": "进入讨论后给出题目的链接 "
2703
+ }
2704
+ ],
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."
2695
2732
  }
2696
2733
  }
2697
2734
  }
package/XMOJ.user.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // ==UserScript==
2
2
  // @name XMOJ
3
- // @version 1.2.74
3
+ // @version 1.3.1
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
+ '&': '&amp;',
48
+ '<': '&lt;',
49
+ '>': '&gt;',
50
+ '"': '&quot;',
51
+ "'": '&#39;'
52
+ };
53
+ return escape[match];
54
+ });
55
+ };
56
+
44
57
  let PurifyHTML = (Input) => {
45
58
  try {
46
59
  return DOMPurify.sanitize(Input, {
@@ -3979,7 +3992,7 @@ int main()
3979
3992
  Temp = document.querySelector("#problemstatus > tbody").children;
3980
3993
  for (let i = 0; i < Temp.length; i++) {
3981
3994
  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>`;
3983
3996
  }
3984
3997
  GetUsernameHTML(Temp[i].children[2], Temp[i].children[2].innerText);
3985
3998
  Temp[i].children[3].remove();
@@ -4847,7 +4860,7 @@ int main()
4847
4860
  Delete.style.display = "";
4848
4861
  }
4849
4862
  }
4850
- PostTitle.innerText = ResponseData.Data.Title + (ResponseData.Data.ProblemID == 0 ? "" : ` - 题目` + ResponseData.Data.ProblemID);
4863
+ PostTitle.innerHTML = ResponseData.Data.Title + (ResponseData.Data.ProblemID == 0 ? "" : ` - 题目` + ` <a href="https://www.xmoj.tech/problem.php?id=` + ResponseData.Data.ProblemID + `">` + ResponseData.Data.ProblemID + `</a>`);
4851
4864
  document.title = "讨论" + ThreadID + ": " + ResponseData.Data.Title;
4852
4865
  PostAuthor.innerHTML = "<span></span>";
4853
4866
  GetUsernameHTML(PostAuthor.children[0], ResponseData.Data.UserID);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmoj-script",
3
- "version": "1.2.74",
3
+ "version": "1.3.1",
4
4
  "description": "an improvement script for xmoj.tech",
5
5
  "main": "AddonScript.js",
6
6
  "scripts": {