[WIP] Refactoring and bug fixes
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
_ "github.com/safing/portmaster/service/status"
|
||||
_ "github.com/safing/portmaster/service/sync"
|
||||
_ "github.com/safing/portmaster/service/ui"
|
||||
"github.com/safing/portmaster/service/updates"
|
||||
)
|
||||
|
||||
// Core is the core service module.
|
||||
@@ -114,4 +115,6 @@ func New(instance instance) (*Core, error) {
|
||||
type instance interface {
|
||||
Shutdown()
|
||||
AddWorkerInfoToDebugInfo(di *debug.Info)
|
||||
BinaryUpdates() *updates.Updates
|
||||
IntelUpdates() *updates.Updates
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user