Skip to content

Commit

Permalink
Initial commit & functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Angelo <[email protected]>
  • Loading branch information
angeloanan committed Jul 30, 2020
1 parent 88db36c commit 556a957
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"json.schemas": [{
"fileMatch": [
"manifest.json"
],
"url": "https://json.schemastore.org/chrome-manifest"
}]
}
13 changes: 13 additions & 0 deletions src/chrome/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const config = {
userAgent: 'Mozilla/5.0 (SMART-TV; Linux; Tizen 5.0) AppleWebKit/538.1 (KHTML, like Gecko) Version/5.0 NativeTVAds Safari/538.1'
}

function changeUserAgent (request) {
for (let header of request.requestHeaders) {
if (header.name.toLowerCase() === "user-agent") header.value = config.userAgent
}

return { requestHeaders: request.requestHeaders }
}

chrome.webRequest.onBeforeSendHeaders.addListener(changeUserAgent, {urls: ["*://*.youtube.com/tv*"]}, ["blocking", "requestHeaders"]);
22 changes: 22 additions & 0 deletions src/chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"manifest_version": 2,

"name": "YouTube TV for Browser",
"description": "Enables YouTube TV for traditional browser",
"version": "0.1",

"permissions": [
"webRequest",
"webRequestBlocking",
"*://*.youtube.com/tv*"
],

"background": {
"scripts": [
"background.js"
]
},
"browser_action": {
"default_title": "YouTube TV for Browser"
}
}

0 comments on commit 556a957

Please sign in to comment.