From fbaf1dca30fffb0fd5b5acc02e24b101bdea6eab Mon Sep 17 00:00:00 2001 From: idk Date: Sat, 23 Nov 2019 22:17:20 -0500 Subject: [PATCH] fix tabs --- Makefile | 14 +++++++++----- debian/copyright | 1 + debian/rules | 1 - handler.js | 19 +++++++++++++++++-- manifest.json | 2 +- scrub.js | 2 +- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index abbf49e..3150e13 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ install: uninstall mkdir -p $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io \ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/i2pcontrol \ $(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384} - cp -r ./chromium/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/ cp -r ./icons/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/ cp -r ./_locales/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/ cp -r ./options/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/ @@ -37,8 +36,8 @@ clean: ## EVEN RELEASES are AMO RELEASES ## ODD RELEASES are SELFHOSTED RELEASES -MOZ_VERSION=0.44 -VERSION=0.45 +MOZ_VERSION=0.46 +VERSION=0.47 #VERSION=$(MOZ_VERSION) #VERSION=1.27 @@ -123,10 +122,15 @@ moz-submit: moz-version web-ext sign --channel listed --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true upload-xpi: - gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "./i2ppb@eyedeekay.github.io.xpi" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "./i2ppb@eyedeekay.github.io.xpi" upload-deb: - gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION).orig.tar.gz" -f "../i2psetproxy.js_$(VERSION).orig.tar.gz" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.debian.tar.xz" -f "../i2psetproxy.js_$(VERSION)-1.debian.tar.xz" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.dsc" -f "../i2psetproxy.js_$(VERSION)-1.dsc" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.changes" -f "../i2psetproxy.js_$(VERSION)-1_amd64.changes" + gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.buildinfo" -f "../i2psetproxy.js_$(VERSION)-1_amd64.buildinfo" fmt: cleancss -O1 all -O2 all --format beautify home.css -o .home.css && mv .home.css home.css diff --git a/debian/copyright b/debian/copyright index dc6bf8f..d1188a5 100644 --- a/debian/copyright +++ b/debian/copyright @@ -28,6 +28,7 @@ Files: .gitignore scrub.js window.html debian/* + * Copyright: MIT License: MIT Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/debian/rules b/debian/rules index e33ed7d..e3d91d1 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,6 @@ override_dh_auto_install: mkdir -p $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io \ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/i2pcontrol \ $$(pwd)/debian/i2psetproxy.js/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384} - cp -r ./chromium/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/ cp -r ./icons/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/ cp -r ./options/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/ cp -r ./_locales/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/ diff --git a/handler.js b/handler.js index 7ea7943..0666be8 100644 --- a/handler.js +++ b/handler.js @@ -12,13 +12,28 @@ function identifyProtocolHandler(url) { return false; } +function trimHost(url) { + let hostname = ""; + let prefix = ""; + if (url.indexOf("://") > -1) { + prefix = url.substr(0, url.indexOf("://") + 3); + hostname = url.split("/")[2]; + } else { + hostname = url.split("/")[0]; + } + let path = url.replace(prefix+hostname, "") + console.log("(handler) path", prefix+hostname, path) + return path +} + var handlerSetup = async function(requestDetails) { //console.log("checking protocol handler listener") var rwurl = identifyProtocolHandler(requestDetails.url); if (rwurl != false) { - console.log("handler rewrite URL requested", rwurl); + console.log("(handler) rewrite URL requested", rwurl); requestDetails.redirectUrl = rwurl; - requestDetails.url = rwurl; + requestDetails.url = trimHost(rwurl); + requestDetails.originUrl = trimHost(rwurl); } return requestDetails; }; diff --git a/manifest.json b/manifest.json index 1ab370d..6341866 100644 --- a/manifest.json +++ b/manifest.json @@ -24,7 +24,7 @@ ], "manifest_version": 2, "name": "__MSG_extensionName__", - "version": "0.47", + "version": "0.46", "description": "__MSG_extensionDescription__", "homepage_url": "https://github.com/eyedeekay/i2psetproxy.js", "icons": { diff --git a/scrub.js b/scrub.js index d3bdc6a..e8b500e 100644 --- a/scrub.js +++ b/scrub.js @@ -393,7 +393,7 @@ var contextSetup = async function(requestDetails) { } } else { var tab = tabGet(requestDetails.tabId); - var mtab = tab.then(routerTabFind); + var mtab = tab.then(anyTabFind); return requestDetails; } }