Enha: attempt to do modal popup of clue; must be a better way

This commit is contained in:
Grail Finder
2025-05-10 16:38:27 +03:00
parent 321b79b258
commit e654f6f456
9 changed files with 130 additions and 15 deletions

View File

@ -49,7 +49,10 @@ func HandleNameCheck(w http.ResponseWriter, r *http.Request) {
}
func HandleFrontLogin(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
if err := r.ParseForm(); err != nil {
abortWithError(w, err.Error())
return
}
username := r.PostFormValue("username")
if username == "" {
msg := "username not provided"

View File

@ -240,3 +240,29 @@ func HandleJoinRoom(w http.ResponseWriter, r *http.Request) {
}
tmpl.ExecuteTemplate(w, "room", fi)
}
func HandleGiveClue(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
abortWithError(w, err.Error())
return
}
clue := r.PostFormValue("clue")
num := r.PostFormValue("number")
fi, err := getFullInfoByCtx(r.Context())
if err != nil {
abortWithError(w, err.Error())
return
}
fi.Room.MimeDone = true
notify(models.NotifyMimePrefix+fi.Room.ID, clue+num)
if err := saveFullInfo(fi); err != nil {
abortWithError(w, err.Error())
return
}
// tmpl, err := template.ParseGlob("components/*.html")
// if err != nil {
// abortWithError(w, err.Error())
// return
// }
// tmpl.ExecuteTemplate(w, "room", fi)
}