Release 1.7.1: download-only updates and remove netsh/startup network probes for AV FPs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,10 +57,6 @@ type uiState struct {
|
||||
}
|
||||
|
||||
func main() {
|
||||
if update.MaybeFinishUpdate(os.Args[1:]) {
|
||||
return
|
||||
}
|
||||
|
||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||
|
||||
cfgPath, err := config.LocateConfig()
|
||||
@@ -138,8 +134,6 @@ func main() {
|
||||
mustBind(w, "saveHy2", a.saveHy2)
|
||||
mustBind(w, "importSubscription", a.importSubscription)
|
||||
|
||||
go a.autoCheckUpdate()
|
||||
|
||||
w.SetHtml(appui.IndexHTML)
|
||||
w.Run()
|
||||
}
|
||||
@@ -329,33 +323,10 @@ func (a *app) checkUpdate() (update.Status, error) {
|
||||
return st, nil
|
||||
}
|
||||
|
||||
func (a *app) applyUpdate() error {
|
||||
func (a *app) applyUpdate() (string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
|
||||
defer cancel()
|
||||
latest, err := update.Apply(ctx, update.DefaultManifestURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = a.mgr.Disconnect()
|
||||
go func() {
|
||||
time.Sleep(400 * time.Millisecond)
|
||||
if a.webview != nil {
|
||||
a.webview.Terminate()
|
||||
}
|
||||
os.Exit(0)
|
||||
}()
|
||||
_ = latest
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *app) autoCheckUpdate() {
|
||||
time.Sleep(2 * time.Second)
|
||||
_, _ = a.checkUpdate()
|
||||
ticker := time.NewTicker(6 * time.Hour)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
_, _ = a.checkUpdate()
|
||||
}
|
||||
return update.Apply(ctx, update.DefaultManifestURL)
|
||||
}
|
||||
|
||||
func openURL(raw string) error {
|
||||
|
||||
@@ -287,11 +287,11 @@ func runApplyUpdate(args []string) int {
|
||||
_ = args
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
|
||||
defer cancel()
|
||||
latest, err := update.Apply(ctx, update.DefaultManifestURL)
|
||||
msg, err := update.Apply(ctx, update.DefaultManifestURL)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "apply-update: %v\n", err)
|
||||
return 1
|
||||
}
|
||||
fmt.Printf("updating to %s — exit the app to finish\n", latest)
|
||||
fmt.Println(msg)
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user