Advertisement
xpppppppaicyber

authintercept

Jun 11th, 2024
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function() {
  2.   const monkeyPatch = () => {
  3.     const origOpen = window.XMLHttpRequest.prototype.open;
  4.     window.XMLHttpRequest.prototype.open = function(method, url) {
  5.       const requestObj = {
  6.         xhrId: __ATOMRIGS_INPAGE_REQUEST_COUNTER__++,
  7.         url,
  8.         method
  9.       };
  10.       this.__atomrigs_xhr__ = requestObj;
  11.       window.postMessage({
  12.         protocol: "pga.inpage-request",
  13.         data: requestObj
  14.       });
  15.       this.addEventListener("load", function() {
  16.         if (this.responseType === "blob")
  17.           return;
  18.         try {
  19.           const res = JSON.parse(this.responseText);
  20.           const isLogin = url === "https://pixels-server.pixels.xyz/v1/auth/complete_onetime_authentication" || url === "https://pixels-server.pixels.xyz/v1/auth/complete_crypto_authentication";
  21.           if (url === "https://pixels-server.pixels.xyz/v1/auth/initialize" || isLogin) {
  22.             window.postMessage({
  23.               protocol: "pga.inpage-to-app",
  24.               func: "emit",
  25.               data: {
  26.                 ...this.__atomrigs_xhr__,
  27.                 func: "initialize-api-response",
  28.                 payload: {
  29.                   user: {
  30.                     id: res.player._id,
  31.                     name: res.player.username
  32.                   },
  33.                   isLogin
  34.                 }
  35.               }
  36.             });
  37.           }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement