From ef29e2c4ce87617ac9d288ed7d04e147fd6c93e4 Mon Sep 17 00:00:00 2001 From: Ilian Sapundshiev Date: Tue, 30 Apr 2024 23:07:03 +0200 Subject: [PATCH] separating manifest for chrome and firefox extensions --- src/manifest-v3.json | 53 --------------------------------------- src/manifest.chrome.json | 31 +++++++++++------------ src/manifest.firefox.json | 31 +++++++++++++++-------- src/static/popup.html | 1 - utils/patch-version.js | 11 ++++---- webpack.config.js | 5 +++- 6 files changed, 44 insertions(+), 88 deletions(-) delete mode 100644 src/manifest-v3.json diff --git a/src/manifest-v3.json b/src/manifest-v3.json deleted file mode 100644 index e0ffb23..0000000 --- a/src/manifest-v3.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "__MSG_appName__", - "short_name": "TagSpaces", - "version": "0.0.0.0", - "manifest_version": 3, - "homepage_url": "https://www.tagspaces.org", - "description": "__MSG_appDesc__", - "permissions": [ - "", - "pageCapture", - "tabs", - "downloads", - "activeTab", - "storage", - "scripting" - ], - "content_security_policy": {}, - "default_locale": "en_US", - "action": { - "default_icon": "images/icon-128.png", - "default_title": "__MSG_appLauncher__", - "default_popup": "popup.html" - }, - "icons": { - "16": "images/icon-16.png", - "48": "images/icon-48.png", - "128": "images/icon-128.png" - }, - "host_permissions": ["http://*/", "https://*/", ""], - "background": { - "service_worker": "service-worker.dist.js", - "scripts": ["service-worker.dist.js"] - }, - "commands": { - "_execute_action": { - "description": "Save page", - "suggested_key": { - "windows": "Ctrl+Shift+S", - "mac": "Command+Shift+S", - "chromeos": "Ctrl+Shift+S", - "linux": "Ctrl+Shift+S" - } - } - }, - "options_ui": { - "page": "options.html" - }, - "browser_specific_settings": { - "gecko": { - "id": "jid1-FBaMKxTifTSahQ@jetpack" - } - } -} diff --git a/src/manifest.chrome.json b/src/manifest.chrome.json index 1af8fa5..3631f63 100644 --- a/src/manifest.chrome.json +++ b/src/manifest.chrome.json @@ -2,45 +2,42 @@ "name": "__MSG_appName__", "short_name": "TagSpaces", "version": "0.0.0.0", - "version_name": "0.0.0.0", - "manifest_version": 2, + "manifest_version": 3, + "homepage_url": "https://www.tagspaces.org", "description": "__MSG_appDesc__", "permissions": [ - "", "pageCapture", + "tabs", "downloads", "activeTab", - "storage" + "storage", + "scripting" ], + "content_security_policy": {}, "default_locale": "en_US", - "browser_action": { + "action": { "default_icon": "images/icon-128.png", "default_title": "__MSG_appLauncher__", - "default_popup": "popup.html", - "browser_style": true + "default_popup": "popup.html" }, "icons": { "16": "images/icon-16.png", "48": "images/icon-48.png", "128": "images/icon-128.png" }, + "host_permissions": ["http://*/", "https://*/", ""], "background": { - "scripts": ["vendor/browser-polyfill.js", "background.dist.js"], - "persistent": false + "service_worker": "service-worker.dist.js" }, "commands": { - "_execute_browser_action": { - "description": "Save page", + "_execute_action": { "suggested_key": { - "windows": "Ctrl+Shift+S", - "mac": "Command+Shift+S", - "chromeos": "Ctrl+Shift+S", - "linux": "Ctrl+Shift+S" + "default": "Ctrl+Shift+S", + "mac": "Command+Shift+S" } } }, "options_ui": { "page": "options.html" - }, - "homepage_url": "https://www.tagspaces.org" + } } diff --git a/src/manifest.firefox.json b/src/manifest.firefox.json index e65c33a..fa4c361 100644 --- a/src/manifest.firefox.json +++ b/src/manifest.firefox.json @@ -1,38 +1,49 @@ { "name": "__MSG_appName__", + "short_name": "TagSpaces", "version": "0.0.0.0", - "manifest_version": 2, + "manifest_version": 3, + "homepage_url": "https://www.tagspaces.org", "description": "__MSG_appDesc__", "permissions": [ "", + "pageCapture", "tabs", "downloads", - "contextMenus", "activeTab", - "storage" + "storage", + "scripting" ], + "content_security_policy": {}, "default_locale": "en_US", - "browser_action": { + "action": { "default_icon": "images/icon-128.png", "default_title": "__MSG_appLauncher__", - "default_popup": "popup.html", - "browser_style": true + "default_popup": "popup.html" }, "icons": { "16": "images/icon-16.png", "48": "images/icon-48.png", "128": "images/icon-128.png" }, + "host_permissions": ["http://*/", "https://*/", ""], "background": { - "scripts": ["background.dist.js"] + "scripts": ["service-worker.dist.js"] + }, + "commands": { + "_execute_action": { + "suggested_key": { + "default": "Ctrl+Shift+S", + "mac": "Command+Shift+S" + } + } }, "options_ui": { "page": "options.html" }, - "applications": { + "browser_specific_settings": { "gecko": { "id": "jid1-FBaMKxTifTSahQ@jetpack" } - }, - "homepage_url": "https://www.tagspaces.org" + } } diff --git a/src/static/popup.html b/src/static/popup.html index ba3ac92..76429eb 100644 --- a/src/static/popup.html +++ b/src/static/popup.html @@ -220,7 +220,6 @@ - diff --git a/utils/patch-version.js b/utils/patch-version.js index 77f6507..3ee11ba 100644 --- a/utils/patch-version.js +++ b/utils/patch-version.js @@ -1,11 +1,10 @@ -const sh = require('shelljs'); -const packageJSON = require('../package.json'); +const sh = require("shelljs"); +const packageJSON = require("../package.json"); const currentVersion = packageJSON.version; // const path = require('path'); -console.log('Patching with version: ' + currentVersion); +console.log("Patching with version: " + currentVersion); // sh.cd('build/chrome') -sh.sed('-i', '0.0.0.0', currentVersion, 'build/chrome/manifest.json'); -sh.sed('-i', '0.0.0.0', currentVersion, 'build/firefox/manifest.json'); - +sh.sed("-i", "0.0.0.0", currentVersion, "build/chrome/manifest.json"); +sh.sed("-i", "0.0.0.0", currentVersion, "build/firefox/manifest.json"); diff --git a/webpack.config.js b/webpack.config.js index e252552..5790220 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -32,7 +32,10 @@ let config = { { from: "./static/", to: "./" }, { from: "../LICENSE", to: "./" }, { from: "../_locales/", to: "./_locales" }, - { from: `./manifest-v3.json`, to: `./manifest.json` }, + { + from: `./manifest.${process.env.TARGET}.json`, + to: `./manifest.json`, + }, { from: "../src/lib/openlocationcode.js", to: "./vendor/" }, { from: "../node_modules/open-location-code/LICENSE",