Skip to content

Commit 272ea12

Browse files
committed
Release v1.9.6
1 parent 01912d0 commit 272ea12

File tree

14 files changed

+250
-231
lines changed

14 files changed

+250
-231
lines changed

bridge/bridge.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func InitBridge(fs embed.FS) {
7878
fileName := file.Name()
7979
path := GetPath(icon_dst + "/" + fileName)
8080
if _, err := os.Stat(path); os.IsNotExist(err) {
81-
log.Printf("InitTray [Icon]: %s", icon_dst+"/"+fileName)
81+
log.Printf("InitResources [Icon]: %s", icon_dst+"/"+fileName)
8282
b, _ := fs.ReadFile(icon_src + "/" + fileName)
8383
os.WriteFile(path, b, os.ModePerm)
8484
}
@@ -88,7 +88,7 @@ func InitBridge(fs embed.FS) {
8888
fileName := file.Name()
8989
path := GetPath(img_dst + "/" + fileName)
9090
if _, err := os.Stat(path); os.IsNotExist(err) {
91-
log.Printf("InitTray [Imgs]: %s", img_dst+"/"+fileName)
91+
log.Printf("InitResources [Imgs]: %s", img_dst+"/"+fileName)
9292
b, _ := fs.ReadFile(img_src + "/" + fileName)
9393
os.WriteFile(path, b, os.ModePerm)
9494
}

bridge/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (a *App) ExecBackground(path string, args []string, outEvent string, endEve
9494
}
9595
text := scanner.Text()
9696
if options.StopOutputKeyword != "" {
97-
if strings.Contains(strings.ToLower(text), options.StopOutputKeyword) {
97+
if strings.Contains(text, options.StopOutputKeyword) {
9898
atomic.StoreInt32(&keywordFound, 1)
9999
runtime.EventsEmit(a.Ctx, outEvent, text)
100100
continue

bridge/mmdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (a *App) QueryMMDB(path string, ip string, types string) FlagResult {
8888
return FlagResult{false, "Database file is not open: " + path}
8989
}
9090

91-
var record interface{}
91+
var record any
9292
var err error
9393
switch types {
9494
case "ASN":

bridge/net.go

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (a *App) Requests(method string, url string, headers map[string]string, bod
2727

2828
req.Header = GetHeader(headers)
2929

30-
runtime.EventsOn(a.Ctx, options.CancelId, func(data ...interface{}) {
30+
runtime.EventsOn(a.Ctx, options.CancelId, func(data ...any) {
3131
log.Printf("Requests Canceled: %v %v", method, url)
3232
cancel()
3333
})
@@ -59,7 +59,7 @@ func (a *App) Download(url string, path string, headers map[string]string, event
5959

6060
req.Header = GetHeader(headers)
6161

62-
runtime.EventsOn(a.Ctx, options.CancelId, func(data ...interface{}) {
62+
runtime.EventsOn(a.Ctx, options.CancelId, func(data ...any) {
6363
log.Printf("Download Canceled: %v %v", url, path)
6464
cancel()
6565
})
@@ -84,7 +84,12 @@ func (a *App) Download(url string, path string, headers map[string]string, event
8484
}
8585
defer file.Close()
8686

87-
reader := io.TeeReader(resp.Body, &WriteTracker{Total: resp.ContentLength, ProgressChange: event, App: a})
87+
reader := io.TeeReader(resp.Body, &WriteTracker{
88+
Total: resp.ContentLength,
89+
EmitThreshold: 128 * 1024, // 128KB
90+
ProgressChange: event,
91+
App: a,
92+
})
8893

8994
_, err = io.Copy(file, reader)
9095
if err != nil {
@@ -118,7 +123,12 @@ func (a *App) Upload(url string, path string, headers map[string]string, event s
118123
return HTTPResult{false, 500, nil, err.Error()}
119124
}
120125

121-
reader := io.TeeReader(file, &WriteTracker{Total: fileStat.Size(), ProgressChange: event, App: a})
126+
reader := io.TeeReader(file, &WriteTracker{
127+
Total: fileStat.Size(),
128+
EmitThreshold: 128 * 1024, // 128KB
129+
ProgressChange: event,
130+
App: a,
131+
})
122132

123133
_, err = io.Copy(part, reader)
124134
if err != nil {
@@ -132,7 +142,7 @@ func (a *App) Upload(url string, path string, headers map[string]string, event s
132142

133143
client, ctx, cancel := withRequestOptionsClient(options)
134144

135-
runtime.EventsOn(a.Ctx, options.CancelId, func(data ...interface{}) {
145+
runtime.EventsOn(a.Ctx, options.CancelId, func(data ...any) {
136146
log.Printf("Upload Canceled: %v %v", url, path)
137147
cancel()
138148
})
@@ -161,11 +171,20 @@ func (a *App) Upload(url string, path string, headers map[string]string, event s
161171
}
162172

163173
func (wt *WriteTracker) Write(p []byte) (n int, err error) {
164-
wt.Progress += int64(len(p))
165-
if wt.ProgressChange != "" {
174+
n = len(p)
175+
wt.Progress += int64(n)
176+
177+
if wt.ProgressChange == "" {
178+
return n, nil
179+
}
180+
181+
shouldEmit := wt.Total <= 0 || wt.Progress-wt.LastEmitted >= wt.EmitThreshold || wt.Progress == wt.Total
182+
if shouldEmit {
166183
runtime.EventsEmit(wt.App.Ctx, wt.ProgressChange, wt.Progress, wt.Total)
184+
wt.LastEmitted = wt.Progress
167185
}
168-
return
186+
187+
return n, nil
169188
}
170189

171190
func withRequestOptionsClient(options RequestOptions) (*http.Client, context.Context, context.CancelFunc) {

bridge/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (a *App) StartServer(address string, serverID string, options ServerOptions
4040

4141
defer close(respChan)
4242

43-
runtime.EventsOn(a.Ctx, requestID, func(data ...interface{}) {
43+
runtime.EventsOn(a.Ctx, requestID, func(data ...any) {
4444
runtime.EventsOff(a.Ctx, requestID)
4545
resp := ResponseData{200, make(map[string]string), "A sample http server"}
4646
if len(data) >= 4 {

bridge/tray.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func createMenuItem(menu MenuItem, a *App, parent *systray.MenuItem) {
5555
m = parent.AddSubMenuItem(menu.Text, menu.Tooltip)
5656
}
5757

58-
m.Click(func() { go runtime.EventsEmit(a.Ctx, menu.Event) })
58+
m.Click(func() { go runtime.EventsEmit(a.Ctx, "onMenuItemClick", menu.Event) })
5959

6060
if menu.Checked {
6161
m.Check()

bridge/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ type TrayContent struct {
7373
type WriteTracker struct {
7474
Total int64
7575
Progress int64
76+
LastEmitted int64
77+
EmitThreshold int64
7678
ProgressChange string
7779
App *App
7880
}

frontend/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VITE_APP_TITLE = GUI.for.Clash
2-
VITE_APP_VERSION = v1.9.5
2+
VITE_APP_VERSION = v1.9.6
33
VITE_APP_PROJECT_URL = https://github.com/GUI-for-Cores
44
VITE_APP_VERSION_API = https://api.github.com/repos/GUI-for-Cores/GUI.for.Clash/releases/latest
55
VITE_APP_TG_GROUP = https://t.me/GUI_for_Cores

frontend/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,32 @@
2424
"@codemirror/theme-one-dark": "^6.1.2",
2525
"@codemirror/view": "^6.36.5",
2626
"codemirror": "6.0.1",
27-
"marked": "^15.0.7",
28-
"pinia": "^3.0.1",
27+
"marked": "^15.0.8",
28+
"pinia": "^3.0.2",
2929
"prettier": "^3.5.3",
3030
"vue": "^3.5.13",
3131
"vue-draggable-plus": "^0.6.0",
32-
"vue-i18n": "^11.1.2",
32+
"vue-i18n": "^11.1.3",
3333
"vue-router": "^4.5.0",
3434
"yaml": "^2.7.1"
3535
},
3636
"devDependencies": {
3737
"@rushstack/eslint-patch": "^1.11.0",
3838
"@tsconfig/node22": "^22.0.1",
3939
"@types/dom-view-transitions": "^1.0.6",
40-
"@types/node": "^22.13.17",
40+
"@types/node": "^22.14.1",
4141
"@vitejs/plugin-vue": "^5.2.3",
4242
"@vue/eslint-config-prettier": "^10.2.0",
4343
"@vue/eslint-config-typescript": "^14.5.0",
4444
"@vue/runtime-core": "^3.5.13",
4545
"@vue/tsconfig": "^0.7.0",
46-
"eslint": "^9.23.0",
46+
"eslint": "^9.25.0",
4747
"eslint-plugin-vue": "^10.0.0",
48-
"less": "^4.2.2",
48+
"less": "^4.3.0",
4949
"npm-run-all2": "^7.0.2",
50-
"typescript": "~5.8.2",
51-
"unplugin-vue-components": "^28.4.1",
52-
"vite": "^6.2.4",
50+
"typescript": "~5.8.3",
51+
"unplugin-vue-components": "^28.5.0",
52+
"vite": "^6.3.2",
5353
"vue-tsc": "^2.2.8"
5454
}
5555
}

0 commit comments

Comments
 (0)