lib/api: Fix body of renamed config/restart-required endpoint (ref #7402) (#7453)

This commit is contained in:
Simon Frei 2021-03-11 15:54:05 +01:00 committed by GitHub
parent 3938b61c3f
commit 4465cdf8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -306,7 +306,7 @@ func (s *service) Serve(ctx context.Context) error {
configBuilder.registerConfig("/rest/config")
configBuilder.registerConfigInsync("/rest/config/insync") // deprecated
configBuilder.registerConfigInsync("/rest/config/restart-required")
configBuilder.registerConfigRequiresRestart("/rest/config/restart-required")
configBuilder.registerFolders("/rest/config/folders")
configBuilder.registerDevices("/rest/config/devices")
configBuilder.registerFolder("/rest/config/folders/:id")

View File

@ -51,6 +51,12 @@ func (c *configMuxBuilder) registerConfigInsync(path string) {
})
}
func (c *configMuxBuilder) registerConfigRequiresRestart(path string) {
c.HandlerFunc(http.MethodGet, path, func(w http.ResponseWriter, _ *http.Request) {
sendJSON(w, map[string]bool{"requiresRestart": c.cfg.RequiresRestart()})
})
}
func (c *configMuxBuilder) registerFolders(path string) {
c.HandlerFunc(http.MethodGet, path, func(w http.ResponseWriter, _ *http.Request) {
sendJSON(w, c.cfg.FolderList())