From c24d3fcdde14dc447af6b0d8703a42dd2b19eba4 Mon Sep 17 00:00:00 2001 From: zsTree Date: Sun, 12 Apr 2026 06:30:42 +0000 Subject: [PATCH 1/9] Fix loginpage.php Loop --- XMOJ.user.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/XMOJ.user.js b/XMOJ.user.js index eecedc5c..daba8d87 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -911,7 +911,9 @@ GM_registerMenuCommand("重置数据", () => { }); //otherwise CurrentUsername might be undefined +let logined = (document.querySelector('a').innerText == "Please logout First!"); if (UtilityEnabled("AutoLogin") && document.querySelector("body > a:nth-child(1)") != null && document.querySelector("body > a:nth-child(1)").innerText == "请登录后继续操作") { + if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); localStorage.setItem("UserScript-LastPage", location.pathname + location.search); location.href = "https://www.xmoj.tech/loginpage.php"; } @@ -919,6 +921,7 @@ if (UtilityEnabled("AutoLogin") && document.querySelector("body > a:nth-child(1) let SearchParams = new URLSearchParams(location.search); let ServerURL = (UtilityEnabled("DebugMode") ? "https://ghpages.xmoj-bbs.me/" : "https://www.xmoj-bbs.me") if (document.querySelector("#profile") === null) { + if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); location.href = "https://www.xmoj.tech/loginpage.php"; } let CurrentUsername = document.querySelector("#profile").innerText; @@ -1184,6 +1187,7 @@ async function main() { } if (UtilityEnabled("AutoLogin") && document.querySelector("#profile") != null && document.querySelector("#profile").innerHTML == "登录" && location.pathname != "/login.php" && location.pathname != "/loginpage.php" && location.pathname != "/lostpassword.php") { + if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); localStorage.setItem("UserScript-LastPage", location.pathname + location.search); location.href = "https://www.xmoj.tech/loginpage.php"; } From 02881c8534fa1a83c2ce05c397ced6dca4466fa9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Apr 2026 06:35:21 +0000 Subject: [PATCH 2/9] 3.4.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 244106ae..c433e40d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.4.3", + "version": "3.4.4", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From d825aee3da8facce093397d7652ecd3e365548bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Apr 2026 06:35:27 +0000 Subject: [PATCH 3/9] Update version info to 3.4.4 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index d28c065e..5b591f0b 100644 --- a/Update.json +++ b/Update.json @@ -3552,6 +3552,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "3.4.4": { + "UpdateDate": 1775975721817, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 973, + "Description": "Fix loginpage.php Loop" + } + ], + "Notes": "Fix loginpage.php loop." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index daba8d87..49f4d563 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.4.3 +// @version 3.4.4 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 95bdcd78a0cb93132c4b08cd84e699c759eebeb1 Mon Sep 17 00:00:00 2001 From: zsTree Date: Sun, 12 Apr 2026 14:38:02 +0800 Subject: [PATCH 4/9] Refactor login check for clarity and efficiency Signed-off-by: zsTree --- XMOJ.user.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 49f4d563..1eb05d4a 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -911,7 +911,8 @@ GM_registerMenuCommand("重置数据", () => { }); //otherwise CurrentUsername might be undefined -let logined = (document.querySelector('a').innerText == "Please logout First!"); +const firstAnchor = document.querySelector('a'); +const logined = !!firstAnchor && firstAnchor.innerText === 'Please logout First!'; if (UtilityEnabled("AutoLogin") && document.querySelector("body > a:nth-child(1)") != null && document.querySelector("body > a:nth-child(1)").innerText == "请登录后继续操作") { if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); localStorage.setItem("UserScript-LastPage", location.pathname + location.search); From 20abaf0b35bc9544e3256aa2223b181bf854903e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Apr 2026 06:38:26 +0000 Subject: [PATCH 5/9] Update time and description of 3.4.4 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 5b591f0b..0cd8346e 100644 --- a/Update.json +++ b/Update.json @@ -3554,7 +3554,7 @@ "Notes": "No release notes were provided for this release." }, "3.4.4": { - "UpdateDate": 1775975721817, + "UpdateDate": 1775975900964, "Prerelease": true, "UpdateContents": [ { From 522d37fa0e44d0a7ab97b162d03427a5122121e1 Mon Sep 17 00:00:00 2001 From: zsTree Date: Sun, 12 Apr 2026 23:49:53 +0800 Subject: [PATCH 6/9] Fix loginpage.php Loop Signed-off-by: zsTree --- XMOJ.user.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 1eb05d4a..57d59748 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.4.4 +// @version 3.4.5 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen @@ -505,7 +505,7 @@ let RequestAPI = (Action, Data, CallBack) => { } GM_xmlhttpRequest({ method: "POST", - url: (UtilityEnabled("SuperDebug") ? "http://127.0.0.1:8787/v1/" : "https://api.xmoj-bbs.me/v1/") + Action, + url: (UtilityEnabled("SuperDebug") ? "http://127.0.0.1:8787/" : "https://api.xmoj-bbs.me/") + Action, headers: { "Content-Type": "application/json", "Cache-Control": "no-cache", @@ -643,7 +643,7 @@ function ConnectNotificationSocket() { return; } - let wsUrl = (UtilityEnabled("SuperDebug") ? "ws://127.0.0.1:8787" : "wss://api.xmoj-bbs.me") + "/v1/ws/notifications?SessionID=" + Session; + let wsUrl = (UtilityEnabled("SuperDebug") ? "ws://127.0.0.1:8787" : "wss://api.xmoj-bbs.me") + "/ws/notifications?SessionID=" + Session; if (UtilityEnabled("DebugMode")) { console.log("WebSocket: Connecting to", wsUrl); @@ -911,18 +911,19 @@ GM_registerMenuCommand("重置数据", () => { }); //otherwise CurrentUsername might be undefined -const firstAnchor = document.querySelector('a'); -const logined = !!firstAnchor && firstAnchor.innerText === 'Please logout First!'; +let loginStatus; +await fetch("https://www.xmoj.tech/loginpage.php") + .then((response) => response.text()) + .then((data) => (loginStatus = data)); +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 == "请登录后继续操作") { - if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); localStorage.setItem("UserScript-LastPage", location.pathname + location.search); location.href = "https://www.xmoj.tech/loginpage.php"; } let SearchParams = new URLSearchParams(location.search); let ServerURL = (UtilityEnabled("DebugMode") ? "https://ghpages.xmoj-bbs.me/" : "https://www.xmoj-bbs.me") -if (document.querySelector("#profile") === null) { - if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); +if (document.querySelector("#profile") === null && !logined) { location.href = "https://www.xmoj.tech/loginpage.php"; } let CurrentUsername = document.querySelector("#profile").innerText; @@ -1187,8 +1188,7 @@ async function main() { document.querySelector("body > div > div.jumbotron").className = "mt-3"; } - if (UtilityEnabled("AutoLogin") && document.querySelector("#profile") != null && document.querySelector("#profile").innerHTML == "登录" && location.pathname != "/login.php" && location.pathname != "/loginpage.php" && location.pathname != "/lostpassword.php") { - if (logined) location.href = (localStorage.getItem("UserScript-LastPage") == null ? "/" : localStorage.getItem("UserScript-LastPage")); + if (UtilityEnabled("AutoLogin") && document.querySelector("#profile") != null && document.querySelector("#profile").innerHTML == "登录" && location.pathname != "/login.php" && location.pathname != "/loginpage.php" && location.pathname != "/lostpassword.php" && !logined) { localStorage.setItem("UserScript-LastPage", location.pathname + location.search); location.href = "https://www.xmoj.tech/loginpage.php"; } @@ -5026,7 +5026,7 @@ int main() "Image": Reader.result }, (ResponseData) => { if (ResponseData.Success) { - Content.value = Before + `![](https://assets.xmoj-bbs.me/v1/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; + Content.value = Before + `![](https://assets.xmoj-bbs.me/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; Content.dispatchEvent(new Event("input")); } else { Content.value = Before + `![上传失败!` + ResponseData.Message + `]()` + After; @@ -5282,7 +5282,7 @@ int main() "Image": Reader.result }, (ResponseData) => { if (ResponseData.Success) { - ContentElement.value = Before + `![](https://assets.xmoj-bbs.me/v1/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; + ContentElement.value = Before + `![](https://assets.xmoj-bbs.me/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; ContentElement.dispatchEvent(new Event("input")); } else { ContentElement.value = Before + `![上传失败!]()` + After; @@ -5455,7 +5455,7 @@ int main() "Image": Reader.result }, (ResponseData) => { if (ResponseData.Success) { - ContentElement.value = Before + `![](https://assets.xmoj-bbs.me/v1/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; + ContentElement.value = Before + `![](https://assets.xmoj-bbs.me/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; ContentElement.dispatchEvent(new Event("input")); } else { ContentElement.value = Before + `![上传失败!]()` + After; @@ -5713,7 +5713,7 @@ int main() "Image": Reader.result }, (ResponseData) => { if (ResponseData.Success) { - ContentEditor.value = Before + `![](https://assets.xmoj-bbs.me/v1/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; + ContentEditor.value = Before + `![](https://assets.xmoj-bbs.me/GetImage?ImageID=${ResponseData.Data.ImageID})` + After; ContentEditor.dispatchEvent(new Event("input")); } else { ContentEditor.value = Before + `![上传失败!]()` + After; From 2415c7f9b8d6fac56535d3397f314b9631075866 Mon Sep 17 00:00:00 2001 From: zsTree Date: Sun, 12 Apr 2026 23:50:21 +0800 Subject: [PATCH 7/9] Bump version from 3.4.4 to 3.4.5 Signed-off-by: zsTree --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c433e40d..e2238633 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.4.4", + "version": "3.4.5", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From b5397c66192d365df09e68981606429171a15946 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Apr 2026 15:52:34 +0000 Subject: [PATCH 8/9] Update time and description of 3.4.5 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index d1b3061f..4248829d 100644 --- a/Update.json +++ b/Update.json @@ -3565,7 +3565,7 @@ "Notes": "Revert the `/v1` endpoint migration from #969 to restore original API routes." }, "3.4.5": { - "UpdateDate": 1775975900964, + "UpdateDate": 1776009148847, "Prerelease": true, "UpdateContents": [ { From e23fdd65fab82ee4488e5541d515e5b0106bd3ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Apr 2026 15:57:19 +0000 Subject: [PATCH 9/9] Update time and description of 3.4.5 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 4248829d..03af9550 100644 --- a/Update.json +++ b/Update.json @@ -3565,7 +3565,7 @@ "Notes": "Revert the `/v1` endpoint migration from #969 to restore original API routes." }, "3.4.5": { - "UpdateDate": 1776009148847, + "UpdateDate": 1776009434318, "Prerelease": true, "UpdateContents": [ {