diff --git a/src/assets/rules.json b/src/assets/rules.json new file mode 100644 index 0000000..6c0c37f --- /dev/null +++ b/src/assets/rules.json @@ -0,0 +1,20 @@ +[ + { + "id": 1, + "priority": 1, + "action": { + "type": "modifyHeaders", + "requestHeaders": [ + { + "header": "Origin", + "operation": "set", + "value": "https://app.screenlyapp.com" + } + ] + }, + "condition": { + "urlFilter": "https://api.screenlyapp.com/api/*", + "resourceTypes": ["xmlhttprequest"] + } + } +] diff --git a/src/manifest-chrome.json b/src/manifest-chrome.json index d3cd237..2479907 100644 --- a/src/manifest-chrome.json +++ b/src/manifest-chrome.json @@ -12,8 +12,18 @@ "activeTab", "storage", "scripting", - "cookies" + "cookies", + "declarativeNetRequest" ], + "declarative_net_request": { + "rule_resources": [ + { + "id": "screenly_api_rules", + "enabled": true, + "path": "assets/rules.json" + } + ] + }, "host_permissions": [ "http://*/*", "https://*/*" diff --git a/src/manifest-firefox.json b/src/manifest-firefox.json index 09eae82..664e344 100644 --- a/src/manifest-firefox.json +++ b/src/manifest-firefox.json @@ -12,8 +12,18 @@ "activeTab", "storage", "scripting", - "cookies" + "cookies", + "declarativeNetRequest" ], + "declarative_net_request": { + "rule_resources": [ + { + "id": "screenly_api_rules", + "enabled": true, + "path": "assets/rules.json" + } + ] + }, "host_permissions": [ "http://*/*", "https://*/*" diff --git a/webpack.common.js b/webpack.common.js index 6e947b2..f1434fa 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -69,6 +69,14 @@ module.exports = { }, ], }), + new CopyWebpackPlugin({ + patterns: [ + { + from: "src/assets/rules.json", + to: "assets/rules.json", + }, + ], + }), new HtmlWebpackPlugin({ filename: 'popup.html', template: './src/popup.html',