Improve APIs

This commit is contained in:
Daniel
2021-05-12 11:25:18 +02:00
parent 660c1bf3c5
commit 50ea3a5d43
3 changed files with 18 additions and 12 deletions

View File

@@ -25,17 +25,21 @@ func registerEvents() {
func registerAPIEndpoints() error {
if err := api.RegisterEndpoint(api.Endpoint{
Path: "core/shutdown",
Write: api.PermitSelf,
ActionFunc: shutdown,
Path: "core/shutdown",
Write: api.PermitSelf,
ActionFunc: shutdown,
Name: "Shut Down Portmaster",
Description: "Shut down the Portmaster Core Service and all UI components.",
}); err != nil {
return err
}
if err := api.RegisterEndpoint(api.Endpoint{
Path: "core/restart",
Write: api.PermitAdmin,
ActionFunc: restart,
Path: "core/restart",
Write: api.PermitAdmin,
ActionFunc: restart,
Name: "Restart Portmaster",
Description: "Restart the Portmaster Core Service.",
}); err != nil {
return err
}