25 Commits
Author SHA1 Message Date
luyoyu 89c6e2ffc1 2023.9.9 2023-09-09 09:59:25 +08:00
luyoyu 0b943666ad 2023.9.9 2023-09-09 09:40:04 +08:00
luyoyu 4796546eb0 2023.9.9 2023-09-09 09:31:49 +08:00
luyoyu e9f80439eb 2023.9.9 2023-09-09 09:03:29 +08:00
luyoyu f12fdbc533 Merge branch 'master' of https://gitee.com/chuangxxt/share-copilot 2023-09-09 08:55:20 +08:00
luyoyu 9f3dd9c2fd 2023.9.9 2023-09-09 08:54:17 +08:00
luyoyu ee709ef643 update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-09 00:51:56 +00:00
luyoyu a44264ee1c 2023.9.9 2023-09-09 08:44:27 +08:00
luyoyu 2133489752 2023.9.9 2023-09-09 08:08:59 +08:00
luyoyu 04b1f4965c 2023.9.9 2023-09-09 07:52:55 +08:00
luyoyu 45e48642c8 解决 README.md 冲突 2023-09-09 07:44:15 +08:00
luyoyu bb9c824b05 first commit 2023-09-09 07:38:19 +08:00
luyoyu 76b9c3c0eb update version.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 22:46:17 +00:00
luyoyu de84f79183 重命名 version.json 为 version 2023-09-08 22:45:47 +00:00
luyoyu b63776ea8b update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 22:18:03 +00:00
luyoyu 24f285d8fe update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 22:16:24 +00:00
luyoyu bd5143b8bb 删除文件 微信截图_20230909055557.png 2023-09-08 22:07:05 +00:00
luyoyu 7801c29fdb 删除文件 qrcode.jpg 2023-09-08 22:06:59 +00:00
luyoyu 015c27c65e 删除文件 demo.png 2023-09-08 22:06:53 +00:00
luyoyu ee7d0ae9ac 删除文件 demo2.png 2023-09-08 22:06:46 +00:00
luyoyu 0bd5c308b1 update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 22:06:27 +00:00
luyoyu f76260ed6f update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 22:05:53 +00:00
luyoyu b8c51714ba update README.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 21:58:25 +00:00
luyoyu 4260a9e0fd update README.md.
.

Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-08 21:46:30 +00:00
luyoyu d905ce09c0 first commit 2023-09-09 05:42:24 +08:00
2 changed files with 11 additions and 49 deletions
+9 -38
View File
@@ -3,40 +3,15 @@
```
测试环境: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
vim ~/.bashrc
#添加下列环境
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
#使生效环境变量
source ~/.bashrc
#验证安装
go version
#cd到main.go源码目录
cd /share-copilot/source
go build
```
# 二、使用现成:
### 1.安装
```sh
git clone https://gitlab.com/luyoyu/share-copilot.git
```
```sh
git clone https://gitee.com/chuangxxt/share-copilot.git
```
```
cd share-copilot
```
```sh
```
bash install.sh
```
@@ -126,18 +101,14 @@ config.json
时间-合计请求次数: 0 | 成功次数 0 | 失败次数 0 统计次数在00:00:00归零
修改%userprofile%\AppData\Local\github-copilot\host.json
```json
{
"github.com":{
"user":"suibian",
"oauth_token":"i_am_free",
"dev_override":{
"copilot_token_url":"https://api.example.com/copilot_internal/v2/token"
}
}
}
{"github.com":{"user":"suibian","oauth_token":"i_am_free","dev_override":{"copilot_token_url":"https://api.example.com/copilot_internal/v2/token"}}}
```
测试:
+2 -11
View File
@@ -12,13 +12,11 @@ import (
"math/rand"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
)
type Config struct {
Server struct {
Domain string `json:"domain"`
@@ -33,14 +31,12 @@ type Config struct {
} `json:"copilot_config"`
Verification string `json:"verification"`
}
var (
requestCountMutex sync.Mutex
requestCount int
successCount int
configFile = Config{}
)
func main() {
gin.SetMode(gin.ReleaseMode)
gin.DefaultWriter = io.Discard
@@ -156,13 +152,7 @@ func initConfig() Config {
// 设置日志输出到文件
log.SetOutput(logFile)
// 读取配置文件
exePath, err := os.Executable()
if err != nil {
panic(err)
}
// 获取可执行文件所在目录
exeDir := filepath.Dir(exePath)
configFile, err := os.Open(exeDir + "/config.json")
configFile, err := os.Open("./config.json")
if err != nil {
panic("file \"./config.json\" not found")
}
@@ -222,6 +212,7 @@ func showRequestCount() {
countStr := fmt.Sprintf("\x1b[34m%d\x1b[0m", count)
// 绿色文本
successCountStr := fmt.Sprintf("\x1b[32m%d\x1b[0m", sCount)
// 红色文本
failureCountStr := fmt.Sprintf("\x1b[31m%d\x1b[0m", count-sCount)
fmt.Printf("\033[1G%s - Total Count: %s | Success Count %s | Fail Count %s ", timeStr, countStr, successCountStr, failureCountStr)
}