xmoj-script 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Update.json +33 -0
- package/XMOJ.user.js +30 -2
- package/package.json +1 -1
package/Update.json
CHANGED
@@ -3058,6 +3058,39 @@
|
|
3058
3058
|
}
|
3059
3059
|
],
|
3060
3060
|
"Notes": "随着 CI 更新, 相信以后的 release 都会有 release notes("
|
3061
|
+
},
|
3062
|
+
"2.3.1": {
|
3063
|
+
"UpdateDate": 1758944205783,
|
3064
|
+
"Prerelease": true,
|
3065
|
+
"UpdateContents": [
|
3066
|
+
{
|
3067
|
+
"PR": 856,
|
3068
|
+
"Description": "修复由于 PHPSESSID 启用了 httpOnly 导致的后台不可用"
|
3069
|
+
}
|
3070
|
+
],
|
3071
|
+
"Notes": "本版本修复了由于 PHPSESSID 启用了 httpOnly 导致的后台不可用"
|
3072
|
+
},
|
3073
|
+
"2.4.0": {
|
3074
|
+
"UpdateDate": 1758956527554,
|
3075
|
+
"Prerelease": false,
|
3076
|
+
"UpdateContents": [
|
3077
|
+
{
|
3078
|
+
"PR": 856,
|
3079
|
+
"Description": "修复由于 PHPSESSID 启用了 httpOnly 导致的后台不可用"
|
3080
|
+
}
|
3081
|
+
],
|
3082
|
+
"Notes": "请尽快升级至本版本!"
|
3083
|
+
},
|
3084
|
+
"2.4.1": {
|
3085
|
+
"UpdateDate": 1759412851092,
|
3086
|
+
"Prerelease": true,
|
3087
|
+
"UpdateContents": [
|
3088
|
+
{
|
3089
|
+
"PR": 861,
|
3090
|
+
"Description": "Update CSS selector"
|
3091
|
+
}
|
3092
|
+
],
|
3093
|
+
"Notes": "No release notes were provided for this release."
|
3061
3094
|
}
|
3062
3095
|
}
|
3063
3096
|
}
|
package/XMOJ.user.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// ==UserScript==
|
2
2
|
// @name XMOJ
|
3
|
-
// @version 2.
|
3
|
+
// @version 2.4.1
|
4
4
|
// @description XMOJ增强脚本
|
5
5
|
// @author @XMOJ-Script-dev, @langningchen and the community
|
6
6
|
// @namespace https://github/langningchen
|
@@ -20,6 +20,7 @@
|
|
20
20
|
// @grant unsafeWindow
|
21
21
|
// @grant GM_setValue
|
22
22
|
// @grant GM_getValue
|
23
|
+
// @grant GM_cookie
|
23
24
|
// @homepage https://www.xmoj-bbs.me/
|
24
25
|
// @supportURL https://support.xmoj-bbs.me/form/8050213e-c806-4680-b414-0d1c48263677
|
25
26
|
// @connect api.xmoj-bbs.tech
|
@@ -479,6 +480,20 @@ let RequestAPI = (Action, Data, CallBack) => {
|
|
479
480
|
Session = Temp[i].split("=")[1];
|
480
481
|
}
|
481
482
|
}
|
483
|
+
if (Session === "") { //The cookie is httpOnly
|
484
|
+
GM.cookie.set({
|
485
|
+
name: 'PHPSESSID',
|
486
|
+
value: (Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).substring(0, 28),
|
487
|
+
path: "/"
|
488
|
+
})
|
489
|
+
.then(() => {
|
490
|
+
console.log('Reset PHPSESSID successfully.');
|
491
|
+
location.reload(); //Refresh the page to auth with the new PHPSESSID
|
492
|
+
})
|
493
|
+
.catch((error) => {
|
494
|
+
console.error(error);
|
495
|
+
});
|
496
|
+
}
|
482
497
|
let PostData = {
|
483
498
|
"Authentication": {
|
484
499
|
"SessionID": Session, "Username": CurrentUsername,
|
@@ -1010,7 +1025,17 @@ async function main() {
|
|
1010
1025
|
});
|
1011
1026
|
PopupUL.children[5].addEventListener("click", () => {
|
1012
1027
|
clearCredential();
|
1013
|
-
|
1028
|
+
GM.cookie.set({
|
1029
|
+
name: 'PHPSESSID',
|
1030
|
+
value: (Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).substring(0, 28),
|
1031
|
+
path: "/"
|
1032
|
+
})
|
1033
|
+
.then(() => {
|
1034
|
+
console.log('Reset PHPSESSID successfully.');
|
1035
|
+
})
|
1036
|
+
.catch((error) => {
|
1037
|
+
console.error(error);
|
1038
|
+
}); //We can no longer rely of the server to set the cookie for us
|
1014
1039
|
location.href = "https://www.xmoj.tech/logout.php";
|
1015
1040
|
});
|
1016
1041
|
Array.from(PopupUL.children).forEach(item => {
|
@@ -1644,6 +1669,9 @@ async function main() {
|
|
1644
1669
|
if (SubmitLink == null) {
|
1645
1670
|
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(9)');
|
1646
1671
|
}
|
1672
|
+
if (SubmitLink == null) { //为什么这个破东西老是换位置
|
1673
|
+
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(7)');
|
1674
|
+
}
|
1647
1675
|
let SubmitButton = document.createElement('button');
|
1648
1676
|
SubmitButton.id = 'SubmitButton';
|
1649
1677
|
SubmitButton.className = 'btn btn-outline-secondary';
|