arras

Force the use of AMC(Arras.io Modified client)

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/437978/1004754/arras.js

  1. // ==UserScript==
  2. // @name arras
  3. // @namespace https://tampermonkey.net/
  4. // @version 1.0.2
  5. // @description Force the use of AMC(Arras.io Modified client)
  6. // @license MIT
  7. // @icon https://arras.io/favicon/128x128.png
  8. // @author PonyoLab
  9. // @match *://arras.io/*
  10. // @match *://arras.netlify.app/*
  11. // @grant GM_info
  12. // @run-at document-load
  13. // ==/UserScript==
  14.  
  15. (async () => {
  16.  
  17. // 変数宣言
  18. const SCRIPT = {
  19. ...GM_info.script,
  20. "name": "AMC"
  21. };
  22.  
  23. // AMC管理クラス
  24. class ArrasModifiedClientManager extends EventTarget {
  25.  
  26. // 初期処理
  27. constructor() {
  28. super();
  29. }
  30.  
  31. // スクリプト
  32. get script() {
  33. return SCRIPT;
  34. }
  35.  
  36. // 準備完了
  37. _ready() {
  38. this.dispatchEvent(new CustomEvent("ready"));
  39. }
  40.  
  41. }
  42. const amc = new ArrasModifiedClientManager();
  43. if (unsafeWindow.amc) {
  44. return;
  45. }
  46. unsafeWindow.amc = amc;
  47.  
  48. // ページの変更
  49. async function modifyPage() {
  50. console.log(`[${SCRIPT.name}]`, "Modifying page...");
  51. const response = await fetch("https://arras.io");
  52. const html = (await response.text())
  53. .replace(/<script src=\"\/bundle.js?.*\"><\/script>/, "");
  54. window.document.open();
  55. window.document.write(html);
  56. window.document.close();
  57. }
  58.  
  59. // クライアントコードの注入
  60. async function injectClient() {
  61. console.log(`[${SCRIPT.name}]`, "Injecting client code...");
  62. const response = await fetch("https://raw.githubusercontent.com/CantRunRiver/Arras-Patched/main/bundle_patched.js");
  63. const js = await response.text();
  64. return new Function(js)();
  65. }
  66.  
  67. // 実行
  68. await modifyPage();
  69. await injectClient();
  70.  
  71. // イベントの発火
  72. console.log(`[${SCRIPT.name}]`, "Succeeded!");
  73. amc._ready();
  74.  
  75. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址