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:
+14
-9
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user