diff --git a/core/api.go b/core/api.go index 2c01a6cd..f965b85f 100644 --- a/core/api.go +++ b/core/api.go @@ -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 } diff --git a/resolver/api.go b/resolver/api.go index eb87623f..39ac80bc 100644 --- a/resolver/api.go +++ b/resolver/api.go @@ -29,16 +29,16 @@ func registerAPI() error { } if err := api.RegisterEndpoint(api.Endpoint{ - Path: `dns/cache`, + Path: `dns/cache/{query:[a-z0-9\.-]{0,512}\.[A-Z]{1,32}}`, Read: api.PermitUser, RecordFunc: func(r *api.Request) (record.Record, error) { - return recordDatabase.Get(nameRecordsKeyPrefix + r.URL.Query().Get("q")) + return recordDatabase.Get(nameRecordsKeyPrefix + r.URLVars["query"]) }, Name: "Get DNS Record from Cache", Description: "Returns cached dns records from the internal cache.", Parameters: []api.Parameter{{ Method: http.MethodGet, - Field: "q", + Field: "query (in path)", Value: "fqdn and query type", Description: "Specify the query like this: `example.com.A`.", }}, diff --git a/ui/api.go b/ui/api.go index d5d8e18b..863ffbc9 100644 --- a/ui/api.go +++ b/ui/api.go @@ -8,9 +8,11 @@ import ( func registerAPIEndpoints() error { return api.RegisterEndpoint(api.Endpoint{ - Path: "ui/reload", - Write: api.PermitUser, - ActionFunc: reloadUI, + Path: "ui/reload", + Write: api.PermitUser, + ActionFunc: reloadUI, + Name: "Reload UI Assets", + Description: "Removes all assets from the cache and reloads the current (possibly updated) version from disk when requested.", }) }