Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TODO: Figure out how to get the `sig` parameter (signature) which looks like SHA1 or HMACSHA1 of the token..
- // Twitch Server verifies that the URL is correct by checking its signature.
- function rewriteURL(uri) {
- var url = new URL(uri);
- var parameters = url.searchParams;
- if (parameters && parameters.get('token')) {
- var jso = JSON.parse(parameters.get('token'));
- if (!jso.server_ads && !jso.show_ads && jso.hide_ads) {
- return null;
- }
- jso.adblock = false;
- jso.authorization.forbidden = false;
- jso.authorization.reason = "";
- jso.hide_ads = true;
- jso.player_type = "site";
- jso.server_ads = false;
- jso.show_ads = false;
- jso.user_ip = "127.0.0.1";
- jso.modified = true;
- url.searchParams.set('token', JSON.stringify(jso));
- return url.toString();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment