Autodarts - Bearer-update

Bearer-update

このスクリプトは単体で利用できません。右のようなメタデータを含むスクリプトから、ライブラリとして読み込まれます: // @require https://update.greasyfork.org/scripts/569145/1776802/Autodarts%20-%20Bearer-update.js

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Autodarts - Bearer-update
// @namespace    http://tampermonkey.net/
// @version      0.123
// @description  Bearer-update
// @author       Greasyfork: MartinHH / AD: benebelter
// @match        https://play.autodarts.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=autodarts.io
// @require      https://code.jquery.com/jquery-3.7.1.min.js
// @license      MIT
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
 
  // Bearer
function sycn_bearer() {
let tokenCaptured = false;
  tokenCaptured = false;
  const originalOpen = XMLHttpRequest.prototype.open;
  const originalSend = XMLHttpRequest.prototype.send;
  const originalSetHeader = XMLHttpRequest.prototype.setRequestHeader;
  XMLHttpRequest.prototype.open = function (...args) {
    this._url = args[1];
    return originalOpen.apply(this, args);
  };
  XMLHttpRequest.prototype.setRequestHeader = function (key, value) {
    if (!tokenCaptured && key.toLowerCase() === 'authorization' && value.startsWith('Bearer ')) {
        window.bearer = value;
        tokenCaptured = true;
        window.bearer = value;
        GM_setValue ('bearer', value);
       GM_setValue ('bearer_ts', Date.now());
console.log('version 0.123 '+value);
    }
    return originalSetHeader.apply(this, arguments);
  };
  XMLHttpRequest.prototype.send = function (...args) {
    return originalSend.apply(this, args);
  };
}

 

 setTimeout(() => {
    sycn_bearer();
      console.log('bearer started!!');
}, Math.floor(Math.random() * 5000) );
   
 




// Refresh bearer-token
setTimeout(function() {
    if($("#tokenupdate").length == 0) {
        $('#root').append('<iframe id="tokenupdate" src="https://play.autodarts.io" style="visibility: hidden"></iframe>');

        setInterval( function() {
            $('#tokenupdate').attr("src", $('#tokenupdate').attr("src"));   }, 250000);
    }
}, 5000);
//// End Auth-bearer ///

})();