diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..153c3a4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "json.schemas": [{ + "fileMatch": [ + "manifest.json" + ], + "url": "https://json.schemastore.org/chrome-manifest" + }] +} \ No newline at end of file diff --git a/src/chrome/background.js b/src/chrome/background.js new file mode 100644 index 0000000..cf09246 --- /dev/null +++ b/src/chrome/background.js @@ -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"]); diff --git a/src/chrome/manifest.json b/src/chrome/manifest.json new file mode 100644 index 0000000..98b78ac --- /dev/null +++ b/src/chrome/manifest.json @@ -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" + } +} \ No newline at end of file