|
@@ -37,7 +37,9 @@ func showIndex(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
|
|
|
|
|
|
|
func proxyHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
func proxyHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
|
|
|
|
|
|
- if ps.ByName("gameid") == "board" {
|
|
|
|
|
|
|
+ if ps.ByName("gameid") == "asciiboard" {
|
|
|
|
|
+ showAsciiBoard(w, r, ps)
|
|
|
|
|
+ } else if ps.ByName("gameid") == "board" {
|
|
|
showBoard(w, r, ps)
|
|
showBoard(w, r, ps)
|
|
|
} else if ps.ByName("boardid") == "join" {
|
|
} else if ps.ByName("boardid") == "join" {
|
|
|
joinGame(w, r, ps)
|
|
joinGame(w, r, ps)
|
|
@@ -113,3 +115,11 @@ func showBoard(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
|
|
//rows, _ := strconv.Atoi(req.FormValue("rows"))
|
|
//rows, _ := strconv.Atoi(req.FormValue("rows"))
|
|
|
//cols, _ := strconv.Atoi(req.FormValue("cols"))
|
|
//cols, _ := strconv.Atoi(req.FormValue("cols"))
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func showAsciiBoard(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
|
|
|
|
+ w.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
|
|
|
|
+
|
|
|
|
|
+ id, _ := strconv.ParseInt(ps.ByName("boardid"), 10, 64)
|
|
|
|
|
+ b := currentGames.GetGame(id).Board.String()
|
|
|
|
|
+ w.Write([]byte(b))
|
|
|
|
|
+}
|