diff --git a/apps/browser/package.json b/apps/browser/package.json index 9019d30bade..427632db333 100644 --- a/apps/browser/package.json +++ b/apps/browser/package.json @@ -4,9 +4,11 @@ "scripts": { "build": "webpack", "build:watch": "webpack --watch", + "build:watch:MV3": "cross-env MANIFEST_VERSION=3 webpack --watch", "build:prod": "cross-env NODE_ENV=production webpack", "build:prod:watch": "cross-env NODE_ENV=production webpack --watch", "dist": "npm run build:prod && gulp dist", + "dist:chromeMV3": "cross-env MANIFEST_VERSION=3 npm run build:prod && gulp dist:chrome", "dist:firefox": "npm run build:prod && gulp dist:firefox", "dist:opera": "npm run build:prod && gulp dist:opera", "dist:safari": "npm run build:prod && gulp dist:safari", diff --git a/apps/browser/src/manifest.json.v3 b/apps/browser/src/manifest.json.v3 new file mode 100644 index 00000000000..18e5db22176 --- /dev/null +++ b/apps/browser/src/manifest.json.v3 @@ -0,0 +1,129 @@ +{ + "manifest_version": 3, + "minimum_chrome_version": "102.0", + "name": "__MSG_extName__", + "short_name": "__MSG_appName__", + "version": "2022.05.0", + "description": "__MSG_extDesc__", + "default_locale": "en", + "author": "Bitwarden Inc.", + "homepage_url": "https://bitwarden.com", + "icons": { + "16": "images/icon16.png", + "32": "images/icon32.png", + "48": "images/icon48.png", + "96": "images/icon96.png", + "128": "images/icon128.png" + }, + "content_scripts": [ + { + "all_frames": true, + "js": [ + "content/autofill.js", + "content/autofiller.js", + "content/notificationBar.js", + "content/contextMenuHandler.js" + ], + "matches": ["http://*/*", "https://*/*", "file:///*"], + "run_at": "document_start" + }, + { + "all_frames": false, + "js": ["content/shortcuts.js"], + "matches": ["http://*/*", "https://*/*", "file:///*"], + "run_at": "document_start" + }, + { + "all_frames": false, + "js": ["content/message_handler.js"], + "matches": ["http://*/*", "https://*/*", "file:///*"], + "run_at": "document_start" + }, + { + "all_frames": true, + "css": ["content/autofill.css"], + "matches": ["http://*/*", "https://*/*", "file:///*"], + "run_at": "document_end" + } + ], + "background": { + "service_worker": "background.js" + }, + "action": { + "default_icon": { + "19": "images/icon19.png", + "38": "images/icon38.png" + }, + "default_title": "Bitwarden", + "default_popup": "popup/index.html" + }, + "permissions": [ + "tabs", + "contextMenus", + "storage", + "unlimitedStorage", + "clipboardRead", + "clipboardWrite", + "idle", + "webRequest", + "declarativeNetRequest" + ], + "optional_permissions": ["nativeMessaging"], + "host_permissions": ["http://*/*", "https://*/*"], + "content_security_policy": { + "extension_page": "script-src 'self' ; object-src 'self'" + }, + "commands": { + "_execute_browser_action": { + "suggested_key": { + "default": "Ctrl+Shift+Y", + "linux": "Ctrl+Shift+U" + }, + "description": "__MSG_commandOpenPopup__" + }, + "_execute_sidebar_action": { + "suggested_key": { + "default": "Alt+Shift+Y", + "linux": "Alt+Shift+U" + }, + "description": "__MSG_commandOpenSidebar__" + }, + "autofill_login": { + "suggested_key": { + "default": "Ctrl+Shift+L" + }, + "description": "__MSG_commandAutofillDesc__" + }, + "generate_password": { + "suggested_key": { + "default": "Ctrl+Shift+9" + }, + "description": "__MSG_commandGeneratePasswordDesc__" + }, + "lock_vault": { + "description": "__MSG_commandLockVaultDesc__" + } + }, + "web_accessible_resources": [ + { + "resources": [ + "notification/bar.html", + "images/icon38.png", + "images/icon38_locked.png", + "images/close.png" + ], + "matches": [""] + } + ], + "applications": { + "gecko": { + "id": "{446900e4-71c2-419f-a6a7-df9c091e268b}", + "strict_min_version": "42.0" + } + }, + "sidebar_action": { + "default_title": "Bitwarden", + "default_panel": "popup/index.html?uilocation=sidebar", + "default_icon": "images/icon19.png" + } +} diff --git a/apps/browser/webpack.config.js b/apps/browser/webpack.config.js index dc6f512ee61..23ef258de28 100644 --- a/apps/browser/webpack.config.js +++ b/apps/browser/webpack.config.js @@ -72,7 +72,9 @@ const plugins = [ }), new CopyWebpackPlugin({ patterns: [ - "./src/manifest.json", + process.env.MANIFEST_VERSION == 3 + ? { from: "./src/manifest.json.v3", to: "manifest.json" } + : "./src/manifest.json", { from: "./src/_locales", to: "_locales" }, { from: "./src/images", to: "images" }, { from: "./src/popup/images", to: "popup/images" },