From 7ac3896d113a070122e901c798600ae3a7f3b8b7 Mon Sep 17 00:00:00 2001 From: boomzero Date: Sun, 14 Sep 2025 19:56:10 +0800 Subject: [PATCH 01/11] Fix the submit button on some pages --- XMOJ.user.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 510f5680..1e3662ca 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -444,7 +444,7 @@ let UtilityEnabled = (Name) => { let storeCredential = async (username, password) => { if ('credentials' in navigator && window.PasswordCredential) { try { - const credential = new PasswordCredential({ id: username, password: password }); + const credential = new PasswordCredential({id: username, password: password}); await navigator.credentials.store(credential); } catch (e) { console.error(e); @@ -454,7 +454,7 @@ let storeCredential = async (username, password) => { let getCredential = async () => { if ('credentials' in navigator && window.PasswordCredential) { try { - return await navigator.credentials.get({ password: true, mediation: 'optional' }); + return await navigator.credentials.get({password: true, mediation: 'optional'}); } catch (e) { console.error(e); } @@ -1627,8 +1627,9 @@ async function main() { }, 1000); } else { let PID = localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-Problem-" + SearchParams.get("pid") + "-PID"); - - document.querySelector("body > div > div.mt-3 > center").lastChild.style.marginLeft = "10px"; + if (document.querySelector("body > div > div.mt-3 > center").lastElementChild !== null) { + document.querySelector("body > div > div.mt-3 > center").lastElementChild.style.marginLeft = "10px"; + } //修复提交按钮 let SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(12)'); if (SubmitLink == null) { //a special type of problem From aeb7790715f0792658badf712e1278cc309a92b2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 11:57:25 +0000 Subject: [PATCH 02/11] 2.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5cd94bd3..8b9fa844 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.2.1", + "version": "2.2.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From b70b50786e58d6549de72e5692afcdc36716cf84 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 11:57:31 +0000 Subject: [PATCH 03/11] Update version info to 2.2.2 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 3b3cbb17..3a138d87 100644 --- a/Update.json +++ b/Update.json @@ -3032,6 +3032,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "2.2.2": { + "UpdateDate": 1757851046240, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 852, + "Description": "Fix the submit button on some pages" + } + ], + "Notes": "No release notes were provided for this release." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 1e3662ca..1d4a4c7f 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.2.1 +// @version 2.2.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 1d48ff5586efbcb3ae85aaab12cf1b947b3f931c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 12:01:17 +0000 Subject: [PATCH 04/11] 2.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b9fa844..ce3e35b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.2.2", + "version": "2.3.0", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 05800388c7bc53b94e38aa8b18b5e0c98547b79e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 12:01:18 +0000 Subject: [PATCH 05/11] Update to release 2.3.0 --- Update.json | 15 +++++++++++++++ XMOJ.user.js | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 3a138d87..4953be77 100644 --- a/Update.json +++ b/Update.json @@ -3043,6 +3043,21 @@ } ], "Notes": "No release notes were provided for this release." + }, + "2.3.0": { + "UpdateDate": 1757851277491, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 839, + "Description": "Fix formatting in feedback card text" + }, + { + "PR": 852, + "Description": "Fix the submit button on some pages" + } + ], + "Notes": "随着 CI 更新, 相信以后的 release 都会有 release notes(" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 1d4a4c7f..aef69ff6 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.2.2 +// @version 2.3.0 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 37cc584ccdb3b39be3ae384098e95d42daa49081 Mon Sep 17 00:00:00 2001 From: boomzero Date: Sat, 27 Sep 2025 10:37:18 +0800 Subject: [PATCH 06/11] Fix: the PHPSESSID cookie is now httpOnly (#847) --- XMOJ.user.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index aef69ff6..f184aba6 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -20,6 +20,7 @@ // @grant unsafeWindow // @grant GM_setValue // @grant GM_getValue +// @grant GM_cookie // @homepage https://www.xmoj-bbs.me/ // @supportURL https://support.xmoj-bbs.me/form/8050213e-c806-4680-b414-0d1c48263677 // @connect api.xmoj-bbs.tech @@ -479,6 +480,20 @@ let RequestAPI = (Action, Data, CallBack) => { Session = Temp[i].split("=")[1]; } } + if (Session === "") { //The cookie is httpOnly + GM.cookie.set({ + name: 'PHPSESSID', + value: Math.random().toString(36).substring(2, 15), + path: "/" + }) + .then(() => { + console.log('Reset PHPSESSID successfully.'); + location.reload(); //Refresh the page to auth with the new PHPSESSID + }) + .catch((error) => { + console.error(error); + }); + } let PostData = { "Authentication": { "SessionID": Session, "Username": CurrentUsername, @@ -1010,7 +1025,17 @@ async function main() { }); PopupUL.children[5].addEventListener("click", () => { clearCredential(); - document.cookie = "PHPSESSID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; //This is how you remove a cookie? + GM.cookie.set({ + name: 'PHPSESSID', + value: Math.random().toString(36).substring(2, 15), + path: "/" + }) + .then(() => { + console.log('Reset PHPSESSID successfully.'); + }) + .catch((error) => { + console.error(error); + }); //We can no longer rely of the server to set the cookie for us location.href = "https://www.xmoj.tech/logout.php"; }); Array.from(PopupUL.children).forEach(item => { From 6f174b4099e77d120559b330bd613a23e737ffb5 Mon Sep 17 00:00:00 2001 From: boomzero Date: Sat, 27 Sep 2025 11:33:02 +0800 Subject: [PATCH 07/11] Change how we get a random PHPSESSID --- XMOJ.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index f184aba6..bfd20aae 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -483,7 +483,7 @@ let RequestAPI = (Action, Data, CallBack) => { if (Session === "") { //The cookie is httpOnly GM.cookie.set({ name: 'PHPSESSID', - value: Math.random().toString(36).substring(2, 15), + value: (Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).substring(0, 28), path: "/" }) .then(() => { @@ -1027,7 +1027,7 @@ async function main() { clearCredential(); GM.cookie.set({ name: 'PHPSESSID', - value: Math.random().toString(36).substring(2, 15), + value: (Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).substring(0, 28), path: "/" }) .then(() => { From b8d5922c9e12521702545a18dd3be39662ff241c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Sep 2025 03:35:36 +0000 Subject: [PATCH 08/11] 2.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce3e35b6..9f1ef8ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.3.0", + "version": "2.3.1", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From e3e8db8aa80592880f8ec7b91821e13a8723f380 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Sep 2025 03:35:42 +0000 Subject: [PATCH 09/11] Update version info to 2.3.1 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 4953be77..c98da902 100644 --- a/Update.json +++ b/Update.json @@ -3058,6 +3058,17 @@ } ], "Notes": "随着 CI 更新, 相信以后的 release 都会有 release notes(" + }, + "2.3.1": { + "UpdateDate": 1758944137297, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 856, + "Description": "修复由于 PHPSESSID 启用了 httpOnly 导致的后台不可用" + } + ], + "Notes": "本版本修复了由于 PHPSESSID 启用了 httpOnly 导致的后台不可用" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index bfd20aae..563eddf5 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.3.0 +// @version 2.3.1 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 8eb331537f7ee12853d68e2eafbe0257986539f9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Sep 2025 03:36:24 +0000 Subject: [PATCH 10/11] Update time and description of 2.3.1 --- Update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index c98da902..77649d27 100644 --- a/Update.json +++ b/Update.json @@ -3060,7 +3060,7 @@ "Notes": "随着 CI 更新, 相信以后的 release 都会有 release notes(" }, "2.3.1": { - "UpdateDate": 1758944137297, + "UpdateDate": 1758944178711, "Prerelease": true, "UpdateContents": [ { @@ -3068,7 +3068,7 @@ "Description": "修复由于 PHPSESSID 启用了 httpOnly 导致的后台不可用" } ], - "Notes": "本版本修复了由于 PHPSESSID 启用了 httpOnly 导致的后台不可用" + "Notes": "本版本修复了由于 PHPSESSID 启用了 httpOnly 导致的后台不可用\nThis fixes #847." } } } \ No newline at end of file From 71cb5405f72492c8fd3f268b42a5d8611d2cd186 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Sep 2025 03:36:50 +0000 Subject: [PATCH 11/11] Update time and description of 2.3.1 --- Update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index 77649d27..72357a37 100644 --- a/Update.json +++ b/Update.json @@ -3060,7 +3060,7 @@ "Notes": "随着 CI 更新, 相信以后的 release 都会有 release notes(" }, "2.3.1": { - "UpdateDate": 1758944178711, + "UpdateDate": 1758944205783, "Prerelease": true, "UpdateContents": [ { @@ -3068,7 +3068,7 @@ "Description": "修复由于 PHPSESSID 启用了 httpOnly 导致的后台不可用" } ], - "Notes": "本版本修复了由于 PHPSESSID 启用了 httpOnly 导致的后台不可用\nThis fixes #847." + "Notes": "本版本修复了由于 PHPSESSID 启用了 httpOnly 导致的后台不可用" } } } \ No newline at end of file