mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-18 19:09:09 +02:00
[client] Fix UI new version notifier (#3845)
This commit is contained in:
@@ -62,6 +62,8 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
logFile = file
|
logFile = file
|
||||||
|
} else {
|
||||||
|
_ = util.InitLog("trace", "console")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the Fyne application.
|
// Create the Fyne application.
|
||||||
|
@@ -93,23 +93,25 @@ func (u *Update) SetOnUpdateListener(updateFn func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *Update) startFetcher() {
|
func (u *Update) startFetcher() {
|
||||||
changed := u.fetchVersion()
|
if changed := u.fetchVersion(); changed {
|
||||||
if changed {
|
|
||||||
u.checkUpdate()
|
u.checkUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
for {
|
||||||
case <-u.fetchDone:
|
select {
|
||||||
return
|
case <-u.fetchDone:
|
||||||
case <-u.fetchTicker.C:
|
return
|
||||||
changed := u.fetchVersion()
|
case <-u.fetchTicker.C:
|
||||||
if changed {
|
if changed := u.fetchVersion(); changed {
|
||||||
u.checkUpdate()
|
u.checkUpdate()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Update) fetchVersion() bool {
|
func (u *Update) fetchVersion() bool {
|
||||||
|
log.Debugf("fetching version info from %s", versionURL)
|
||||||
|
|
||||||
resp, err := http.Get(versionURL)
|
resp, err := http.Get(versionURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failed to fetch version info: %s", err)
|
log.Errorf("failed to fetch version info: %s", err)
|
||||||
|
Reference in New Issue
Block a user