diff --git a/README.md b/README.md index 5b96ccb..c8cf728 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`默认配置下项目文件会走jsDeliver,如需走worker,修改Config变量即可 +`index.js`默认配置下项目文件会走jsDelivr,如需走worker,修改Config变量即可 `ASSET_URL`是静态资源的url(实际上就是现在显示出来的那个输入框单页面) @@ -81,7 +81,7 @@ docker run -d --name="gh-proxy-py" \ python版本的机器如果无法正常访问github.io会启动报错,请自行修改静态文件url -workers版本默认配置下项目文件会走jsDeliver,_如需走服务器_,修改配置即可 +workers版本默认配置下项目文件会走jsDelivr,如需走服务器,修改配置即可 python版本默认走服务器(2021.3.27更新) diff --git a/index.js b/index.js index 5f5db09..2e0b07b 100644 --- a/index.js +++ b/index.js @@ -27,6 +27,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 @@ -59,7 +60,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 } @@ -80,7 +81,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 || (path.search(exp3) === 0 || path.search(exp4) === 0)) { + if (path.search(exp1) === 0 || path.search(exp5) === 0 || path.search(exp6) === 0 || path.search(exp3) === 0 || path.search(exp4) === 0) { return httpHandler(req, path) } else if (path.search(exp2) === 0) { if (Config.jsdelivr) {