9 Commits
Author SHA1 Message Date
luyoyu 934820d691 update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-18 15:58:08 +00:00
luyoyu 150a88d2b5 update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-18 15:57:39 +00:00
luyoyu 4fe39fff57 update readme 2023-09-18 23:56:43 +08:00
luyoyu 04fb051b23 update README.md 2023-09-18 17:15:15 +08:00
luyoyu f134f2541b mod readme 2023-09-14 15:34:29 +08:00
luyoyu 285137ffce host----->hosts 2023-09-14 14:36:02 +08:00
luyoyu 952a31f63b update readme 2023-09-13 23:05:43 +08:00
luyoyu 89069492c7 update msg 2023-09-13 23:02:47 +08:00
luyoyu d9fef498b9 update readme 2023-09-13 23:02:26 +08:00
4 changed files with 30 additions and 25 deletions
+26 -25
View File
@@ -1,12 +1,5 @@
[中文](README.md) / [English](README-EN.md)
[中文](README.md) |[English](README-EN.md)
------
测试版已经支持全部接口代理,
所有也就是代码提示也走代理,
还在测试中。
![输入图片说明](readme/screenshots.gif)
***
# share-copilot
@@ -16,24 +9,30 @@
- 优化请求逻辑,降低suspended概率(别万人骑基本不会)
```sh
简单说一下本地插件原本的请求逻辑:
简单说一下
本地插件的请求逻辑:
1.本地插件携ghu_token请求github的API
2.返回带有时间戳的copilot的token(下面简称co_token),代码提示都是用的co_token
2.返回带有时间戳的copilot的token(下面简称co_token),
代码提示都是用的co_token
3.co_token到期->ghu_token重新请求->获得新的co_token
-------------------------------------------------------------
代理服务器代理的是 ghu_token请求 这一环节:
代理服务器的逻辑:
代理的是"ghu_token请求"这一环节
1.携ghu_token请求github的API,暂存co_token
2.多用户请求时,判断co_token有没有过期,没过期直接返回,减少ghu_token的请求次数(大约10-20分钟过期)
2.多用户请求时,判断co_token有没有过期,没过期直接返回,
减少ghu_token的请求次数(大约10-20分钟过期)
至于本地co_token,也就是代码提示没有走代理(可以代理,但是要修改插件,jetbrains的插件还要重新build)
猜测风控目前也是停留在请求ghu_token这一层
3.至于本地co_token,也就是代码提示没有走代理(可以代理,但是要修改插件,jetbrains的插件还要重新build)
猜测风控目前也只是停留在请求ghu_token这一层
"cocopilot也是代理了ghu_token请求,并没有破解插件"
```
@@ -104,7 +103,7 @@ keyPath//私钥路径-443必须
github_api_url//默认不改
token//自己的副驾驶token,可放多个,请求时随机使用
//登录插件后在%userprofile%\AppData\Local\github-copilot\host.json ghu_开头
//登录插件后在%userprofile%\AppData\Local\github-copilot\hosts.json ghu_开头
verification//自定义验证
```
@@ -168,21 +167,23 @@ scop v #查看是否运行
##### 4.2 运行成功截图:
![微信截图_20230910202900.png](https://img1.imgtp.com/2023/09/10/TbXIaziq.png)
[Jetbrains]:用于Jetbrains插件
[Vscode]: 用于Vscode插件
[User Request]: 插件请求代理服务器成功次数--统计次数在00:00:00归零
[GithubApi request]: 代理服务器请求githubApi次数
`正常情况下GithubApi request小于User Request,因为请求的Token 几十分钟才过期`
![yunxingceshi](readme/yunxingceshi.png)
```
Jetbrains -- 用于Jetbrains插件
Vscode -- 用于Vscode插件
Valid tokens: -- 配置里面有效的token数量
Succeed: -- 插件请求代理成功次数
Failed: -- 插件请求代理失败次数
GithubApi: --服务器请求gh_api次数
正常情况下 GithubApi < Succeed 因为请求的Token 几十分钟才过期
```
------
##### 4.3本地配置修改:
**以windows为例**
- **jetbrains插件修改:%userprofile%\AppData\Local\github-copilot\host.json**
- **jetbrains插件修改:%userprofile%\AppData\Local\github-copilot\hosts.json**
```json
{
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+4
View File
@@ -9,6 +9,10 @@ import (
// 控制台显示信息
func showMsg() {
fmt.Println(color.WhiteString("-----------------------------------------------------------------------"))
fmt.Println(color.HiBlueString(" _ _ _ _ \n ___| |__ __ _ _ __ ___ ___ ___ _ __ (_) | ___ | |_ \n/ __| '_ \\ / _` | '__/ _ \\_____ / __/ _ \\| '_ \\| | |/ _ \\| __|\n\\__ \\ | | | (_| | | | __/_____| (_| (_) | |_) | | | (_) | |_ \n|___/_| |_|\\__,_|_| \\___| \\___\\___/| .__/|_|_|\\___/ \\__|\n |_| \n"))
fmt.Println(color.WhiteString("[Source Code]") + "https://gitee.com/chuangxxt/share-copilot")
fmt.Println(color.WhiteString("-----------------------------------------------------------------------"))
var url = ""
if configFile.Server.Port == 80 {
url = "http://" + configFile.Server.Domain