about summary refs log tree commit diff stats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 467259cd..d7f96a34 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 == "redirect") {
+			browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
+				if (tabs[0].url) {
+					const url = new URL(tabs[0].url)
+					const newUrl = servicesHelper.redirect(url, "main_frame", null, true)
+					if (newUrl) {
+						browser.tabs.update(tabs[0].id, { url: newUrl }, () => {
+							tabIdRedirects[tabs[0].id] = true
+						})
+					}
+				}
+			})
+		}
 		else if (command == "reverse") {
 			browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
 				if (tabs[0].url) {