~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/hydraulophone

An unofficial YouTube Music app for iPhone, iPad, and Mac.

0
0
main
147 lines · 4.5 KB Raw History
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title></title>
  <script>
    /*
     * Narrowly adapted from AuraMusic's po_token.html:
     * AuraMusic commit 185a77d31733047de06cbec619d40731755a0ec1.
     * The JavaScript below is intentionally self-contained. It does not
     * contain a native message bridge and does not fetch challenge URLs.
     */
    (function () {
      "use strict";

      var webPoSignalOutput = [];
      var poTokenMinter = null;
      var botGuardFunctions = null;

      window.__hydraulophonePreflight = function () {
        var baseOrigin = new URL(document.baseURI).origin;
        if (baseOrigin !== "https://www.youtube.com") {
          throw new Error("insecure origin");
        }
        if (typeof globalThis.crypto !== "object" ||
            typeof globalThis.crypto.getRandomValues !== "function") {
          throw new Error("crypto unavailable");
        }
        if (typeof globalThis.TextEncoder !== "function") {
          throw new Error("TextEncoder unavailable");
        }
        return true;
      };

      window.__hydraulophoneRunBotGuard = function (
        interpreterJavascript,
        globalName,
        program
      ) {
        return new Promise(function (resolve, reject) {
          var settled = false;
          function fail(error) {
            if (!settled) {
              settled = true;
              reject(error);
            }
          }
          function finish(response) {
            if (!settled) {
              settled = true;
              resolve({
                botguardResponse: String(response),
                signalOutputReady: typeof webPoSignalOutput[0] === "function"
              });
            }
          }

          try {
            window.__hydraulophonePreflight();
            new Function(interpreterJavascript)();
            var vm = globalThis[globalName];
            if (!vm || typeof vm.a !== "function") {
              throw new Error("BotGuard VM unavailable");
            }

            webPoSignalOutput = [];
            botGuardFunctions = null;
            var callback = function (
              asyncSnapshotFunction,
              shutdownFunction,
              passEventFunction,
              checkCameraFunction
            ) {
              botGuardFunctions = {
                asyncSnapshotFunction: asyncSnapshotFunction,
                shutdownFunction: shutdownFunction,
                passEventFunction: passEventFunction,
                checkCameraFunction: checkCameraFunction
              };

              if (typeof asyncSnapshotFunction !== "function") {
                fail(new Error("BotGuard snapshot unavailable"));
                return;
              }

              try {
                asyncSnapshotFunction(
                  finish,
                  [undefined, undefined, webPoSignalOutput, undefined]
                );
              } catch (error) {
                fail(error);
              }
            };

            vm.a(
              program,
              callback,
              true,
              undefined,
              function () {},
              [[], []]
            );
          } catch (error) {
            fail(error);
          }
        });
      };

      window.__hydraulophoneInstallMinter = async function (integrityBytes) {
        if (!Array.isArray(integrityBytes)) {
          throw new Error("integrity bytes unavailable");
        }
        if (!webPoSignalOutput || typeof webPoSignalOutput[0] !== "function") {
          throw new Error("BotGuard signal unavailable");
        }

        var integrity = new Uint8Array(integrityBytes);
        var result = webPoSignalOutput[0](integrity);
        poTokenMinter = (
          result && typeof result.then === "function"
        ) ? await result : result;
        if (typeof poTokenMinter !== "function") {
          throw new Error("BotGuard minter unavailable");
        }
        return true;
      };

      window.__hydraulophoneMint = async function (identifierBytes) {
        if (!poTokenMinter || !Array.isArray(identifierBytes)) {
          throw new Error("BotGuard minter unavailable");
        }
        var identifier = new Uint8Array(identifierBytes);
        var result = poTokenMinter(identifier);
        result = (
          result && typeof result.then === "function"
        ) ? await result : result;
        if (!(result instanceof Uint8Array)) {
          throw new Error("BotGuard token unavailable");
        }
        return Array.prototype.slice.call(result);
      };
    }());
  </script>
</head>
<body></body>
</html>