fix: auto upgrade toast message (#4625)

Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: opencode <opencode@sst.dev>
This commit is contained in:
Ravi Kumar
2025-11-23 03:56:46 +05:30
committed by GitHub
parent 1b692ec7eb
commit b92e8510f9
6 changed files with 45 additions and 4 deletions

View File

@@ -5,10 +5,15 @@ import { Installation } from "@/installation"
export async function upgrade() {
const config = await Config.global()
if (config.autoupdate === false || Flag.OPENCODE_DISABLE_AUTOUPDATE) return
const latest = await Installation.latest().catch(() => {})
if (!latest) return
if (Installation.VERSION === latest) return
if (config.autoupdate === false || Flag.OPENCODE_DISABLE_AUTOUPDATE) {
await Bus.publish(Installation.Event.UpdateAvailable, { version: latest })
return
}
const method = await Installation.method()
if (method === "unknown") return
await Installation.upgrade(method, latest)