Convering client to react-router.

Этот коммит содержится в:
Christopher Speller
2016-02-08 07:26:10 -05:00
родитель 08f0800ade
Коммит d7cdcf082f
183 изменённых файлов: 3433 добавлений и 5091 удалений

Просмотреть файл

@@ -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)))
}