chore: let /upgrade support channel and force as parameters in restful api

Leaving `channel` blank will automatically determine the channel. Other valid values are `alpha`/`release`.

Setting `force` to `true` will bypass the version check and force the update.
This commit is contained in:
wwqgtxx
2025-07-30 17:50:11 +08:00
parent 578e659bb9
commit 00035302a1
2 changed files with 21 additions and 4 deletions

View File

@@ -32,7 +32,11 @@ func upgradeCore(w http.ResponseWriter, r *http.Request) {
return
}
err = updater.DefaultCoreUpdater.Update(execPath)
query := r.URL.Query()
channel := query.Get("channel")
force := query.Get("force") == "true"
err = updater.DefaultCoreUpdater.Update(execPath, channel, force)
if err != nil {
log.Warnln("%s", err)
render.Status(r, http.StatusInternalServerError)