From 250da4fd282a0d13b2c20e054f08a5a12f2e7a98 Mon Sep 17 00:00:00 2001 From: IndieKKY Date: Tue, 28 Nov 2023 10:30:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0firefox=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fixFirefox.cjs | 22 ++++++++++++++++++++++ package.json | 7 ++++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 fixFirefox.cjs diff --git a/fixFirefox.cjs b/fixFirefox.cjs new file mode 100644 index 0000000..af9b823 --- /dev/null +++ b/fixFirefox.cjs @@ -0,0 +1,22 @@ +console.log('fixFirefox.js loaded'); + +const fs = require('fs') + +const manifest = require('./dist/manifest.json') +manifest.web_accessible_resources[0].resources.push('index.html') +manifest.action.default_popup = 'popup.html' +//browser_specific_settings +manifest.browser_specific_settings = { + "gecko": { + "id": "bilibili-subtitle@indiekky" + } +} +//background +manifest.background = { + type: "module", + scripts: [manifest.background.service_worker] +} +//写回文件 +fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2)) + +console.log('fixFirefox.js done'); diff --git a/package.json b/package.json index bd91552..dde334c 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,10 @@ "main": "index.js", "scripts": { "dev": "vite", - "build_chrome": "tsc && vite build -m production_chrome && pnpm run fixChrome", - "fix": "eslint --fix --quiet .", - "fixChrome": "node fixChrome.cjs" + "build": "tsc && vite build -m production_chrome", + "build_chrome": "pnpm run build && node fixChrome.cjs", + "build_firefox": "pnpm run build && node fixFirefox.cjs", + "fix": "eslint --fix --quiet ." }, "author": "IndieKKY", "license": "MIT",