[WIP] Refactoring and bug fixes

This commit is contained in:
Vladimir Stoilov
2024-09-18 18:26:34 +03:00
parent 84a15b5fb3
commit 1a866584a4
6 changed files with 196 additions and 101 deletions

View File

@@ -106,6 +106,32 @@ func registerAPIEndpoints() error {
return err
}
if err := api.RegisterEndpoint(api.Endpoint{
Path: "updates/check",
Read: api.PermitUser,
ActionFunc: func(ar *api.Request) (string, error) {
module.instance.BinaryUpdates().TriggerUpdateCheck()
module.instance.IntelUpdates().TriggerUpdateCheck()
return "update check triggered", nil
},
Name: "Get the ID of the calling profile",
}); err != nil {
return err
}
if err := api.RegisterEndpoint(api.Endpoint{
Path: "updates/apply",
Read: api.PermitUser,
ActionFunc: func(ar *api.Request) (string, error) {
module.instance.BinaryUpdates().TriggerApplyUpdates()
module.instance.IntelUpdates().TriggerApplyUpdates()
return "upgrade triggered", nil
},
Name: "Get the ID of the calling profile",
}); err != nil {
return err
}
return nil
}