Skip to content

imjiaoyuan/gh-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-proxy

GitHub release、archive 以及项目文件的加速代理项目,支持 git clone,提供 Cloudflare Workers 和 Python Flask 两种实现。

演示

https://github.jiaoyuan.org/

演示站为公共服务,如有大规模使用需求请自行部署。

使用

在 GitHub 文件或仓库 URL 前加 https://github.jiaoyuan.org/ 即可,也支持直接访问首页输入 URL。

以下均为合法输入:

  • 分支源码:https://github.com/user/project/archive/master.zip
  • release 源码:https://github.com/user/project/archive/v0.1.0.tar.gz
  • release 文件:https://github.com/user/project/releases/download/v0.1.0/example.zip
  • 分支文件:https://github.com/user/project/blob/master/filename
  • commit 文件:https://github.com/user/project/blob/commit/filename
  • gist:https://gist.githubusercontent.com/user/id/raw/cmd.py

访问私有仓库:

git clone https://user:TOKEN@github.jiaoyuan.org/https://github.com/user/repo

Python 版本部署

Docker

docker build -t gh-proxy-py .
docker run -d --name="gh-proxy-py" \
  -p 0.0.0.0:80:80 \
  --restart=always \
  gh-proxy-py

直接部署

pip install -r requirements.txt
python app/main.py

按需修改 app/main.py 中的配置项。

配置项

配置 说明 默认值
jsdelivr 是否将 blob/raw 文件 302 到 jsDelivr CDN 0(关闭)
size_limit 允许的最大文件大小(超出重定向至原地址) 999 GB
HOST / PORT 监听地址/端口(可通过环境变量设置) 127.0.0.1:80
white_list 白名单,每行一个 user/repo*/repo 空(全部放行)
black_list 黑名单,格式同上
pass_list 跳过代理直接 302 的仓库列表

生效顺序:白名单 → 黑名单 → pass_list

Cloudflare Workers 版本部署

  1. Cloudflare Dashboard → Workers & Pages → Create → Workers → Connect to Git
  2. 连接本仓库,branch 选 master,entry point 设 index.js
  3. 每次 push 自动部署

Worker 版本配置(在 index.js 顶部修改):

  • PREFIX — 路径前缀,默认 /
  • Config.jsdelivr — jsDelivr 镜像开关
  • whiteList — 路径白名单数组

About

github release、archive以及项目文件的加速项目

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 36.8%
  • JavaScript 33.6%
  • HTML 26.2%
  • Dockerfile 2.6%
  • Shell 0.8%