diff options
author | BobIsMyManager <bimmgitsignature.nly8m@simplelogin.co> | 2022-07-22 19:39:08 +0100 |
---|---|---|
committer | BobIsMyManager <bimmgitsignature.nly8m@simplelogin.co> | 2022-07-22 19:39:08 +0100 |
commit | 3bc5cafe65caa86734f6ad9ef13d3a70f5effa4c (patch) | |
tree | fe0fa3dda40b4499f55ba936216b4d06c5fee0b5 /src/assets/javascripts/sendTargets.js | |
parent | Fix workflows issue (diff) | |
download | libredirect-3bc5cafe65caa86734f6ad9ef13d3a70f5effa4c.zip |
Make almost all instances follow new protocol structre
Closes https://github.com/libredirect/libredirect/issues/238 Closes https://github.com/libredirect/libredirect/issues/391
Diffstat (limited to 'src/assets/javascripts/sendTargets.js')
-rw-r--r-- | src/assets/javascripts/sendTargets.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/assets/javascripts/sendTargets.js b/src/assets/javascripts/sendTargets.js index cc5b348c..e414298a 100644 --- a/src/assets/javascripts/sendTargets.js +++ b/src/assets/javascripts/sendTargets.js @@ -42,6 +42,8 @@ let sendNormalCustomRedirects, sendTorRedirectsChecks, sendTorCustomRedirects, + sendI2pCustomRedirects, + sendLokiCustomRedirects, protocol, protocolFallback; @@ -57,6 +59,8 @@ function init() { "sendNormalCustomRedirects", "sendTorRedirectsChecks", "sendTorCustomRedirects", + "sendI2pCustomRedirects", + "sendLokiCustomRedirects" ], r => { disableSendTarget = r.disableSendTarget; @@ -65,6 +69,8 @@ function init() { sendNormalCustomRedirects = r.sendNormalCustomRedirects; sendTorRedirectsChecks = r.sendTorRedirectsChecks; sendTorCustomRedirects = r.sendTorCustomRedirects; + sendI2pCustomRedirects = r.sendI2pCustomRedirects; + sendLokiCustomRedirects = r.sendLokiCustomRedirects; protocol = r.protocol; protocolFallback = r.protocolFallback; resolve(); @@ -83,6 +89,8 @@ function all() { ...sendNormalCustomRedirects, ...sendTorRedirectsChecks, ...sendTorCustomRedirects, + ...sendI2pCustomRedirects, + ...sendLokiCustomRedirects ]; } @@ -95,7 +103,9 @@ function switchInstance(url, disableOverride) { if (url.pathname != '/') { resolve(); return; } let instancesList = []; - if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects]; + if (protocol == 'loki') instancesList = [...sendLokiCustomRedirects]; + else if (protocol == 'i2p') instancesList = [...sendI2pCustomRedirects]; + else if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects]; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') { instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects]; } @@ -116,7 +126,9 @@ function redirect(url, type, initiator, disableOverride) { if (!targets.some(rx => rx.test(url.href))) return; let instancesList = []; - if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects]; + if (protocol == 'loki') instancesList = [...sendLokiCustomRedirects]; + else if (protocol == 'i2p') instancesList = [...sendI2pCustomRedirects]; + else if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects]; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') { instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects]; } @@ -147,7 +159,11 @@ function initDefaults() { sendNormalCustomRedirects: [], sendTorRedirectsChecks: [...redirects.send.tor], - sendTorCustomRedirects: [] + sendTorCustomRedirects: [], + + sendI2pCustomRedirects: [], + + sendLokiCustomRedirects: [] }, () => resolve()) }) }) |