From 4fe3d34335d989cdc1c3c666c50c09ea18b96c62 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 13 Oct 2022 11:17:43 +0200 Subject: [PATCH] Make restart and shutdown APIs work without module --- core/api.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/api.go b/core/api.go index 3ef37924..ffa02a28 100644 --- a/core/api.go +++ b/core/api.go @@ -25,9 +25,10 @@ import ( func registerAPIEndpoints() error { if err := api.RegisterEndpoint(api.Endpoint{ - Path: "core/shutdown", - Write: api.PermitSelf, - BelongsTo: module, + Path: "core/shutdown", + Write: api.PermitSelf, + // 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, Name: "Shut Down Portmaster", Description: "Shut down the Portmaster Core Service and all UI components.", @@ -36,9 +37,10 @@ func registerAPIEndpoints() error { } if err := api.RegisterEndpoint(api.Endpoint{ - Path: "core/restart", - Write: api.PermitAdmin, - BelongsTo: module, + Path: "core/restart", + Write: api.PermitAdmin, + // 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, Name: "Restart Portmaster", Description: "Restart the Portmaster Core Service.",