aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-05-28 08:42:52 +0300
committerManeraKai <manerakai@protonmail.com>2023-05-28 08:42:52 +0300
commitf93de9220ce0aada67e472d7d9f18fb399cfde79 (patch)
tree823e1bfba40ef4f498b9944cd087cad9937c3cd9
parentMerge pull request #719 from GlenLowland/fix_search_from_context_menu_chrome (diff)
downloadlibredirect-f93de9220ce0aada67e472d7d9f18fb399cfde79.zip
Added shortcut for Redirect To Original
Diffstat (limited to '')
-rw-r--r--src/manifest.json6
-rw-r--r--src/pages/background/background.js13
2 files changed, 19 insertions, 0 deletions
diff --git a/src/manifest.json b/src/manifest.json
index 2a8ffbb0..5bb7c0c3 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -68,6 +68,12 @@
"default": "Alt+Shift+C"
},
"description": "Copies the original link. Ex: Copies the original twitter link while in the nitter website"
+ },
+ "reverse": {
+ "suggested_key": {
+ "default": "Alt+Shift+R"
+ },
+ "description": "Redirect to the original link. Ex: Redirects to the original twitter link while in the nitter website"
}
},
"default_locale": "en",
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 7652d726..467259cd 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -97,6 +97,19 @@ browser.commands.onCommand.addListener(async command => {
else if (command == "copyRaw") {
servicesHelper.copyRaw(url)
}
+ else if (command == "reverse") {
+ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
+ if (tabs[0].url) {
+ const url = new URL(tabs[0].url)
+ const newUrl = await servicesHelper.reverse(url)
+ if (newUrl) {
+ browser.tabs.update(tabs[0].id, { url: newUrl }, () => {
+ tabIdRedirects[tabs[0].id] = false
+ })
+ }
+ }
+ })
+ }
})
})