about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-07-23 21:54:28 +0300
committerManeraKai <manerakai@protonmail.com>2023-07-23 21:54:28 +0300
commit5d75cb387430fecd7bd305a1e874ac9dd47cfe77 (patch)
tree76771e3d969afe86029d0ebbf2dd3a35df679ad6
parentRemoved Import/Export Sync for Chromium https://github.com/libredirect/browse... (diff)
parentMinor tweak (diff)
downloadlibredirect-5d75cb387430fecd7bd305a1e874ac9dd47cfe77.zip
Merge branch 'NoPlagiarism-gothub_gist'
-rw-r--r--src/assets/javascripts/services.js9
-rw-r--r--src/config.json5
2 files changed, 4 insertions, 10 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index 0005770d..d76a538a 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -487,14 +487,7 @@ function redirect(url, type, initiator, forceRedirection) {
 			return
 		}
 		case "gothub": {
-			const regex = /^\/(.*)\/(.*)\/(?:blob|tree)\/(.*)\/(.*)/.exec(url.pathname)
-			if (regex) {
-				const user = regex[1]
-				const repo = regex[2]
-				const branch = regex[3]
-				const path = regex[4]
-				return `${randomInstance}/file/${user}/${repo}/${branch}/${path}`
-			}
+			if (url.hostname == "gist.github.com") return `${randomInstance}/gist${url.pathname}${url.search}`
 			return `${randomInstance}${url.pathname}${url.search}`
 		}
 		case "mikuInvidious": {
diff --git a/src/config.json b/src/config.json
index 3711bf43..47be55be 100644
--- a/src/config.json
+++ b/src/config.json
@@ -703,7 +703,8 @@
 				}
 			},
 			"targets": [
-				"^https?:\\/{2}github\\.com\\/"
+				"^https?:\\/{2}github\\.com\\/",
+				"^https?:\\/{2}gist\\.github\\.com\\/[^\\/]+\\/[^\\/]+\\/?"
 			],
 			"name": "GitHub",
 			"options": {
@@ -881,4 +882,4 @@
 			"url": "https://www.wolframalpha.com"
 		}
 	}
-}
\ No newline at end of file
+}