summaryrefslogtreecommitdiffstats
path: root/api4/system.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/system.go')
-rw-r--r--api4/system.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/api4/system.go b/api4/system.go
index 7b63afc0b..4ae8ee7b9 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -17,6 +17,8 @@ import (
func (api *API) InitSystem() {
api.BaseRoutes.System.Handle("/ping", api.ApiHandler(getSystemPing)).Methods("GET")
+ api.BaseRoutes.System.Handle("/timezones", api.ApiSessionRequired(getSupportedTimezones)).Methods("GET")
+
api.BaseRoutes.ApiRoot.Handle("/config", api.ApiSessionRequired(getConfig)).Methods("GET")
api.BaseRoutes.ApiRoot.Handle("/config", api.ApiSessionRequired(updateConfig)).Methods("PUT")
api.BaseRoutes.ApiRoot.Handle("/config/reload", api.ApiSessionRequired(configReload)).Methods("POST")
@@ -378,6 +380,18 @@ func getAnalytics(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(rows.ToJson()))
}
+func getSupportedTimezones(c *Context, w http.ResponseWriter, r *http.Request) {
+ supportedTimezones := c.App.Timezones()
+
+ if supportedTimezones != nil {
+ w.Write([]byte(model.TimezonesToJson(supportedTimezones)))
+ return
+ }
+
+ emptyTimezones := make([]string, 0)
+ w.Write([]byte(model.TimezonesToJson(emptyTimezones)))
+}
+
func testS3(c *Context, w http.ResponseWriter, r *http.Request) {
cfg := model.ConfigFromJson(r.Body)
if cfg == nil {