From 23b7c3e8258e406d5da8b37a0bbb36364a25764f Mon Sep 17 00:00:00 2001 From: ben Gutier Date: Sun, 10 Sep 2023 20:48:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 61 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 5aeff26..44e51d3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # share-copilot +- 作为代理服务器,中转copilot插件的API的请求 +- 支持vscode插件和jetbrains插件 +- 支持多用户共享一个token +- 优化请求逻辑,token降低被ban概率(请别万人骑) +![软件系统网络架构.png](https://img1.imgtp.com/2023/09/10/qTL8A2u9.png) +# 一、自行编译: ``` 测试环境:Linux4.18.0-305.3.1.el8.x86_64 GNU/Linux -``` -# 一、自编译: - 需要 go环境 出问题自行chatgpt - +``` ```sh wget https://dl.google.com/go/go1.21.1.linux-amd64.tar.gz tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz @@ -45,7 +48,7 @@ bash install.sh ##### 2.1 config.json文件说明 ```js -domain//绑定域名 +domain//监听域名或ip 可用nginx反代 host //ip @@ -90,15 +93,15 @@ verification//自定义验证 ### 3.启动 ``` -scop r --运行 +scop r --运行 [Esc退出] scop rb --后台运行 scop st --停止 scop v --查看状态 ``` -### 4.完整示例一: +### 4.完整例子: -config.json +##### 4.1 服务端配置修改config.json ```json { @@ -120,25 +123,51 @@ config.json } ``` -运行截图 +##### 4.2 运行成功截图: -![demo.png](https://img1.imgtp.com/2023/09/09/jNTqxhR8.png) +![微信截图_20230910202900.png](https://img1.imgtp.com/2023/09/10/TbXIaziq.png) -时间-合计请求次数: 0 | 成功次数 0 | 失败次数 0 统计次数在00:00:00归零 +[Jetbrains]:用于Jetbrains插件 +[Vscode]: 用于Vscode插件 +[User Request]: 插件请求代理服务器成功次数--统计次数在00:00:00归零 +[GithubApi request]: 代理服务器请求githubApi次数 +`正常情况下GithubApi request小于User Request,因为请求的Token 几十分钟才过期` -修改%userprofile%\AppData\Local\github-copilot\host.json +------ + +##### 4.3本地配置修改: + +**以windows为例** + +- **jetbrains插件修改:%userprofile%\AppData\Local\github-copilot\host.json** ```json { "github.com":{ - "user":"suibian", - "oauth_token":"i_am_free", + "user":"suibian",//随意填写 + "oauth_token":"i_am_free",//与上面verification对应 "dev_override":{ - "copilot_token_url":"https://api.example.com/copilot_internal/v2/token" + "copilot_token_url":"https://api.example.com/copilot_internal/v2/token" + //你的地址 } } } ``` -测试: +- **vscode插件修改:%userprofile%\.vscode\extensions\github.copilot-xxxx\dist\extension.js** + +```js +//添加下列代码,注意vscode插件更新需要重新添加,jetbrains则不用 +process.env.GITHUB_TOKEN="i_am_free"; //与上面verification对应 +process.env.GITHUB_API_URL="https://api.example.com"; //你的地址 +process.env.CODESPACES="true"; +process.env.GITHUB_SERVER_URL="https://github.com"; +``` + +------ + +##### **4.4测试成功:** ![demo2.png](https://img1.imgtp.com/2023/09/09/FHDNLixL.png) + +# 三、求投喂!谢谢您! +![微信截图_20230910204613.png](https://img1.imgtp.com/2023/09/10/G7qMbyxx.png) \ No newline at end of file