From 9a3cebd5867c7b918deac5805bdfb44ef2035b8f Mon Sep 17 00:00:00 2001 From: hunsh Date: Tue, 16 Mar 2021 15:54:52 +0800 Subject: [PATCH] feat: add gist.github.com support --- app/main.py | 2 +- index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index e888ab0..d489423 100644 --- a/app/main.py +++ b/app/main.py @@ -27,7 +27,7 @@ exp1 = re.compile(r'^(?:https?://)?github\.com/.+?/.+?/(?:releases|archive)/.*$' exp2 = re.compile(r'^(?:https?://)?github\.com/.+?/.+?/(?:blob)/.*$') exp3 = re.compile(r'^(?:https?://)?github\.com/.+?/.+?/(?:info|git-).*$') exp4 = re.compile(r'^(?:https?://)?raw\.githubusercontent\.com/.+?/.+?/.+?/.+$') -exp5 = re.compile(r'^(?:https?://)?gist\.githubusercontent\.com/.+?/.+?/.+$') +exp5 = re.compile(r'^(?:https?://)?gist\.(?:githubusercontent|github)\.com/.+?/.+?/.+$') @app.route('/') diff --git a/index.js b/index.js index 80b0d15..805b962 100644 --- a/index.js +++ b/index.js @@ -69,7 +69,7 @@ async function fetchHandler(e) { const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob)\/.*$/i const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-).*$/i const exp4 = /^(?:https?:\/\/)?raw\.githubusercontent\.com\/.+?\/.+?\/.+?\/.+$/i - const exp5 = /^(?:https?:\/\/)?gist\.githubusercontent\.com\/.+?\/.+?\/.+$/i + const exp5 = /^(?:https?:\/\/)?gist\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+$/i if (path.search(exp1) === 0 || path.search(exp5) === 0 || !Config.cnpmjs && (path.search(exp3) === 0 || path.search(exp4) === 0)) { return httpHandler(req, path) } else if (path.search(exp2) === 0) {