Make restart and shutdown APIs work without module
This commit is contained in:
14
core/api.go
14
core/api.go
@@ -25,9 +25,10 @@ import (
|
|||||||
|
|
||||||
func registerAPIEndpoints() error {
|
func registerAPIEndpoints() error {
|
||||||
if err := api.RegisterEndpoint(api.Endpoint{
|
if err := api.RegisterEndpoint(api.Endpoint{
|
||||||
Path: "core/shutdown",
|
Path: "core/shutdown",
|
||||||
Write: api.PermitSelf,
|
Write: api.PermitSelf,
|
||||||
BelongsTo: module,
|
// Do NOT register as belonging to the module, so that the API is available
|
||||||
|
// when something fails during starting of this module or a dependency.
|
||||||
ActionFunc: shutdown,
|
ActionFunc: shutdown,
|
||||||
Name: "Shut Down Portmaster",
|
Name: "Shut Down Portmaster",
|
||||||
Description: "Shut down the Portmaster Core Service and all UI components.",
|
Description: "Shut down the Portmaster Core Service and all UI components.",
|
||||||
@@ -36,9 +37,10 @@ func registerAPIEndpoints() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := api.RegisterEndpoint(api.Endpoint{
|
if err := api.RegisterEndpoint(api.Endpoint{
|
||||||
Path: "core/restart",
|
Path: "core/restart",
|
||||||
Write: api.PermitAdmin,
|
Write: api.PermitAdmin,
|
||||||
BelongsTo: module,
|
// Do NOT register as belonging to the module, so that the API is available
|
||||||
|
// when something fails during starting of this module or a dependency.
|
||||||
ActionFunc: restart,
|
ActionFunc: restart,
|
||||||
Name: "Restart Portmaster",
|
Name: "Restart Portmaster",
|
||||||
Description: "Restart the Portmaster Core Service.",
|
Description: "Restart the Portmaster Core Service.",
|
||||||
|
|||||||
Reference in New Issue
Block a user