X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=routes%2Fplaying.js;h=3bdfa35cccab1742e1a013eb9fec316b8801443c;hb=9e76c73c4c4f403563e025968934f29b397b53b3;hp=37592c9d3ca8c9a02f2a765b924fdb2622776b5a;hpb=8d7e2786f5a67a1b9a77c742d7951e0efbe8747d;p=vchess.git diff --git a/routes/playing.js b/routes/playing.js index 37592c9d..3bdfa35c 100644 --- a/routes/playing.js +++ b/routes/playing.js @@ -1,3 +1,5 @@ +// TODO: adapt for correspondance play + var router = require("express").Router(); var UserModel = require("../models/User"); var GameModel = require('../models/Game'); @@ -90,12 +92,8 @@ router.get("/gamesbyplayer", access.logged, access.ajax, (req,res) => { }); }); -// Load a rules page -router.get("/rules/:variant([a-zA-Z0-9]+)", access.ajax, (req,res) => { - res.render("rules/" + req.params["variant"]); -}); - // TODO: if newmove fail, takeback in GUI // TODO: check move structure +// TODO: for corr games, move should contain an optional "message" field ("corr chat" !) router.post("/moves", access.logged, access.ajax, (req,res) => { let gid = ObjectId(req.body.gid); let fen = req.body.fen; @@ -111,16 +109,4 @@ router.post("/moves", access.logged, access.ajax, (req,res) => { }); }); -//TODO: if new chat fails, do not show chat message locally -router.post("/chats", access.logged, access.ajax, (req,res) => { - let gid = ObjectId(req.body.gid); - let uid = ObjectId(req.body.uid); - let msg = req.body.msg; //TODO: sanitize HTML (strip all tags...) - GameModel.addChat(gid, uid, msg, (err,game) => { - access.checkRequest(res, err, game, "Cannot find game", () => { - res.json({}); - }); - }); -}); - module.exports = router;