diff --git a/Update.json b/Update.json index 1103a1bd..03af9550 100644 --- a/Update.json +++ b/Update.json @@ -3541,6 +3541,39 @@ } ], "Notes": "Add hourly automatic cloud settings sync. Every hour, if CloudSync is enabled, settings are downloaded from the cloud and applied locally, then local settings are uploaded to the cloud. This keeps settings in sync across devices without requiring a visit to the settings page." + }, + "3.4.3": { + "UpdateDate": 1775972372292, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 969, + "Description": "Migrate XMOJ-BBS client endpoints to /v1 routes" + } + ], + "Notes": "No release notes were provided for this release." + }, + "3.4.4": { + "UpdateDate": 1775993504358, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 975, + "Description": "Revert /v1 endpoint migration" + } + ], + "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 4ae52ab6..57d59748 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.4.2 +// @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 dfcb7f1d..e2238633 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.4.2", + "version": "3.4.5", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": {