mirror of
https://gitee.com/chuangxxt/share-copilot
synced 2025-04-16 10:13:26 +00:00
1.0.0
This commit is contained in:
parent
23b7c3e825
commit
088c15e54b
@ -3,7 +3,7 @@
|
||||
- 作为代理服务器,中转copilot插件的API的请求
|
||||
- 支持vscode插件和jetbrains插件
|
||||
- 支持多用户共享一个token
|
||||
- 优化请求逻辑,token降低被ban概率(请别万人骑)
|
||||
- 优化请求逻辑,降低token被ban概率(别万人骑基本不可能封)
|
||||

|
||||
# 一、自行编译:
|
||||
```
|
||||
|
50
source/displayInfo.go
Normal file
50
source/displayInfo.go
Normal file
@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/nsf/termbox-go"
|
||||
"time"
|
||||
)
|
||||
|
||||
func DisplayInfo(dataGetter func() []InfoItem, exitChan chan bool) {
|
||||
err := termbox.Init()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer termbox.Close()
|
||||
termbox.SetInputMode(termbox.InputEsc)
|
||||
|
||||
for {
|
||||
err := termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
y := 0
|
||||
data := dataGetter()
|
||||
for _, item := range data {
|
||||
drawString(0, y, item.Title, item.TitleColor, termbox.ColorDefault)
|
||||
drawString(len(item.Title)+1, y, item.Value, item.ValueColor, termbox.ColorDefault)
|
||||
y++
|
||||
}
|
||||
|
||||
err = termbox.Flush()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case <-exitChan:
|
||||
return // 通过退出通道退出循环
|
||||
default:
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func drawString(x, y int, text string, fg, bg termbox.Attribute) {
|
||||
for _, char := range text {
|
||||
termbox.SetCell(x, y, char, fg, bg)
|
||||
x++
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user