From f39b89efcb26895d0bd262e3f6670bc30e649fb9 Mon Sep 17 00:00:00 2001 From: tijl Date: Fri, 10 Feb 2023 11:20:41 +0100 Subject: [PATCH] port to firefox --- _locales/en/messages.json | 1 + manifest.json | 28 +++++++++++++++------------- popup-func.js | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 _locales/en/messages.json diff --git a/_locales/en/messages.json b/_locales/en/messages.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/_locales/en/messages.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 18a65fb..08d7ed0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,15 +1,17 @@ { - "name": "redirect", - "version": "0.1.0", - "description": "create a redirect directly", - "permissions": ["storage", "tabs"], - "background": { - "service_worker": "background.js" - }, - "action": { - "default_icon": "assets/my-icon.png", - "default_title": "redirect", - "default_popup": "popup.html" - }, - "manifest_version": 3 + "browser_action": { + "default_title": "redirect", + "default_popup": "popup.html" + }, + "content_security_policy": "script-src 'self' https://example.com; object-src 'self'", + "default_locale": "en", + "description": "create a redirect directly", + "manifest_version": 2, + "name": "redirect", + "page_action": { + "default_title": "redirect", + "default_popup": "popup.html" + }, + "permissions": ["webNavigation", "tabs"], + "version": "0.1" } \ No newline at end of file diff --git a/popup-func.js b/popup-func.js index ad9f94b..b4177e9 100644 --- a/popup-func.js +++ b/popup-func.js @@ -1,5 +1,5 @@ function newRedirect () { - chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => { + browser.tabs.query({currentWindow: true, active: true}, tabs => { let currentUrl = tabs[0].url; const url = `${config.shlinkUrl}/rest/v3/short-urls`; let sendData = {