mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-06-22 00:36:43 +00:00
Manifest v3
This commit is contained in:
parent
96856b02e0
commit
3d58a4fff3
3 changed files with 43 additions and 59 deletions
|
@ -1,47 +0,0 @@
|
||||||
/* eslint-disable no-undef */
|
|
||||||
// https://stackoverflow.com/a/45985333
|
|
||||||
function getBrowser() {
|
|
||||||
if (typeof chrome !== "undefined") {
|
|
||||||
if (typeof browser !== "undefined") {
|
|
||||||
return "Firefox";
|
|
||||||
} else {
|
|
||||||
return "Chrome";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return "Edge";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
chrome.webRequest.onBeforeRequest.addListener(
|
|
||||||
function (details) {
|
|
||||||
if (getBrowser() == "Chrome") {
|
|
||||||
return { redirectUrl: chrome.runtime.getURL("cadmium-playercore-shim.js") };
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Work around funky CORS behaviour on Firefox */
|
|
||||||
else if (getBrowser() == "Firefox") {
|
|
||||||
let filter = browser.webRequest.filterResponseData(details.requestId);
|
|
||||||
let encoder = new TextEncoder();
|
|
||||||
filter.onstop = () => {
|
|
||||||
fetch(browser.runtime.getURL("cadmium-playercore-shim.js")).
|
|
||||||
then(response => response.text()).
|
|
||||||
then(text => {
|
|
||||||
filter.write(encoder.encode(text));
|
|
||||||
filter.close();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
console.error("Unsupported web browser.");
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
urls: [
|
|
||||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
|
||||||
"*://www.assets.nflxext.com/*/ffe/player/html/*"
|
|
||||||
],
|
|
||||||
types: ["script"]
|
|
||||||
}, ["blocking"]
|
|
||||||
);
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 3,
|
||||||
"name": "Netflix International",
|
"name": "Netflix International",
|
||||||
"description": "Displays all available Netflix audio and subtitle tracks.",
|
"description": "Displays all available Netflix audio and subtitle tracks.",
|
||||||
"version": "2.0.17",
|
"version": "2.0.17",
|
||||||
"author": "shirt",
|
"author": "shirt",
|
||||||
"browser_action": {
|
"action": {
|
||||||
"default_icon": "img/icon128.png",
|
"default_icon": "img/icon128.png",
|
||||||
"default_popup": "pages/options.html"
|
"default_popup": "pages/options.html"
|
||||||
},
|
},
|
||||||
|
@ -29,22 +29,33 @@
|
||||||
"js": ["content_script.js"],
|
"js": ["content_script.js"],
|
||||||
"run_at": "document_start"
|
"run_at": "document_start"
|
||||||
}],
|
}],
|
||||||
"background": {
|
|
||||||
"scripts": ["background.js"]
|
|
||||||
},
|
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "pages/options.html",
|
"page": "pages/options.html",
|
||||||
"open_in_tab": true
|
"open_in_tab": true
|
||||||
},
|
},
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [{
|
||||||
"cadmium-playercore-shim.js",
|
"resources": [
|
||||||
"netflix_max_bitrate.js",
|
"cadmium-playercore-shim.js",
|
||||||
"netflix.css"
|
"netflix_max_bitrate.js",
|
||||||
],
|
"netflix.css"
|
||||||
|
],
|
||||||
|
"matches": [
|
||||||
|
"*://netflix.com/*",
|
||||||
|
"*://www.netflix.com/*"
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"declarative_net_request" : {
|
||||||
|
"rule_resources" : [{
|
||||||
|
"id": "1",
|
||||||
|
"enabled": true,
|
||||||
|
"path": "rules.json"
|
||||||
|
}]
|
||||||
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage",
|
"storage",
|
||||||
"webRequest",
|
"declarativeNetRequest"
|
||||||
"webRequestBlocking",
|
],
|
||||||
|
"host_permissions": [
|
||||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
"*://assets.nflxext.com/*/ffe/player/html/*",
|
||||||
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
||||||
"*://netflix.com/*",
|
"*://netflix.com/*",
|
||||||
|
|
20
rules.json
Normal file
20
rules.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"priority": 1,
|
||||||
|
"action": { "type": "redirect", "redirect": { "extensionPath": "/cadmium-playercore-shim.js" } },
|
||||||
|
"condition": {
|
||||||
|
"urlFilter": "*://www.assets.nflxext.com/*/ffe/player/html/*",
|
||||||
|
"resourceTypes": ["script"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"priority": 1,
|
||||||
|
"action": { "type": "redirect", "redirect": { "extensionPath": "/cadmium-playercore-shim.js" } },
|
||||||
|
"condition": {
|
||||||
|
"urlFilter": "*://assets.nflxext.com/*/ffe/player/html/*",
|
||||||
|
"resourceTypes": ["script"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Add table
Add a link
Reference in a new issue