From 677a5f6259c8a312c4e0ab35cbc85bcc13dd9c34 Mon Sep 17 00:00:00 2001 From: fcying Date: Fri, 21 Jan 2022 09:32:47 +0800 Subject: [PATCH 1/2] feat: support github.com/x/x/tags --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 29a7212..2c7b21e 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,7 @@ const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob|raw)\/.*$/i const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-).*$/i const exp4 = /^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+?\/.+$/i const exp5 = /^(?:https?:\/\/)?gist\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+$/i +const exp6 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/tags.*$/i /** * @param {any} body @@ -60,7 +61,7 @@ addEventListener('fetch', e => { function checkUrl(u) { - for (let i of [exp1, exp2, exp3, exp4, exp5, ]) { + for (let i of [exp1, exp2, exp3, exp4, exp5, exp6 ]) { if (u.search(i) === 0) { return true } @@ -81,7 +82,7 @@ async function fetchHandler(e) { } // cfworker 会把路径中的 `//` 合并成 `/` path = urlObj.href.substr(urlObj.origin.length + PREFIX.length).replace(/^https?:\/+/, 'https://') - if (path.search(exp1) === 0 || path.search(exp5) === 0 || !Config.cnpmjs && (path.search(exp3) === 0 || path.search(exp4) === 0)) { + if (path.search(exp1) === 0 || path.search(exp5) === 0 || path.search(exp6) === 0 || !Config.cnpmjs && (path.search(exp3) === 0 || path.search(exp4) === 0)) { return httpHandler(req, path) } else if (path.search(exp2) === 0) { if (Config.jsdelivr) { From 23cdd2dae468c9b81216f5199b3a615cbec4e0a0 Mon Sep 17 00:00:00 2001 From: xyz8848 Date: Wed, 9 Feb 2022 08:10:01 -0600 Subject: [PATCH 2/2] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e2b5117..08d2433 100644 --- a/README.md +++ b/README.md @@ -48,9 +48,9 @@ github release、archive以及项目文件的加速项目,支持clone,有Clo 注册,登陆,`Start building`,取一个子域名,`Create a Worker`。 -复制 [index.js](https://cdn.jsdelivr.net/hunshcn/gh-proxy@master/index.js) 到左侧代码框,`Save and deploy`。如果正常,右侧应显示首页。 +复制 [index.js](https://cdn.jsdelivr.net/gh/hunshcn/gh-proxy@master/index.js) 到左侧代码框,`Save and deploy`。如果正常,右侧应显示首页。 -`index.js`默认配置下clone走github.com.cnpmjs.org,项目文件会走jsDeliver,如需走worker,修改Config变量即可 +`index.js`默认配置下clone走github.com.cnpmjs.org,项目文件会走jsDelivr,如需走worker,修改Config变量即可 `ASSET_URL`是静态资源的url(实际上就是现在显示出来的那个输入框单页面) @@ -109,4 +109,4 @@ python版本默认走服务器(2021.3.27更新) ## 捐赠 ![wx.png](https://img.maocdn.cn/img/2021/04/24/image.md.png) -![ali.png](https://www.helloimg.com/images/2021/04/24/BK9vmb.md.png) \ No newline at end of file +![ali.png](https://www.helloimg.com/images/2021/04/24/BK9vmb.md.png)