From 54036d70535c14bce9aa2ea8b91b31e14452142b Mon Sep 17 00:00:00 2001 From: boomzero Date: Mon, 10 Feb 2025 19:37:46 +0800 Subject: [PATCH 1/4] Change how we load addonscript (transition from Github pages to Cloudflare KV) + Fix *that* console error --- AddonScript.js | 7 ++++++- XMOJ.user.js | 20 ++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/AddonScript.js b/AddonScript.js index 28722a63..66dff33f 100644 --- a/AddonScript.js +++ b/AddonScript.js @@ -1 +1,6 @@ -console.log("AddonScript.js has loaded."); +/* +DO NOT MODIFY THIS FILE, +IT IS KEPT HERE FOR BACKWARD COMPATIBILITY ONLY + */ + +console.warn("Please update XMOJ-Script!"); \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 3821580f..3b1ac430 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -465,10 +465,7 @@ let RequestAPI = (Action, Data, CallBack) => { try { CallBack(JSON.parse(Response.responseText)); } catch (Error) { - console.log(Response.responseText); - CallBack({ - "Success": false, "Message": "JSON解析错误:" + Error, "Data": null - }); + console.error(Response.responseText); } } }); @@ -1153,14 +1150,13 @@ async function main() { new bootstrap.Modal(document.getElementById("UpdateModal")).show(); } }); - fetch(ServerURL + "/AddonScript.js", {cache: "no-cache"}) - .then((Response) => { - return Response.text(); - }) - .then((Response) => { - eval(Response); - }); - + RequestAPI("GetAddOnScript", {}, (Response) => { + if (Response.Success) { + eval(Response.Data["Script"]); + } else { + console.warn("Fetch AddOnScript failed: " + Response.Message); + } + }); let ToastContainer = document.createElement("div"); ToastContainer.classList.add("toast-container", "position-fixed", "bottom-0", "end-0", "p-3"); document.body.appendChild(ToastContainer); From fe514126fc3ebdadf43ede6d72206bddb6c4be5a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 10 Feb 2025 11:41:02 +0000 Subject: [PATCH 2/4] 1.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf0cc01d..36ad9922 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "1.3.1", + "version": "1.3.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 45468fc2522fcfeab2ae1651f16b4463fa6c4039 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 10 Feb 2025 11:41:03 +0000 Subject: [PATCH 3/4] Update version info to 1.3.2 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index f0d3fa62..ccac746c 100644 --- a/Update.json +++ b/Update.json @@ -2729,6 +2729,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "1.3.2": { + "UpdateDate": 1739187662695, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 778, + "Description": "Change how we load addonscript (transition from GitHub pages to Cloudflare KV) + Fix *that* console error" + } + ], + "Notes": "No release notes were provided for this release." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 3b1ac430..5c7f43e9 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 1.3.1 +// @version 1.3.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 52f1da55799da16755b3f6ac6c97bf981a7bf4c6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 10 Feb 2025 11:42:08 +0000 Subject: [PATCH 4/4] Update time and description of 1.3.2 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index ccac746c..45b5cb96 100644 --- a/Update.json +++ b/Update.json @@ -2731,7 +2731,7 @@ "Notes": "No release notes were provided for this release." }, "1.3.2": { - "UpdateDate": 1739187662695, + "UpdateDate": 1739187728351, "Prerelease": true, "UpdateContents": [ {