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: [PATCH] [GotHub] Add GitHub gists support --- src/assets/javascripts/services.js | 1 + src/config.json | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index d0d85ac..dd8ea7a 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 36d8b86..6e97b26 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 +}