summaryrefslogtreecommitdiffstats
path: root/api/license.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-03-14 10:23:51 -0700
committer=Corey Hulen <corey@hulen.com>2016-03-14 10:23:51 -0700
commitea3f25924ea64a2dd1e73624c0d30824e1efb240 (patch)
treea4a2b2bdc37bd675fb89837713995ad44a27427b /api/license.go
parent397ebec88c2db3569efd77238bf877e976492d34 (diff)
parentbf7ae0711743926cfbb031675cc3320d7a942465 (diff)
downloadchat-ea3f25924ea64a2dd1e73624c0d30824e1efb240.tar.gz
chat-ea3f25924ea64a2dd1e73624c0d30824e1efb240.tar.bz2
chat-ea3f25924ea64a2dd1e73624c0d30824e1efb240.zip
Merge branch 'master' into PLT-2115
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)))
+}