Guest User

Meh

a guest
Nov 3rd, 2020
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //TODO: Figure out how to get the `sig` parameter (signature) which looks like SHA1 or HMACSHA1 of the token..
  2. //      Twitch Server verifies that the URL is correct by checking its signature.
  3. function rewriteURL(uri) {
  4.         var url = new URL(uri);
  5.         var parameters = url.searchParams;
  6.         if (parameters && parameters.get('token')) {
  7.             var jso = JSON.parse(parameters.get('token'));
  8.             if (!jso.server_ads && !jso.show_ads && jso.hide_ads) {
  9.                 return null;
  10.             }
  11.            
  12.             jso.adblock = false;
  13.             jso.authorization.forbidden = false;
  14.             jso.authorization.reason = "";
  15.             jso.hide_ads = true;
  16.             jso.player_type = "site";
  17.             jso.server_ads = false;
  18.             jso.show_ads = false;
  19.             jso.user_ip = "127.0.0.1";
  20.             jso.modified = true;
  21.             url.searchParams.set('token', JSON.stringify(jso));
  22.             return url.toString();
  23.         }
  24.         return null;
  25.       }
Advertisement
Add Comment
Please, Sign In to add comment