Skip to content

Commit

Permalink
Merge pull request #737 from XMOJ-Script-dev/boomzero/headers!
Browse files Browse the repository at this point in the history
Add http request headers
  • Loading branch information
boomzero authored Oct 2, 2024
2 parents fc0f405 + c27a364 commit 280ca3e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2554,6 +2554,17 @@
}
],
"Notes": "No release notes were provided for this release."
},
"1.2.65": {
"UpdateDate": 1727861782766,
"Prerelease": true,
"UpdateContents": [
{
"PR": 737,
"Description": "Add http request headers"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
9 changes: 6 additions & 3 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 1.2.64
// @version 1.2.65
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -417,7 +417,10 @@ let RequestAPI = (Action, Data, CallBack) => {
url: (UtilityEnabled("SuperDebug") ? "http://127.0.0.1:8787/" : "https://api.xmoj-bbs.me/") + Action,
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache"
"Cache-Control": "no-cache",
"XMOJ-UserID": CurrentUsername,
"XMOJ-Script-Version": GM_info.script.version,
"DebugMode": UtilityEnabled("DebugMode")
},
data: DataString,
onload: (Response) => {
Expand Down Expand Up @@ -1503,7 +1506,7 @@ async function main() {
localStorage.setItem("UserScript-Problem-" + Temp[i].children[1].innerText + "-Name", Temp[i].children[2].innerText);
}
} else if (location.pathname == "/problem.php") {

Check warning on line 1508 in XMOJ.user.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Equality operator may cause type coercion

Comparison location.pathname == "/problem.php" may cause unexpected type coercion
RenderMathJax();
await RenderMathJax();
if (SearchParams.get("cid") != null) {
document.getElementsByTagName("h2")[0].innerHTML += " (" + localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-Problem-" + SearchParams.get("pid") + "-PID") + ")";
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xmoj-script",
"version": "1.2.64",
"version": "1.2.65",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down

0 comments on commit 280ca3e

Please sign in to comment.