diff options
author | ManeraKai <manerakai@protonmail.com> | 2023-05-30 14:32:45 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2023-05-30 14:32:45 +0300 |
commit | f3289e9ca4c9194d7c737aa7e63a63573ac480c7 (patch) | |
tree | 8b96d2f88b81511deb3949eb5543c6360a9be085 /src | |
parent | Added Intellectual https://github.com/libredirect/browser_extension/issues/699 (diff) | |
download | libredirect-f3289e9ca4c9194d7c737aa7e63a63573ac480c7.zip |
Tweaked Wayback Classic https://github.com/libredirect/browser_extension/issues/721
Diffstat (limited to 'src')
-rw-r--r-- | src/assets/javascripts/services.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index c3f6a4e2..28fb334a 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -477,12 +477,18 @@ function redirect(url, type, initiator, forceRedirection) { return `${randomInstance}${url.pathname}${url.search}` } case "waybackClassic": { - const regex = /^\/\web\/[0-9]+\*\/(.*)/.exec(url.pathname) + const regex = /^\/\web\/(?:[0-9]+)?\*\/(.*)/.exec(url.pathname) if (regex) { const link = regex[1] return `${randomInstance}/cgi-bin/history.cgi?utf8=✓&q=${encodeURIComponent(link)}` } - return `${randomInstance}` + const regex2 = /(^\/\web\/([0-9]+)\/.*)/.exec(url.pathname) + if (regex2) { + let link = regex2[1] + link = link.replace(regex2[2], regex2[2] + 'if_') + return `https://web.archive.org${link}` + } + return } case "gothub": { const regex = /^\/(.*)\/(.*)\/(?:blob|tree)\/(.*)\/(.*)/.exec(url.pathname) |