mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-26 00:19:41 -05:00
Co-authored-by: Aaron Ky-Riesenbach <aaron@kyriesenba.ch>
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package http
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// settingsGetHandler retrieves the current system settings.
|
|
// @Summary Get system settings
|
|
// @Description Returns the current configuration settings for signup, user directories, rules, frontend.
|
|
// @Tags Settings
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param property query string false "Property to retrieve: `userDefaults`, `frontend`, `auth`, `server`, `sources`"
|
|
// @Success 200 {object} settings.Settings "System settings data"
|
|
// @Router /api/settings [get]
|
|
func settingsGetHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
|
property := r.URL.Query().Get("property")
|
|
if property != "" {
|
|
// get property by name
|
|
switch property {
|
|
case "userDefaults":
|
|
return renderJSON(w, r, config.UserDefaults)
|
|
case "frontend":
|
|
return renderJSON(w, r, config.Frontend)
|
|
case "auth":
|
|
return renderJSON(w, r, config.Auth)
|
|
case "server":
|
|
return renderJSON(w, r, config.Server)
|
|
case "sources":
|
|
return renderJSON(w, r, config.Server.Sources)
|
|
default:
|
|
return http.StatusNotFound, nil
|
|
}
|
|
}
|
|
return renderJSON(w, r, config)
|
|
}
|