From 672f046114f22429dd24c5198e046d7024ef3e9f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 16 May 2026 11:25:58 +0000 Subject: [PATCH 1/9] 3.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2e6b736..3cb8e34a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.4.6", + "version": "3.5.0", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 38376df38e98aa8f8858441688e899ef01459c7b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 16 May 2026 11:25:59 +0000 Subject: [PATCH 2/9] Update to release 3.5.0 --- Update.json | 31 +++++++++++++++++++++++++++++++ XMOJ.user.js | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index e5371722..3d3ee4cb 100644 --- a/Update.json +++ b/Update.json @@ -3585,6 +3585,37 @@ } ], "Notes": "No release notes were provided for this release." + }, + "3.5.0": { + "UpdateDate": 1778930758179, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 961, + "Description": "feat: Cross-device settings sync via cloud backend" + }, + { + "PR": 963, + "Description": "feat: Add hourly periodic cloud settings sync" + }, + { + "PR": 969, + "Description": "Migrate XMOJ-BBS client endpoints to /v1 routes" + }, + { + "PR": 975, + "Description": "Revert /v1 endpoint migration" + }, + { + "PR": 973, + "Description": "Fix loginpage.php Loop" + }, + { + "PR": 980, + "Description": "Switch all backend endpoints to api.xmoj-script.uk" + } + ], + "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 e9d5874f..f4c9e6bf 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.4.6 +// @version 3.5.0 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From ab00a3c1c958703cb9cd91994ccdbe0f2b6782bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 30 May 2026 03:37:33 +0000 Subject: [PATCH 3/9] Initial plan From 2f2e552d9db1c883d3e7bc33ee1d693349c0409f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 30 May 2026 03:47:21 +0000 Subject: [PATCH 4/9] Fix: Wrap async init in IIFE to fix Violentmonkey SyntaxError for top-level await --- XMOJ.user.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index f4c9e6bf..4471192f 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -43,6 +43,11 @@ const CaptchaSiteKey = "0x4AAAAAAALBT58IhyDViNmv"; const AdminUserList = ["zhuchenrui2", "shanwenxiao", "chenlangning", "admin"]; +// Pre-declared so that closures defined before the async init block can reference them +let CurrentUsername; +let initTheme; +let SearchParams; + let escapeHTML = (str) => { return str.replace(/[&<>"']/g, function (match) { const escape = { @@ -911,6 +916,9 @@ GM_registerMenuCommand("重置数据", () => { } }); +// Wrapped in an async IIFE so that `await` is valid in Violentmonkey, +// which executes userscripts as classic scripts (not ES modules). +(async () => { //otherwise CurrentUsername might be undefined let loginStatus; await fetch("https://www.xmoj.tech/loginpage.php") @@ -922,12 +930,12 @@ if (UtilityEnabled("AutoLogin") && document.querySelector("body > a:nth-child(1) location.href = "https://www.xmoj.tech/loginpage.php"; } -let SearchParams = new URLSearchParams(location.search); +SearchParams = new URLSearchParams(location.search); let ServerURL = (UtilityEnabled("DebugMode") ? "https://ghpages.xmoj-script.uk/" : "https://www.xmoj-script.uk") if (document.querySelector("#profile") === null && !logined) { location.href = "https://www.xmoj.tech/loginpage.php"; } -let CurrentUsername = document.querySelector("#profile").innerText; +CurrentUsername = document.querySelector("#profile").innerText; CurrentUsername = CurrentUsername.replaceAll(/[^a-zA-Z0-9]/g, ""); let IsAdmin = AdminUserList.indexOf(CurrentUsername) !== -1; @@ -937,7 +945,7 @@ const applyTheme = (theme) => { localStorage.setItem("UserScript-Setting-DarkMode", theme === "dark" ? "true" : "false"); }; const applySystemTheme = (e) => applyTheme(e.matches ? "dark" : "light"); -let initTheme = () => { +initTheme = () => { const saved = localStorage.getItem("UserScript-Setting-Theme") || "auto"; if (saved === "auto") { applyTheme(prefersDark.matches ? "dark" : "light"); @@ -6347,3 +6355,6 @@ int main() main().then(r => { console.log("XMOJ-Script loaded successfully!"); }); +})().catch(e => { + console.error("[XMOJ-Script] Initialization error:", e); +}); From d37540678d27c038e43c0057d9eb91d4ab7ace9a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 30 May 2026 04:55:40 +0000 Subject: [PATCH 5/9] 3.5.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3cb8e34a..9538b928 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.5.0", + "version": "3.5.1", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 3be870f18b4e1884efe6b131150bb92d42a5cdde Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 30 May 2026 04:55:47 +0000 Subject: [PATCH 6/9] Update version info to 3.5.1 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 3d3ee4cb..f0b99042 100644 --- a/Update.json +++ b/Update.json @@ -3616,6 +3616,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "3.5.1": { + "UpdateDate": 1780116941054, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 986, + "Description": "[WIP] Fix syntax error in XMOJ script for Violentmonkey" + } + ], + "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 4471192f..61be9889 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.5.0 +// @version 3.5.1 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 61a770ca333d3d3ac1df3ad424946a0cc805801b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 30 May 2026 04:59:19 +0000 Subject: [PATCH 7/9] Fix init flow bugs from review --- XMOJ.user.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 61be9889..8b13e45a 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -928,14 +928,19 @@ const logined = loginStatus == "Please logout First!"; if (UtilityEnabled("AutoLogin") && document.querySelector("body > a:nth-child(1)") != null && document.querySelector("body > a:nth-child(1)").innerText == "请登录后继续操作") { localStorage.setItem("UserScript-LastPage", location.pathname + location.search); location.href = "https://www.xmoj.tech/loginpage.php"; + return; } SearchParams = new URLSearchParams(location.search); let ServerURL = (UtilityEnabled("DebugMode") ? "https://ghpages.xmoj-script.uk/" : "https://www.xmoj-script.uk") -if (document.querySelector("#profile") === null && !logined) { - location.href = "https://www.xmoj.tech/loginpage.php"; +const profileElement = document.querySelector("#profile"); +if (profileElement === null) { + if (!logined) { + location.href = "https://www.xmoj.tech/loginpage.php"; + } + return; } -CurrentUsername = document.querySelector("#profile").innerText; +CurrentUsername = profileElement.innerText; CurrentUsername = CurrentUsername.replaceAll(/[^a-zA-Z0-9]/g, ""); let IsAdmin = AdminUserList.indexOf(CurrentUsername) !== -1; @@ -6352,9 +6357,8 @@ int main() } } -main().then(r => { - console.log("XMOJ-Script loaded successfully!"); -}); +await main(); +console.log("XMOJ-Script loaded successfully!"); })().catch(e => { console.error("[XMOJ-Script] Initialization error:", e); }); From d4a9349aae452405885ce91473ea4b9ebf55def4 Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sat, 30 May 2026 13:01:44 +0800 Subject: [PATCH 8/9] Update description for PR 986 in Update.json Signed-off-by: Shan Wenxiao --- Update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index f0b99042..ec725cb1 100644 --- a/Update.json +++ b/Update.json @@ -3623,10 +3623,10 @@ "UpdateContents": [ { "PR": 986, - "Description": "[WIP] Fix syntax error in XMOJ script for Violentmonkey" + "Description": "Fix Violentmonkey SyntaxError: wrap async init block in IIFE" } ], "Notes": "No release notes were provided for this release." } } -} \ No newline at end of file +} From e7f94d8976f553b9cdcfd384fa057efe3213a716 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 30 May 2026 05:02:11 +0000 Subject: [PATCH 9/9] Update time and description of 3.5.1 --- Update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index ec725cb1..4eebcd48 100644 --- a/Update.json +++ b/Update.json @@ -3618,7 +3618,7 @@ "Notes": "No release notes were provided for this release." }, "3.5.1": { - "UpdateDate": 1780116941054, + "UpdateDate": 1780117325597, "Prerelease": true, "UpdateContents": [ { @@ -3629,4 +3629,4 @@ "Notes": "No release notes were provided for this release." } } -} +} \ No newline at end of file