about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-03-07 18:42:06 +0300
committerManeraKai <manerakai@protonmail.com>2023-03-07 18:42:06 +0300
commit4ddfca0f74d11f857426567e8dbbe7b4b09b2071 (patch)
tree840a981c60f0aa9fa5af69c56f347ccfc5d9680d /src
parentMerge branch 'master' of https://github.com/libredirect/libredirect (diff)
downloadlibredirect-4ddfca0f74d11f857426567e8dbbe7b4b09b2071.zip
Added support to subdomains for scribe https://github.com/libredirect/libredirect/issues/644
Diffstat (limited to 'src')
-rw-r--r--src/assets/javascripts/services.js10
-rw-r--r--src/config.json2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index bedc3549..07f7a522 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -181,6 +181,16 @@ function redirect(url, type, initiator, forceRedirection) {
 			}
 			return `${randomInstance}${url.pathname}${url.search}`
 		}
+		case "scribe": {
+			const regex = url.hostname.match(/^(link|cdn-images-\d+|.*)\.medium\.com/)
+			if (regex && regex.length > 1) {
+				const subdomain = regex[1]
+				if (subdomain != "link" || !subdomain.startsWith("cdn-images")) {
+					return `${randomInstance}/@${subdomain}${url.pathname}${url.search}`
+				}
+			}
+			return `${randomInstance}${url.pathname}${url.search}`
+		}
 		case "simplyTranslate": {
 			return `${randomInstance}/${url.search}`
 		}
diff --git a/src/config.json b/src/config.json
index 3bd300a8..7f2071bd 100644
--- a/src/config.json
+++ b/src/config.json
@@ -236,7 +236,7 @@
 				}
 			},
 			"targets": [
-				"^https:\\/{2}(link\\.|cdn\\-images\\-\\d+\\.)?medium\\.com",
+				"^https:\\/{2}(.*\\.)?medium\\.com",
 				"^https?:\\/{2}towardsdatascience\\.com(\\/|$)",
 				"^https?:\\/{2}uxdesign\\.cc(\\/|$)",
 				"^https?:\\/{2}uxplanet\\.org(\\/|$)",