xmoj-script 1.3.1 → 1.3.2

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/AddonScript.js CHANGED
@@ -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!");
package/Update.json CHANGED
@@ -2729,6 +2729,17 @@
2729
2729
  }
2730
2730
  ],
2731
2731
  "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."
2732
2743
  }
2733
2744
  }
2734
2745
  }
package/XMOJ.user.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // ==UserScript==
2
2
  // @name XMOJ
3
- // @version 1.3.1
3
+ // @version 1.3.2
4
4
  // @description XMOJ增强脚本
5
5
  // @author @XMOJ-Script-dev, @langningchen and the community
6
6
  // @namespace https://github/langningchen
@@ -465,10 +465,7 @@ let RequestAPI = (Action, Data, CallBack) => {
465
465
  try {
466
466
  CallBack(JSON.parse(Response.responseText));
467
467
  } catch (Error) {
468
- console.log(Response.responseText);
469
- CallBack({
470
- "Success": false, "Message": "JSON解析错误:" + Error, "Data": null
471
- });
468
+ console.error(Response.responseText);
472
469
  }
473
470
  }
474
471
  });
@@ -1153,14 +1150,13 @@ async function main() {
1153
1150
  new bootstrap.Modal(document.getElementById("UpdateModal")).show();
1154
1151
  }
1155
1152
  });
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
+ });
1164
1160
  let ToastContainer = document.createElement("div");
1165
1161
  ToastContainer.classList.add("toast-container", "position-fixed", "bottom-0", "end-0", "p-3");
1166
1162
  document.body.appendChild(ToastContainer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmoj-script",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "an improvement script for xmoj.tech",
5
5
  "main": "AddonScript.js",
6
6
  "scripts": {