port to firefox

This commit is contained in:
Tijl 2023-02-10 11:20:41 +01:00
parent daa7f81c7a
commit f39b89efcb
3 changed files with 17 additions and 14 deletions

View File

@ -0,0 +1 @@
{}

View File

@ -1,15 +1,17 @@
{ {
"name": "redirect", "browser_action": {
"version": "0.1.0", "default_title": "redirect",
"description": "create a redirect directly", "default_popup": "popup.html"
"permissions": ["storage", "tabs"], },
"background": { "content_security_policy": "script-src 'self' https://example.com; object-src 'self'",
"service_worker": "background.js" "default_locale": "en",
}, "description": "create a redirect directly",
"action": { "manifest_version": 2,
"default_icon": "assets/my-icon.png", "name": "redirect",
"default_title": "redirect", "page_action": {
"default_popup": "popup.html" "default_title": "redirect",
}, "default_popup": "popup.html"
"manifest_version": 3 },
"permissions": ["webNavigation", "tabs"],
"version": "0.1"
} }

View File

@ -1,5 +1,5 @@
function newRedirect () { function newRedirect () {
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => { browser.tabs.query({currentWindow: true, active: true}, tabs => {
let currentUrl = tabs[0].url; let currentUrl = tabs[0].url;
const url = `${config.shlinkUrl}/rest/v3/short-urls`; const url = `${config.shlinkUrl}/rest/v3/short-urls`;
let sendData = { let sendData = {