diff options
author | Asaad Mahmood <Unknowngi@live.com> | 2015-10-02 22:26:28 +0500 |
---|---|---|
committer | Asaad Mahmood <Unknowngi@live.com> | 2015-10-02 22:26:28 +0500 |
commit | d8c5c4f7468bb07d8de904437726557c6fa9b436 (patch) | |
tree | c19af28e1ad6c2bf068bf64956461c25502f9bb3 /api/admin.go | |
parent | 813792dd600f4e485d52cc1066a8c1297578432d (diff) | |
parent | 41069d83d2b6ad5cca599f75292027e13d5b10f7 (diff) | |
download | chat-d8c5c4f7468bb07d8de904437726557c6fa9b436.tar.gz chat-d8c5c4f7468bb07d8de904437726557c6fa9b436.tar.bz2 chat-d8c5c4f7468bb07d8de904437726557c6fa9b436.zip |
Merge branch 'master' of https://github.com/mattermost/platform into plt-375
Conflicts:
web/react/components/user_settings/user_settings_appearance.jsx
Diffstat (limited to 'api/admin.go')
-rw-r--r-- | api/admin.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/api/admin.go b/api/admin.go index 3ef8c12a8..d9714d6d2 100644 --- a/api/admin.go +++ b/api/admin.go @@ -23,8 +23,10 @@ func InitAdmin(r *mux.Router) { sr.Handle("/logs", ApiUserRequired(getLogs)).Methods("GET") sr.Handle("/config", ApiUserRequired(getConfig)).Methods("GET") sr.Handle("/save_config", ApiUserRequired(saveConfig)).Methods("POST") - sr.Handle("/client_props", ApiAppHandler(getClientProperties)).Methods("GET") sr.Handle("/test_email", ApiUserRequired(testEmail)).Methods("POST") + sr.Handle("/client_props", ApiAppHandler(getClientProperties)).Methods("GET") + sr.Handle("/log_client", ApiAppHandler(logClient)).Methods("POST") + } func getLogs(c *Context, w http.ResponseWriter, r *http.Request) { @@ -59,6 +61,26 @@ func getClientProperties(c *Context, w http.ResponseWriter, r *http.Request) { w.Write([]byte(model.MapToJson(utils.ClientProperties))) } +func logClient(c *Context, w http.ResponseWriter, r *http.Request) { + m := model.MapFromJson(r.Body) + + lvl := m["level"] + msg := m["message"] + + if len(msg) > 400 { + msg = msg[0:399] + } + + if lvl == "ERROR" { + err := model.NewAppError("client", msg, "") + c.LogError(err) + } + + rm := make(map[string]string) + rm["SUCCESS"] = "true" + w.Write([]byte(model.MapToJson(rm))) +} + func getConfig(c *Context, w http.ResponseWriter, r *http.Request) { if !c.HasSystemAdminPermissions("getConfig") { return |