Skip to content

Commit ac6b0b6

Browse files
authored
Merge pull request #779 from XMOJ-Script-dev/dev
2 parents c19f16e + 34397c7 commit ac6b0b6

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

AddonScript.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
console.log("AddonScript.js has loaded.");
1+
/*
2+
DO NOT MODIFY THIS FILE,
3+
IT IS KEPT HERE FOR BACKWARD COMPATIBILITY ONLY
4+
*/
5+
6+
console.warn("Please update XMOJ-Script!");

Update.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,17 @@
27292729
}
27302730
],
27312731
"Notes": "No release notes were provided for this release."
2732+
},
2733+
"1.3.2": {
2734+
"UpdateDate": 1739187728351,
2735+
"Prerelease": true,
2736+
"UpdateContents": [
2737+
{
2738+
"PR": 778,
2739+
"Description": "Change how we load addonscript (transition from GitHub pages to Cloudflare KV) + Fix *that* console error"
2740+
}
2741+
],
2742+
"Notes": "No release notes were provided for this release."
27322743
}
27332744
}
27342745
}

XMOJ.user.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name XMOJ
3-
// @version 1.3.1
3+
// @version 1.3.2
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -465,10 +465,7 @@ let RequestAPI = (Action, Data, CallBack) => {
465465
try {
466466
CallBack(JSON.parse(Response.responseText));
467467
} catch (Error) {
468-
console.log(Response.responseText);
469-
CallBack({
470-
"Success": false, "Message": "JSON解析错误:" + Error, "Data": null
471-
});
468+
console.error(Response.responseText);
472469
}
473470
}
474471
});
@@ -1153,14 +1150,13 @@ async function main() {
11531150
new bootstrap.Modal(document.getElementById("UpdateModal")).show();
11541151
}
11551152
});
1156-
fetch(ServerURL + "/AddonScript.js", {cache: "no-cache"})
1157-
.then((Response) => {
1158-
return Response.text();
1159-
})
1160-
.then((Response) => {
1161-
eval(Response);
1162-
});
1163-
1153+
RequestAPI("GetAddOnScript", {}, (Response) => {
1154+
if (Response.Success) {
1155+
eval(Response.Data["Script"]);
1156+
} else {
1157+
console.warn("Fetch AddOnScript failed: " + Response.Message);
1158+
}
1159+
});
11641160
let ToastContainer = document.createElement("div");
11651161
ToastContainer.classList.add("toast-container", "position-fixed", "bottom-0", "end-0", "p-3");
11661162
document.body.appendChild(ToastContainer);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xmoj-script",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)