diff --git a/background.js b/background.js index 58061dc..230db28 100644 --- a/background.js +++ b/background.js @@ -90,8 +90,7 @@ if (!isDroid()) { chrome.windows.onRemoved.addListener(themeWindow); chrome.tabs.onUpdated.addListener(themeWindowByTab); chrome.tabs.onActivated.addListener(themeWindowByTab); -}else{ - +} else { } function themeWindowByTab(tabId) { diff --git a/home.css b/home.css index e9bdfe1..f2bdefe 100644 --- a/home.css +++ b/home.css @@ -282,4 +282,9 @@ li { img.readyness { height: 100%; width: auto +} +@media only screen and (max-width: 768px) { + .application-info { + display: none + } } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 9689b21..70b63c5 100644 --- a/manifest.json +++ b/manifest.json @@ -44,6 +44,7 @@ "privacy.js", "platform.js", "background.js", + "handler.js", "proxy.js", "info.js", "home.js", @@ -53,9 +54,14 @@ ] }, "protocol_handlers": [{ - "protocol": "web+rc", + "protocol": "ext+rc", "name": "RouterConsole", - "uriTemplate": "http://router.console/?%s" + "uriTemplate": "http://127.0.0.1:7657/%s" + }, + { + "protocol": "magnet", + "name": "I2PTorrent", + "uriTemplate": "http://127.0.0.1:7657/i2psnark/?nofilter_newURL=%s&action=Add&foo=Add+torrent" }], "default_locale": "en" } diff --git a/proxy.js b/proxy.js index 392c005..15d3ded 100644 --- a/proxy.js +++ b/proxy.js @@ -332,6 +332,109 @@ function checkStoredSettings(storedSettings) { //var gettingInfo = browser.proxy.settings.get({}); //gettingInfo.then(gotProxyInfo); +function proxyHost(url) { + let hostname = ""; + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; + } else { + hostname = url.split("/")[0]; + } + if (hostname == "proxy.i2p") { + return true; + } + return false; +} + +function localHost(url) { + let hostname = ""; + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; + } else { + hostname = url.split("/")[0]; + } + hostname = hostname.split(":")[0]; + if (hostname === "127.0.0.1") { + return true; + } else if (hostname === "localhost") { + return true; + } + + return false; +} + +function i2pHostName(url) { + let hostname = ""; + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; + } else { + hostname = url.split("/")[0]; + } + return hostname; +} + +function i2pHost(url) { + let hostname = i2pHostName(url); + return hostname.endsWith(".i2p"); +} + +function routerHost(url) { + let hostname = ""; + let path = ""; + function pathcheck(str) { + if (str != undefined) { + let final = str.split("/")[0]; + if (final === "i2ptunnelmgr" || final === "i2ptunnel") { + console.log("(urlcheck) application path", final); + return "i2ptunnelmgr"; + } else if (final === "i2psnark" || final === "torrents") { + console.log("(urlcheck) application path", final); + return "i2psnark"; + } else if (final === "webmail" || final === "susimail") { + console.log("(urlcheck) application path", final); + return "webmail"; + } else if ( + final === "home" || + final === "console" || + final.startsWith("config") + ) { + console.log("(urlcheck) application path", final); + return "routerconsole"; + } + } + return true; + } + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; + prefix = url.substr(0, url.indexOf("://") + 3); + path = url.replace(prefix + hostname + "/", ""); + } else if (identifyProtocolHandler(url)) { + url = identifyProtocolHandler(url); + return routerHost(url); + } else { + hostname = url.split("/")[0]; + path = url.replace(hostname + "/", ""); + } + if (hostname === "127.0.0.1:7657") { + return pathcheck(path); + } else if (hostname === "localhost:7657") { + return pathcheck(path); + } + + if (hostname === "127.0.0.1:7647") { + return pathcheck(path); + } else if (hostname === "localhost:7647") { + return pathcheck(path); + } + + if (hostname === "127.0.0.1:7070") { + return pathcheck(path); + } else if (hostname === "localhost:7070") { + return pathcheck(path); + } + + return false; +} + function update(restoredSettings) { proxy_scheme = restoredSettings.proxy_scheme; console.log("restoring proxy scheme:", proxy_scheme); diff --git a/scrub.js b/scrub.js index 39de3d7..d3bdc6a 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(anyTabFind); + var mtab = tab.then(routerTabFind); return requestDetails; } } @@ -405,102 +405,6 @@ var contextSetup = async function(requestDetails) { } }; -function i2pHostName(url) { - let hostname = ""; - if (url.indexOf("://") > -1) { - hostname = url.split("/")[2]; - } else { - hostname = url.split("/")[0]; - } - return hostname; -} - -function i2pHost(url) { - let hostname = i2pHostName(url); - return hostname.endsWith(".i2p"); -} - -function proxyHost(url) { - let hostname = ""; - if (url.indexOf("://") > -1) { - hostname = url.split("/")[2]; - } else { - hostname = url.split("/")[0]; - } - if (hostname == "proxy.i2p") { - return true; - } - return false; -} - -function localHost(url) { - let hostname = ""; - if (url.indexOf("://") > -1) { - hostname = url.split("/")[2]; - } else { - hostname = url.split("/")[0]; - } - hostname = hostname.split(":")[0]; - if (hostname === "127.0.0.1") { - return true; - } else if (hostname === "localhost") { - return true; - } - - return false; -} - -function routerHost(url) { - let hostname = ""; - let path = ""; - function pathcheck(str) { - if (str != undefined) { - let final = str.split("/")[0]; - if (final === "i2ptunnelmgr" || final === "i2ptunnel") { - console.log("(urlcheck) application path", final); - return "i2ptunnelmgr"; - } else if (final === "i2psnark" || final === "torrents") { - console.log("(urlcheck) application path", final); - return "i2psnark"; - } else if (final === "webmail" || final === "susimail") { - console.log("(urlcheck) application path", final); - return "webmail"; - } else if (final == "") { - console.log("(urlcheck) application path", final); - return "routerconsole"; - } - } - return true; - } - if (url.indexOf("://") > -1) { - hostname = url.split("/")[2]; - prefix = url.substr(0, url.indexOf("://") + 3); - path = url.replace(prefix + hostname + "/", ""); - } else { - hostname = url.split("/")[0]; - path = url.replace(hostname + "/", ""); - } - if (hostname === "127.0.0.1:7657") { - return pathcheck(path); - } else if (hostname === "localhost:7657") { - return pathcheck(path); - } - - if (hostname === "127.0.0.1:7647") { - return pathcheck(path); - } else if (hostname === "localhost:7647") { - return pathcheck(path); - } - - if (hostname === "127.0.0.1:7070") { - return pathcheck(path); - } else if (hostname === "localhost:7070") { - return pathcheck(path); - } - - return false; -} - browser.webRequest.onBeforeRequest.addListener( contextSetup, { urls: [""] },