diff options
author | Joram Wilander <jwawilander@gmail.com> | 2018-05-16 13:43:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 13:43:22 -0400 |
commit | 1f6c271b3bedd6656ae7155714423b1b39a669c1 (patch) | |
tree | 9ce6390c237cc5f7c16d63addb4372033807cff8 /api/general.go | |
parent | 02f8c18f40cd0e973e4c75b751e8fcbbbd019728 (diff) | |
download | chat-1f6c271b3bedd6656ae7155714423b1b39a669c1.tar.gz chat-1f6c271b3bedd6656ae7155714423b1b39a669c1.tar.bz2 chat-1f6c271b3bedd6656ae7155714423b1b39a669c1.zip |
MM-8708 Remove api package (#8784)
* Remove api package
* Remove api dependency from cmd package
* Remove EnableAPIv3 setting
* Update web tests
* Add more websocket tests
* Move some ws and oauth tests to api4 package
* Move command tests into api4 package
* Test fixes
* Fix msg command test
* Add some app file tests
Diffstat (limited to 'api/general.go')
-rw-r--r-- | api/general.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/api/general.go b/api/general.go deleted file mode 100644 index 51c491526..000000000 --- a/api/general.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package api - -import ( - "fmt" - "net/http" - "strings" - - "github.com/mattermost/mattermost-server/model" -) - -func (api *API) InitGeneral() { - api.BaseRoutes.General.Handle("/client_props", api.ApiAppHandler(getClientConfig)).Methods("GET") - api.BaseRoutes.General.Handle("/log_client", api.ApiAppHandler(logClient)).Methods("POST") - api.BaseRoutes.General.Handle("/ping", api.ApiAppHandler(ping)).Methods("GET") -} - -func getClientConfig(c *Context, w http.ResponseWriter, r *http.Request) { - w.Write([]byte(model.MapToJson(c.App.ClientConfig()))) -} - -func logClient(c *Context, w http.ResponseWriter, r *http.Request) { - forceToDebug := false - - if !*c.App.Config().ServiceSettings.EnableDeveloper { - if c.Session.UserId == "" { - c.Err = model.NewAppError("Permissions", "api.context.permissions.app_error", nil, "", http.StatusForbidden) - return - } - - if !c.App.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) { - forceToDebug = true - } - } - - m := model.MapFromJson(r.Body) - - lvl := m["level"] - msg := m["message"] - - // filter out javascript errors from franz that are polluting the log files - if strings.Contains(msg, "/franz") { - forceToDebug = true - } - - if len(msg) > 400 { - msg = msg[0:399] - } - - if lvl == "ERROR" { - err := &model.AppError{} - err.Message = msg - err.Id = msg - err.Where = "client" - - if forceToDebug { - c.LogDebug(err) - } else { - c.LogError(err) - } - } - - ReturnStatusOK(w) -} - -func ping(c *Context, w http.ResponseWriter, r *http.Request) { - m := make(map[string]string) - m["version"] = model.CurrentVersion - m["server_time"] = fmt.Sprintf("%v", model.GetMillis()) - w.Write([]byte(model.MapToJson(m))) -} |