mirror of https://github.com/jetkvm/kvm.git
Compare commits
2 Commits
0513328620
...
810e3783d6
| Author | SHA1 | Date |
|---|---|---|
|
|
810e3783d6 | |
|
|
005505a2da |
11
ota.go
11
ota.go
|
|
@ -137,7 +137,7 @@ func rpcGetLocalVersion() (*ota.LocalMetadata, error) {
|
||||||
type updateParams struct {
|
type updateParams struct {
|
||||||
AppTargetVersion string `json:"appTargetVersion"`
|
AppTargetVersion string `json:"appTargetVersion"`
|
||||||
SystemTargetVersion string `json:"systemTargetVersion"`
|
SystemTargetVersion string `json:"systemTargetVersion"`
|
||||||
Components string `json:"components,omitempty"` // components is a comma-separated list of components to update
|
Components []string `json:"components,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func rpcTryUpdate() error {
|
func rpcTryUpdate() error {
|
||||||
|
|
@ -154,9 +154,7 @@ func rpcCheckUpdateComponents(params updateParams, includePreRelease bool) (*ota
|
||||||
IncludePreRelease: includePreRelease,
|
IncludePreRelease: includePreRelease,
|
||||||
AppTargetVersion: params.AppTargetVersion,
|
AppTargetVersion: params.AppTargetVersion,
|
||||||
SystemTargetVersion: params.SystemTargetVersion,
|
SystemTargetVersion: params.SystemTargetVersion,
|
||||||
}
|
Components: params.Components,
|
||||||
if params.Components != "" {
|
|
||||||
updateParams.Components = strings.Split(params.Components, ",")
|
|
||||||
}
|
}
|
||||||
info, err := otaState.GetUpdateStatus(context.Background(), updateParams)
|
info, err := otaState.GetUpdateStatus(context.Background(), updateParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -170,6 +168,7 @@ func rpcTryUpdateComponents(params updateParams, includePreRelease bool, resetCo
|
||||||
DeviceID: GetDeviceID(),
|
DeviceID: GetDeviceID(),
|
||||||
IncludePreRelease: includePreRelease,
|
IncludePreRelease: includePreRelease,
|
||||||
ResetConfig: resetConfig,
|
ResetConfig: resetConfig,
|
||||||
|
Components: params.Components,
|
||||||
}
|
}
|
||||||
|
|
||||||
updateParams.AppTargetVersion = params.AppTargetVersion
|
updateParams.AppTargetVersion = params.AppTargetVersion
|
||||||
|
|
@ -182,10 +181,6 @@ func rpcTryUpdateComponents(params updateParams, includePreRelease bool, resetCo
|
||||||
return fmt.Errorf("failed to set system target version: %w", err)
|
return fmt.Errorf("failed to set system target version: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.Components != "" {
|
|
||||||
updateParams.Components = strings.Split(params.Components, ",")
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
err := otaState.TryUpdate(context.Background(), updateParams)
|
err := otaState.TryUpdate(context.Background(), updateParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ export default function SettingsAdvancedRoute() {
|
||||||
// because it will be redirected to the update page later
|
// because it will be redirected to the update page later
|
||||||
setVersionUpdateLoading(true);
|
setVersionUpdateLoading(true);
|
||||||
versionInfo = await checkUpdateComponents({
|
versionInfo = await checkUpdateComponents({
|
||||||
components: components.join(","),
|
components,
|
||||||
appTargetVersion: appVersion,
|
appTargetVersion: appVersion,
|
||||||
systemTargetVersion: systemVersion,
|
systemTargetVersion: systemVersion,
|
||||||
}, devChannel);
|
}, devChannel);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ export default function SettingsGeneralUpdateRoute() {
|
||||||
|
|
||||||
send("tryUpdateComponents", {
|
send("tryUpdateComponents", {
|
||||||
params: {
|
params: {
|
||||||
components: components.join(","),
|
components,
|
||||||
appTargetVersion,
|
appTargetVersion,
|
||||||
systemTargetVersion,
|
systemTargetVersion,
|
||||||
},
|
},
|
||||||
|
|
@ -196,13 +196,12 @@ function LoadingState({
|
||||||
return await getVersionInfo();
|
return await getVersionInfo();
|
||||||
}
|
}
|
||||||
const params : updateParams = {
|
const params : updateParams = {
|
||||||
components: "",
|
components: [],
|
||||||
appTargetVersion: customAppVersion,
|
appTargetVersion: customAppVersion,
|
||||||
systemTargetVersion: customSystemVersion,
|
systemTargetVersion: customSystemVersion,
|
||||||
};
|
};
|
||||||
if (customAppVersion) params.components += ",app";
|
if (customAppVersion) params.components?.push("app");
|
||||||
if (customSystemVersion) params.components += ",system";
|
if (customSystemVersion) params.components?.push("system");
|
||||||
params.components = params.components?.replace(/^,+/, "");
|
|
||||||
|
|
||||||
return await checkUpdateComponents(params, false);
|
return await checkUpdateComponents(params, false);
|
||||||
}, [customAppVersion, customSystemVersion, getVersionInfo]);
|
}, [customAppVersion, customSystemVersion, getVersionInfo]);
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ export async function getLocalVersion() {
|
||||||
export interface updateParams {
|
export interface updateParams {
|
||||||
appTargetVersion?: string;
|
appTargetVersion?: string;
|
||||||
systemTargetVersion?: string;
|
systemTargetVersion?: string;
|
||||||
components?: string;
|
components?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkUpdateComponents(params: updateParams, includePreRelease: boolean) {
|
export async function checkUpdateComponents(params: updateParams, includePreRelease: boolean) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue