mirror of https://github.com/jetkvm/kvm.git
refactor: enhance redirect URL handling in TryUpdate function
This commit is contained in:
parent
03a05c135a
commit
35d717610d
15
ota.go
15
ota.go
|
|
@ -489,9 +489,22 @@ func TryUpdate(ctx context.Context, deviceId string, includePreRelease bool) err
|
|||
if rebootNeeded {
|
||||
scopedLogger.Info().Msg("System Rebooting due to OTA update")
|
||||
|
||||
// Build redirect URL with conditional query parameters
|
||||
redirectUrl := "/settings/general/update"
|
||||
queryParams := url.Values{}
|
||||
if systemUpdateAvailable {
|
||||
queryParams.Set("systemVersion", remote.SystemVersion)
|
||||
}
|
||||
if appUpdateAvailable {
|
||||
queryParams.Set("appVersion", remote.AppVersion)
|
||||
}
|
||||
if len(queryParams) > 0 {
|
||||
redirectUrl += "?" + queryParams.Encode()
|
||||
}
|
||||
|
||||
postRebootAction := &PostRebootAction{
|
||||
HealthCheck: "/device/status",
|
||||
RedirectUrl: "/settings/general/update?version=" + remote.SystemVersion,
|
||||
RedirectUrl: redirectUrl,
|
||||
}
|
||||
|
||||
if err := hwReboot(true, postRebootAction, 10*time.Second); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue