initial commit

This commit is contained in:
Jesse Hallam 2018-07-16 16:19:59 -04:00
parent fe9c0e7188
commit 189f92c54b
No known key found for this signature in database
GPG key ID: E7959EB6518AF966
54 changed files with 9238 additions and 0 deletions

29
server/http_hooks.go Normal file
View file

@ -0,0 +1,29 @@
package main
import (
"encoding/json"
"net/http"
"github.com/mattermost/mattermost-server/plugin"
)
// ServeHTTP allows the plugin to implement the http.Handler interface. Requests destined for the
// /plugins/{id} path will be routed to the plugin.
//
// The Mattermost-User-Id header will be present if (and only if) the request is by an
// authenticated user.
//
// This sample implementation sends back whether or not the plugin hooks are currently enabled. It
// is used by the web app to recover from a network reconnection and synchronize the state of the
// plugin's hooks.
func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
var response = struct {
Enabled bool `json:"enabled"`
}{
Enabled: !p.disabled,
}
responseJSON, _ := json.Marshal(response)
w.Write(responseJSON)
}