|
@@ -157,9 +157,25 @@ func showBoard(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
|
|
func showAsciiBoard(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
|
func showAsciiBoard(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
|
|
w.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
|
w.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
|
|
|
|
|
|
|
|
|
+ xString := req.FormValue("x")
|
|
|
|
|
+ yString := req.FormValue("y")
|
|
|
|
|
+ widthString := req.FormValue("cols")
|
|
|
|
|
+ heightString := req.FormValue("rows")
|
|
|
|
|
+
|
|
|
id, _ := strconv.ParseInt(ps.ByName("gameid"), 10, 64)
|
|
id, _ := strconv.ParseInt(ps.ByName("gameid"), 10, 64)
|
|
|
b := gameServer.GetGame(id).Board.String()
|
|
b := gameServer.GetGame(id).Board.String()
|
|
|
- w.Write([]byte(b))
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if xString != "" && yString != "" && widthString != "" && heightString != "" {
|
|
|
|
|
+ x, _ := strconv.Atoi(xString)
|
|
|
|
|
+ y, _ := strconv.Atoi(yString)
|
|
|
|
|
+ width, _ := strconv.Atoi(widthString)
|
|
|
|
|
+ height, _ := strconv.Atoi(heightString)
|
|
|
|
|
+ log.Printf("showboard x %v y %v width %v height %v", x, y, width, height)
|
|
|
|
|
+ else if xString != "" || yString != "" || widthString != "" || heightString != "" {
|
|
|
|
|
+ http.Error(w, "Bad request", http.StatusBadRequest)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ w.Write([]byte(b))
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func profileDump(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
|
func profileDump(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|