From b1eec4f2755d3396f1d9181d33d5739563005d43 Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Sat, 15 Jul 2023 18:49:17 +0500 Subject: [GotHub] Add GitHub gists support --- src/assets/javascripts/services.js | 1 + src/config.json | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index d0d85acd..dd8ea7ac 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -501,6 +501,7 @@ function redirect(url, type, initiator, forceRedirection) { 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 36d8b86f..6e97b26e 100644 --- a/src/config.json +++ b/src/config.json @@ -708,7 +708,8 @@ } }, "targets": [ - "^https?:\\/{2}github\\.com\\/" + "^https?:\\/{2}github\\.com\\/", + "^https?:\\/{2}gist.github\\.com\\/[^\\/]+\\/[^\\/]+\\/?" ], "name": "GitHub", "options": { @@ -886,4 +887,4 @@ "url": "https://www.wolframalpha.com" } } -} \ No newline at end of file +} -- cgit 1.4.1 From ddceb0454a12e878ab4b663f78756ead65e078a4 Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Sun, 16 Jul 2023 23:50:24 +0500 Subject: [GotHub] Remove /file/ path --- src/assets/javascripts/services.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index dd8ea7ac..e0b7b6df 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -493,14 +493,6 @@ 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}` } -- cgit 1.4.1 From accaac9a0cf11af8016e27951a44fab93eaf9184 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 23 Jul 2023 21:54:11 +0300 Subject: Minor tweak --- src/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/config.json b/src/config.json index 51d8c69d..47be55be 100644 --- a/src/config.json +++ b/src/config.json @@ -704,7 +704,7 @@ }, "targets": [ "^https?:\\/{2}github\\.com\\/", - "^https?:\\/{2}gist.github\\.com\\/[^\\/]+\\/[^\\/]+\\/?" + "^https?:\\/{2}gist\\.github\\.com\\/[^\\/]+\\/[^\\/]+\\/?" ], "name": "GitHub", "options": { -- cgit 1.4.1