This commit is contained in:
parent
cf33a78c30
commit
18c2cc2ad9
|
@ -142,7 +142,10 @@ func SaveContent(w http.ResponseWriter, r *http.Request) {
|
||||||
data := map[string]interface{}{"succ": true}
|
data := map[string]interface{}{"succ": true}
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetJSON(w, r, data)
|
||||||
|
|
||||||
var args map[string]interface{}
|
args := struct {
|
||||||
|
sid string
|
||||||
|
*conf.LatestSessionContent
|
||||||
|
}{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
glog.Error(err)
|
glog.Error(err)
|
||||||
|
@ -151,30 +154,14 @@ func SaveContent(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sid := args["sid"].(string)
|
wSession := WideSessions.Get(args.sid)
|
||||||
|
|
||||||
wSession := WideSessions.Get(sid)
|
|
||||||
if nil == wSession {
|
if nil == wSession {
|
||||||
data["succ"] = false
|
data["succ"] = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
wSession.Content.CurrentFile = args["currentFile"].(string)
|
wSession.Content = args.LatestSessionContent
|
||||||
// TODO: Ugly
|
|
||||||
fileTree := args["fileTree"].([]interface{})
|
|
||||||
ft := []string{}
|
|
||||||
for _, v := range fileTree {
|
|
||||||
ft = append(ft, v.(string))
|
|
||||||
}
|
|
||||||
wSession.Content.FileTree = ft
|
|
||||||
|
|
||||||
files := args["files"].([]interface{})
|
|
||||||
fs := []string{}
|
|
||||||
for _, v := range files {
|
|
||||||
fs = append(fs, v.(string))
|
|
||||||
}
|
|
||||||
wSession.Content.Files = fs
|
|
||||||
|
|
||||||
for _, user := range conf.Wide.Users {
|
for _, user := range conf.Wide.Users {
|
||||||
if user.Name == wSession.Username {
|
if user.Name == wSession.Username {
|
||||||
|
|
Loading…
Reference in New Issue