diff --git a/Update.json b/Update.json index 6b9bbafd..03af9550 100644 --- a/Update.json +++ b/Update.json @@ -3548,7 +3548,7 @@ "UpdateContents": [ { "PR": 969, - "Description": "Migrate XMOJ-BBS client endpoints to routes" + "Description": "Migrate XMOJ-BBS client endpoints to /v1 routes" } ], "Notes": "No release notes were provided for this release." @@ -3563,6 +3563,17 @@ } ], "Notes": "Revert the `/v1` endpoint migration from #969 to restore original API routes." + }, + "3.4.5": { + "UpdateDate": 1776009434318, + "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 370e74d6..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 @@ -911,6 +911,11 @@ GM_registerMenuCommand("重置数据", () => { }); //otherwise CurrentUsername might be undefined +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 == "请登录后继续操作") { localStorage.setItem("UserScript-LastPage", location.pathname + location.search); location.href = "https://www.xmoj.tech/loginpage.php"; @@ -918,7 +923,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 (document.querySelector("#profile") === null && !logined) { location.href = "https://www.xmoj.tech/loginpage.php"; } let CurrentUsername = document.querySelector("#profile").innerText; @@ -1183,7 +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 (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"; } 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": {