Giter Site home page Giter Site logo

cgg888 / githubsoeasy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nicennnnnnnlee/githubsoeasy

0.0 0.0 0.0 23 KB

使用Cloudflare Workers代理加速Github,不仅仅是下载附件

License: MIT License

JavaScript 27.82% Python 49.06% HTML 23.13%

githubsoeasy's Introduction

GithubSoEasy 
使用Cloudflare Workers代理加速Github访问
源自 ButterAndButterfly
Butter, 寓意宅男; Butterfly, 寓意美好的事物。
美好的世界由我们创造!

完成度

  • Github页面访问
  • Github显示图片、头像
  • Github项目压缩包下载
  • Github Release附件下载
  • Git over HTTPS,可以通过类似链接https://github.com/nICEnnnnnnnLee/GithubSoEasy.git进行push、pull等操作
  • Github登录?
    /login路径提供了一个简单的设置cookie的界面, 设置以后:
    • 可访问私人repo、首页动态、Code类型搜索等大多数读操作
    • 不可以Star、Fork、更改设置等增删改操作

演示站点

https://git.n1cee.workers.dev
资源有限,仅供演示用(北京时间8点开放一小时)。

项目搭建实现的心路历程

  • 先实现单一域名github.com最粗糙的代理(只修改url)
  • 实现请求header保持一致,大致处理一下hostrefererorigin的域名
  • 实现回复header保持一致,大致处理一下30x locationx-pjax-url
  • 处理html回复中可能存在的超链接文本,对其进行替换
  • 通过F12查看网络请求,进行各种日常操作,将可能存在的域名均进行替换,并对后台进行报错处理

实现步骤

如果你会一点点python, 并且注册了账号,可以跳至辅助Python脚本

  1. 首页:https://workers.cloudflare.com

  2. 注册,登入,Start building,取一个子域名Create a Worker。

  3. 复制 index.js 到左侧代码框,修改代码并保存。

    const your_domain = '<你的自定义域名>'

    ps: 你也可以修改环境变量HOME_DOMAIN为你的域名

  4. 将worker连接到自定义域名gitgistgist-notebooksgist-ucontentrawassetsavatarscamocodeloadreleasesobject

    假设你的域名为 test.com,
    需要设置的域名为
    git.test.com
    gist.test.com
    gist-notebooks.test.com
    gist-ucontent.test.com
    raw.test.com
    assets.test.com
    avatars.test.com
    camo.test.com
    codeload.test.com
    releases.test.com
    object.test.com
    

    具体操作可以查看issue 如何Worker 连接到自定义域

辅助Python脚本

  • 你需要获取Global API Key: -> 传送门

  • 你需要以下两个文件

    • create_workers.py
    • index.js
  • 修改create_workers.py

YOUR_EMAIL = "你的邮箱"
YOUR_API_KEY = "你的全局API_KEY"
HOME_DOMAIN = "a.b.c" # 当前cloudflare账号控制的域名
  • 修改后直接运行
pip install requests
python create_workers.py

githubsoeasy's People

Contributors

nicennnnnnnlee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.