Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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."
}
}
}
11 changes: 8 additions & 3 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -911,14 +911,19 @@ 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 == "<a href=logout.php>Please logout First!</a>";
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";
}

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;
Expand Down Expand Up @@ -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";
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down