[WIP] Add update from custom url functionality

This commit is contained in:
Vladimir Stoilov
2024-10-09 11:44:59 +03:00
parent a874ec9412
commit 8b68243cc6
3 changed files with 95 additions and 19 deletions

View File

@@ -133,6 +133,22 @@ func registerAPIEndpoints() error {
return err
}
if err := api.RegisterEndpoint(api.Endpoint{
Path: "updates/from-url",
WriteMethod: "POST",
Write: api.PermitAnyone,
ActionFunc: func(ar *api.Request) (string, error) {
err := module.instance.BinaryUpdates().UpdateFromURL(string(ar.InputData))
if err != nil {
return err.Error(), err
}
return "upgrade triggered", nil
},
Name: "Replace current version from the version supplied in the URL",
}); err != nil {
return err
}
return nil
}