Skip to content

Commit

Permalink
完善下载功能和阻塞
Browse files Browse the repository at this point in the history
  • Loading branch information
UlinoyaPed committed Aug 14, 2023
1 parent a36df5e commit 7cafffe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*.out
releases/
yaml/QuickClashSub.yaml
*.zip

# Dependency directories (remove the comment below to include it)
# vendor/
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"os/signal"
"time"

"github.com/dablelv/go-huge-util/zip"
Expand All @@ -22,6 +23,7 @@ func init() {
_, err := os.Stat(QuickClashYml)
// 如果文件不存在则下载
if err != nil {
os.Mkdir("config", os.ModePerm)
color.FgLightBlue.Println("配置文件不存在,正在下载...")
Download(RepoBaseUrl+QuickClashYml, QuickClashYml)
}
Expand Down Expand Up @@ -88,6 +90,7 @@ func main() {
color.BgLightBlue.Println("您没有填写 quickclash.sublink 字段,请在此处输入")
fmt.Scanln(&SubUrl)
}
os.Mkdir("yaml", os.ModePerm)
color.BgLightBlue.Println("正在下载配置文件,请稍等")
err = Download(SubUrl, QuickClashSubYml)
if err != nil {
Expand Down Expand Up @@ -149,5 +152,9 @@ func main() {
color.BgLightRed.Printf("管理面板已启动,请访问 localhost%s\n", GinPort)

// 阻止主协程退出,以保持Gin服务的运行
select {}
//select {}
c := make(chan os.Signal)
signal.Notify(c)
s := <-c
fmt.Println("get signal: ", s)
}
2 changes: 1 addition & 1 deletion vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

const (
QuickClashYml = "config/QuickClash.yml"
RepoBaseUrl = "https://ghproxy.com/https://gitgub.com/UlinoyaPed/QuickClash/raw/master/"
RepoBaseUrl = "https://ghproxy.com/https://github.com/UlinoyaPed/QuickClash/raw/master/"
ReleaseBaseUrl = "https://ghproxy.com/https://github.com/UlinoyaPed/QuickClash/releases/download/v0.1/"
QuickClashSubYml = "yaml/QuickClashSub.yaml"
ClashMetaCore = "clash.meta.exe"
Expand Down

0 comments on commit 7cafffe

Please sign in to comment.