Release 2.7.2+1: stop auto-apply update loop; check-only on start, apply on button with skip/opt-in.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Navis
2026-07-29 17:24:11 +03:00
co-authored by Cursor
parent 53eb845d04
commit 563edc4db8
29 changed files with 189 additions and 92 deletions
+14 -9
View File
@@ -70,7 +70,7 @@ func New(mgr *core.Manager, cfgPath string, logBuf *bytes.Buffer) *App {
CfgPath: cfgPath,
LogBuf: logBuf,
UpdateStatus: update.Status{
Current: update.CurrentVersion,
Current: update.DisplayVersion(),
ManifestURL: update.DefaultManifestURL,
},
}
@@ -125,7 +125,7 @@ func (a *App) GetState() (UIState, error) {
CorePath: corePath,
ConfigPath: a.CfgPath,
Profiles: cfg.ListProfiles(),
Version: update.CurrentVersion,
Version: update.DisplayVersion(),
Update: a.UpdateStatus,
Pings: append([]netcheck.Result(nil), a.Pings...),
Subscription: cfg.SubscriptionURL,
@@ -322,7 +322,7 @@ func (a *App) CheckUpdate() (update.Status, error) {
st, err := update.Check(ctx, update.DefaultManifestURL)
a.mu.Lock()
if err != nil {
st.Current = update.CurrentVersion
st.Current = update.DisplayVersion()
st.ManifestURL = update.DefaultManifestURL
st.Error = err.Error()
}
@@ -332,6 +332,14 @@ func (a *App) CheckUpdate() (update.Status, error) {
}
func (a *App) ApplyUpdate() (string, error) {
// Explicit user action only — never called from AutoCheckUpdate.
st, err := a.CheckUpdate()
if err != nil {
return "", err
}
if !st.Available {
return "", fmt.Errorf("обновление не требуется (текущая %s)", update.DisplayVersion())
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
latest, err := update.Apply(ctx, update.DefaultManifestURL)
@@ -351,13 +359,10 @@ func (a *App) ApplyUpdate() (string, error) {
}
func (a *App) AutoCheckUpdate() {
// Only check and populate status for the banner — never auto-apply.
// Auto-apply previously caused endless download→relaunch loops on Mac/Windows.
time.Sleep(3 * time.Second)
st, err := a.CheckUpdate()
if err != nil || !st.Available {
return
}
time.Sleep(1500 * time.Millisecond)
_, _ = a.ApplyUpdate()
_, _ = a.CheckUpdate()
}
func (a *App) OpenShopURL(raw string) error {