From b85d57b9ddadee98f4ddbea3811ab58eec199c5f Mon Sep 17 00:00:00 2001 From: TravisTang Date: Fri, 22 Nov 2024 21:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcss=E5=92=8Curlopen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background.js | 4 ++++ src/manifest.json | 5 ++++- vite.config.js | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/background.js diff --git a/src/background.js b/src/background.js new file mode 100644 index 0000000..19cb5cd --- /dev/null +++ b/src/background.js @@ -0,0 +1,4 @@ +chrome.runtime.onInstalled.addListener(() => { + // 在安装后打开指定的 URL + chrome.tabs.create({ url: "https://imgfans.com/chrome-extension/welcome?installed=true" }); +}); diff --git a/src/manifest.json b/src/manifest.json index 02f229d..5923cb6 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,12 +1,15 @@ { "manifest_version": 3, "name": "Imgfans", - "version": "1.0.0", + "version": "1.0.1", "description": "Upload, share, and manage your images effortlessly. One-click upload with drag & drop support and instant sharing links.", "permissions": [ "storage", "activeTab" ], + "background": { + "service_worker": "background.js" + }, "action": { "default_popup": "popup/index.html", "default_icon": { diff --git a/vite.config.js b/vite.config.js index ef86212..708c531 100644 --- a/vite.config.js +++ b/vite.config.js @@ -81,6 +81,11 @@ export default defineConfig({ resolve(__dirname, 'dist/popup/index.html') ) + copyFiles( + resolve(__dirname, 'src/background.js'), + resolve(__dirname, 'dist/background.js') + ) + // 清理空目录 try { // 移除 dist/src/popup