summaryrefslogtreecommitdiffstats
path: root/api/license.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-02-08 07:26:10 -0500
committerChristopher Speller <crspeller@gmail.com>2016-03-14 00:38:25 -0400
commitd7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69 (patch)
tree49a0de30cdc2ac461e72a242ae9a5593fcd6c8b9 /api/license.go
parent08f0800adef926e8b69ebea70e4995b89f5c3f3c (diff)
downloadchat-d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69.tar.gz
chat-d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69.tar.bz2
chat-d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69.zip
Convering client to react-router.
Diffstat (limited to 'api/license.go')
-rw-r--r--api/license.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/api/license.go b/api/license.go
index 23e7946c8..542b45e26 100644
--- a/api/license.go
+++ b/api/license.go
@@ -20,6 +20,7 @@ func InitLicense(r *mux.Router) {
sr := r.PathPrefix("/license").Subrouter()
sr.Handle("/add", ApiAdminSystemRequired(addLicense)).Methods("POST")
sr.Handle("/remove", ApiAdminSystemRequired(removeLicense)).Methods("POST")
+ sr.Handle("/client_config", ApiAppHandler(getClientLicenceConfig)).Methods("GET")
}
func addLicense(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -130,3 +131,22 @@ func removeLicense(c *Context, w http.ResponseWriter, r *http.Request) {
rdata["status"] = "ok"
w.Write([]byte(model.MapToJson(rdata)))
}
+
+func getClientLicenceConfig(c *Context, w http.ResponseWriter, r *http.Request) {
+ config := utils.ClientLicense
+
+ var etag string
+ if config["IsLicensed"] == "false" {
+ etag = model.Etag(config["IsLicensed"])
+ } else {
+ etag = model.Etag(config["IsLicensed"], config["IssuedAt"])
+ }
+
+ if HandleEtag(etag, w, r) {
+ return
+ }
+
+ w.Header().Set(model.HEADER_ETAG_SERVER, etag)
+
+ w.Write([]byte(model.MapToJson(config)))
+}