summaryrefslogtreecommitdiffstats
path: root/api4/system.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-03-23 09:08:49 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-03-23 09:08:49 -0400
commit5fa1b3581955761bd39c310bc88b1489d963a9fc (patch)
tree25e6dd11592102807abebbb5de100f7d867005d8 /api4/system.go
parent37f0e5e0ebc0595efe2c65ffb84fa096dc8c5493 (diff)
parent87762ae62eb887dfb3fd0957040919aede46f7d4 (diff)
downloadchat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.gz
chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.bz2
chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.zip
Merge branch 'master' into advanced-permissions-phase-1
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 {