From 55f30b993afcd3177d4196ff907ff8cffa1fe92d Mon Sep 17 00:00:00 2001 From: Fan-Wu Geoffrey Yang Date: Fri, 13 Jan 2023 13:34:44 +1300 Subject: [PATCH] first commit --- README.md | 1 + content.js | 30 ++++++++++++++++++++++++++++++ manifest.json | 13 +++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 README.md create mode 100644 content.js create mode 100644 manifest.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..abe7086 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +This Chrome extension allows you to access goplay.anontpp.com without needing to go through reddit. \ No newline at end of file diff --git a/content.js b/content.js new file mode 100644 index 0000000..cfc1812 --- /dev/null +++ b/content.js @@ -0,0 +1,30 @@ +chrome.webRequest.onBeforeSendHeaders.addListener(function callback(details){ + //console.log(JSON.stringify(details)); + var headers = details.requestHeaders, + blockingResponse = {}; + var newRef = "https://www.reddit.com/r/koreanvariety/comments/723mtd/i_created_this_website_that_streams_korean_shows/"; + var hasRef = false; + + // Each header parameter is stored in an array. Since Chrome + // makes no guarantee about the contents/order of this array, + // you'll have to iterate through it to find for the + // 'User-Agent' element + for( var i = 0, l = headers.length; i < l; ++i ) { + + if( headers[i].name == 'Referer' ) { + //headers[i].value = newRef; + hasRef = true; + break; + } + // If you want to modify other headers, this is the place to + // do it. Either remove the 'break;' statement and add in more + // conditionals or use a 'switch' statement on 'headers[i].name' + } + if (!hasRef) { + headers.push({name:"Referer", value:newRef}); + } + // } + blockingResponse.requestHeaders = headers; + return blockingResponse; +}, +{urls: [ "https://goplay.anontpp.com/" ]},['requestHeaders','blocking']); diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..a454cef --- /dev/null +++ b/manifest.json @@ -0,0 +1,13 @@ +{ +"manifest_version": 2, + "name": "GoPlay KDrama Reddit bypass", + "description": "Bypasses the need to have to go to reddit everytime the token dies.", + "version": "1.0", + "permissions": [ + "","webRequest","webRequestBlocking" + ], + "background": { + "scripts": ["content.js"], + "persistent": true + } +} \ No newline at end of file