web: Split manifest into firefox vs other

This commit is contained in:
Nathan Adams 2023-08-12 21:52:12 +02:00
parent 283a0694de
commit 353193b3e4
3 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,54 @@
{
"manifest_version": 3,
"name": "Ruffle",
"version": null, // Filled by Webpack.
"default_locale": "en",
"description": "__MSG_description__",
"homepage_url": "https://ruffle.rs/",
"browser_action": {
"default_popup": "popup.html",
"browser_style": true,
},
"background": {
"scripts": ["dist/background.js"],
"persistent": true,
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"exclude_matches": [
"https://sso.godaddy.com/*",
"https://authentication.td.com/*",
"https://*.twitch.tv/*",
"https://www.tuxedocomputers.com/*",
"https://*.taobao.com/*",
],
"js": ["dist/content.js"],
"all_frames": true,
"run_at": "document_start",
}
],
// 'wasm-eval' added by Webpack for Chrome extension.
"content_security_policy": "default-src 'self'; script-src 'self'; style-src 'unsafe-inline'; connect-src *; media-src *; img-src data:;",
"icons": {
"16": "images/icon16.png",
"32": "images/icon32.png",
"48": "images/icon48.png",
"128": "images/icon128.png",
"180": "images/icon180.png",
},
"options_ui": {
"page": "options.html",
"open_in_tab": true,
},
"permissions": [
"<all_urls>",
"storage",
"webRequest",
"webRequestBlocking",
],
"web_accessible_resources": ["*"],
}

View File

@ -81,7 +81,7 @@ function transformManifest(content, env) {
/**
* @type {import("webpack-cli").CallableOption}
*/
export default function (env, _argv) {
export default function (/** @type {Record<string, any>} */ env, _argv) {
const mode =
/** @type {import("webpack").Configuration["mode"]} */ (
process.env["NODE_ENV"]
@ -130,7 +130,9 @@ export default function (env, _argv) {
new CopyPlugin({
patterns: [
{
from: "manifest.json5",
from: env["firefox"]
? "manifest_firefox.json5"
: "manifest_other.json5",
to: "../manifest.json",
transform: (content) =>
transformManifest(