X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Froutes%2Fgames.js;h=fbda66f80260080b1bb35b2022c8d92340f6a11c;hb=fc6d8c37cb0fa882041ca2690d63afeeb5099750;hp=42c15c999dfeaae13d3326867b1fbdc419ccc09b;hpb=f14572c4a22425033735253eabbaa2d8dbb53d05;p=vchess.git diff --git a/server/routes/games.js b/server/routes/games.js index 42c15c99..fbda66f8 100644 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -5,6 +5,14 @@ const GameModel = require('../models/Game'); const access = require("../utils/access"); const params = require("../config/parameters"); +router.post("/gamestat", access.ajax, (req,res) => { + const vid = req.body.vid; + if (!!vid && !!vid.toString().match(/^[0-9]+$/)) { + GameModel.incrementCounter(vid); + res.json({}); + } +}); + // From main hall, start game between players 0 and 1 router.post("/games", access.logged, access.ajax, (req,res) => { const gameInfo = req.body.gameInfo; @@ -18,7 +26,7 @@ router.post("/games", access.logged, access.ajax, (req,res) => { ) { if (!!cid) ChallengeModel.remove(cid); GameModel.create( - gameInfo.vid, gameInfo.fen, gameInfo.randomness, + gameInfo.vid, gameInfo.fen, gameInfo.options, gameInfo.cadence, gameInfo.players, (err, ret) => { const oppIdx = (gameInfo.players[0].id == req.userId ? 1 : 0);