switch back to manifest v2

This commit is contained in:
ivan grachev 2023-12-18 02:16:39 +03:00
parent 925be95237
commit f0b69c8b4f
3 changed files with 14 additions and 24 deletions

View File

@ -151,13 +151,7 @@ function mobileRedirectFor(request, sendResponse) {
const query = encodeURIComponent(JSON.stringify(request)); const query = encodeURIComponent(JSON.stringify(request));
browser.tabs.getCurrent((tab) => { browser.tabs.getCurrent((tab) => {
if (tab) { if (tab) {
browser.scripting.executeScript({ browser.tabs.executeScript(tab.id, { code: 'window.location.href = `https://tokenary.io/extension?query=' + query + '`;' });
target: { tabId: tab.id },
func: (query) => {
window.location.href = `https://tokenary.io/extension?query=${query}`;
},
args: [query]
}).then(() => {}).catch(() => {});
sendResponse(); sendResponse();
} }
}); });
@ -171,7 +165,7 @@ function genId() {
function addListeners() { function addListeners() {
browser.runtime.onMessage.addListener(handleOnMessage); browser.runtime.onMessage.addListener(handleOnMessage);
browser.action.onClicked.addListener(handleOnClick); browser.browserAction.onClicked.addListener(handleOnClick);
} }
addListeners(); addListeners();

View File

@ -1,5 +1,5 @@
{ {
"manifest_version": 3, "manifest_version": 2,
"default_locale": "en", "default_locale": "en",
"name": "__MSG_extension_name__", "name": "__MSG_extension_name__",
@ -15,7 +15,8 @@
}, },
"background": { "background": {
"service_worker": "service_worker.js" "scripts": [ "service_worker.js" ],
"persistent": false
}, },
"content_scripts": [{ "content_scripts": [{
@ -25,7 +26,7 @@
"js": [ "ios_specific_content.js", "content.js" ] "js": [ "ios_specific_content.js", "content.js" ]
}], }],
"action": { "browser_action": {
"default_icon": { "default_icon": {
"16": "images/toolbar-icon-16.png", "16": "images/toolbar-icon-16.png",
"19": "images/toolbar-icon-19.png", "19": "images/toolbar-icon-19.png",
@ -35,7 +36,6 @@
}, },
"permissions": [ "permissions": [
"scripting",
"nativeMessaging", "nativeMessaging",
"storage", "storage",
"activeTab", "activeTab",
@ -49,8 +49,5 @@
"tokenary://*" "tokenary://*"
], ],
"web_accessible_resources": [{ "web_accessible_resources": [ "inpage.js" ]
"resources": [ "inpage.js" ],
"matches": ["<all_urls>"]
}]
} }

View File

@ -1,5 +1,5 @@
{ {
"manifest_version": 3, "manifest_version": 2,
"default_locale": "en", "default_locale": "en",
"name": "__MSG_extension_name__", "name": "__MSG_extension_name__",
@ -15,7 +15,8 @@
}, },
"background": { "background": {
"service_worker": "service_worker.js" "scripts": [ "service_worker.js" ],
"persistent": false
}, },
"content_scripts": [{ "content_scripts": [{
@ -25,7 +26,7 @@
"js": [ "macos_specific_content.js", "content.js" ] "js": [ "macos_specific_content.js", "content.js" ]
}], }],
"action": { "browser_action": {
"default_icon": { "default_icon": {
"16": "images/toolbar-icon-16.png", "16": "images/toolbar-icon-16.png",
"19": "images/toolbar-icon-19.png", "19": "images/toolbar-icon-19.png",
@ -37,7 +38,8 @@
"permissions": [ "permissions": [
"nativeMessaging", "nativeMessaging",
"storage", "storage",
"activeTab" "activeTab",
"tabs"
], ],
"host_permissions": [ "host_permissions": [
@ -46,8 +48,5 @@
"https://tokenary.io/*" "https://tokenary.io/*"
], ],
"web_accessible_resources": [{ "web_accessible_resources": [ "inpage.js" ]
"resources": [ "inpage.js" ],
"matches": ["<all_urls>"]
}]
} }