From 920f84b4eb4266896ba90045aea3641f3cc13367 Mon Sep 17 00:00:00 2001 From: FSpark Date: Sat, 10 Aug 2024 17:11:36 +0800 Subject: [PATCH] Chrome: Migrate to manifest_v3 --- addon-chrome/manifest.json | 70 ++++++++++--------- .../{background.js => service_worker.js} | 2 +- 2 files changed, 37 insertions(+), 35 deletions(-) rename addon-chrome/{background.js => service_worker.js} (95%) diff --git a/addon-chrome/manifest.json b/addon-chrome/manifest.json index b6235dc..54bb4c7 100644 --- a/addon-chrome/manifest.json +++ b/addon-chrome/manifest.json @@ -1,36 +1,38 @@ { - "description": "Chrome addon to save Tiddlywiki", - "manifest_version": 2, - "author": "Rizwan Ishak", - "name": "timimi", - "version": "2.1.3", - "icons": + "description": "Chrome addon to save Tiddlywiki", + "manifest_version": 3, + "author": "Rizwan Ishak", + "name": "timimi", + "version": "2.1.4", + "icons": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + }, + "background": { + "service_worker": "service_worker.js" + }, + "content_scripts": [ { - "16": "icons/icon16.png", - "48": "icons/icon48.png", - "128": "icons/icon128.png" - }, - "background": - { - "scripts": ["background.js"], - "persistent": true - }, - "browser_action": - { - "browser_style": true, - "default_icon": "icons/icon16.png" - }, - "content_scripts": [ - { - "matches": ["file:///*"], - "js": ["content-script.js"] - }], - "options_ui": { - "page": "settings/options.html" - }, - "permissions": [ - "nativeMessaging", - "storage", - "notifications" - ] -} + "matches": [ + "file:///*" + ], + "js": [ + "content-script.js" + ] + } + ], + "options_ui": { + "page": "settings/options.html" + }, + "permissions": [ + "nativeMessaging", + "storage", + "notifications" + ], + "action": { + "browser_style": true, + "default_icon": "icons/icon16.png" + }, + "content_security_policy": {} +} \ No newline at end of file diff --git a/addon-chrome/background.js b/addon-chrome/service_worker.js similarity index 95% rename from addon-chrome/background.js rename to addon-chrome/service_worker.js index aedbc06..d701803 100644 --- a/addon-chrome/background.js +++ b/addon-chrome/service_worker.js @@ -32,6 +32,6 @@ chrome.runtime.onInstalled.addListener(details => { }); }); -chrome.browserAction.onClicked.addListener(function() { +chrome.action.onClicked.addListener(function() { chrome.runtime.openOptionsPage(); }); \ No newline at end of file