about summary refs log tree commit diff stats
path: root/src/assets/javascripts/services.js
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-06-01 12:46:00 +0300
committerManeraKai <manerakai@protonmail.com>2023-06-01 12:46:00 +0300
commit362f6e75463716d2d67136d2b942a20849ab32a5 (patch)
tree5dbf51bee61e1e72ac72246912430a41721a11ce /src/assets/javascripts/services.js
parentAdded reverse for wikiless (diff)
downloadlibredirect-362f6e75463716d2d67136d2b942a20849ab32a5.zip
Added AnonymousOverflow reverse
Diffstat (limited to 'src/assets/javascripts/services.js')
-rw-r--r--src/assets/javascripts/services.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index 04223a7c..8cb7649c 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -642,6 +642,16 @@ async function reverse(url) {
 				}
 				return `https://wikipedia.org${url.pathname}${url.search}${url.hash}`
 			}
+			case "stackOverflow": {
+				if (url.pathname.startsWith("/questions/")) {
+					return `https://stackoverflow.com${url.pathname}${url.search}`
+				}
+				if (url.pathname.startsWith("/exchange/")) {
+					const regex = /\/exchange\/(.*?)(\/.*)/.exec(url.pathname)
+					if (regex) return `https://${regex[1]}.stackexchange.com${regex[2]}`
+				}
+				return
+			}
 			default:
 				return
 		}