1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-03 23:30:29 +02:00

Plugin telemetry (#1069)

* implement webapp telemetry

* cleanup

* remove imports, update events

* change event title

* update for lint

* add test, update filename

* linter fix

* fix field name

* revert changes

* fix test

* update builds

* fix workflows

* fix workflows

* fix workflow

* temp checkin

* remove log lines

* updates from peer review
This commit is contained in:
Scott Bishel
2021-09-01 15:53:27 -06:00
committed by GitHub
parent 59b8ae4517
commit 94e6e8a9f7
20 changed files with 280 additions and 21 deletions

View File

@ -90,6 +90,7 @@ func (a *API) RegisterRoutes(r *mux.Router) {
apiv1.HandleFunc("/login", a.handleLogin).Methods("POST")
apiv1.HandleFunc("/register", a.handleRegister).Methods("POST")
apiv1.HandleFunc("/clientConfig", a.getClientConfig).Methods("GET")
apiv1.HandleFunc("/workspaces/{workspaceID}/{rootID}/files", a.sessionRequired(a.handleUploadFile)).Methods("POST")
@ -115,6 +116,17 @@ func (a *API) requireCSRFToken(next http.Handler) http.Handler {
})
}
func (a *API) getClientConfig(w http.ResponseWriter, r *http.Request) {
clientConfig := a.app.GetClientConfig()
configData, err := json.Marshal(clientConfig)
if err != nil {
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
return
}
jsonBytesResponse(w, http.StatusOK, configData)
}
func (a *API) checkCSRFToken(r *http.Request) bool {
token := r.Header.Get(HeaderRequestedWith)
return token == HeaderRequestedWithXML