- gameInfo.vid, gameInfo.fen, gameInfo.cadence, gameInfo.players,
+ gameInfo.vid, gameInfo.fen, gameInfo.randomness,
+ gameInfo.cadence, gameInfo.players,
(err, ret) => {
const oppIdx = (gameInfo.players[0].id == req.userId ? 1 : 0);
const oppId = gameInfo.players[oppIdx].id;
(err, ret) => {
const oppIdx = (gameInfo.players[0].id == req.userId ? 1 : 0);
const oppId = gameInfo.players[oppIdx].id;
const gameId = req.query["gid"];
if (!!gameId && gameId.match(/^[0-9]+$/)) {
GameModel.getOne(gameId, (err, game) => {
const gameId = req.query["gid"];
if (!!gameId && gameId.match(/^[0-9]+$/)) {
GameModel.getOne(gameId, (err, game) => {
const userId = req.query["uid"];
const cursor = req.query["cursor"];
if (!!userId.match(/^[0-9]+$/) && !!cursor.match(/^[0-9]+$/)) {
const userId = req.query["uid"];
const cursor = req.query["cursor"];
if (!!userId.match(/^[0-9]+$/) && !!cursor.match(/^[0-9]+$/)) {
- GameModel.getObserved(userId, (err, games) => {
+ GameModel.getObserved(userId, cursor, (err, games) => {
res.json({ games: games });
});
}
});
// Get by user ID, for MyGames page
res.json({ games: games });
});
}
});
// Get by user ID, for MyGames page
-router.get("/runninggames", access.ajax, access.logged, (req,res) => {
+router.get("/runninggames", access.logged, access.ajax, (req,res) => {
GameModel.getRunning(req.userId, (err, games) => {
res.json({ games: games });
});
});
GameModel.getRunning(req.userId, (err, games) => {
res.json({ games: games });
});
});
-router.get("/completedgames", access.ajax, access.logged, (req,res) => {
+router.get("/completedgames", access.logged, access.ajax, (req,res) => {
const cursor = req.query["cursor"];
if (!!cursor.match(/^[0-9]+$/)) {
GameModel.getCompleted(req.userId, cursor, (err, games) => {
const cursor = req.query["cursor"];
if (!!cursor.match(/^[0-9]+$/)) {
GameModel.getCompleted(req.userId, cursor, (err, games) => {
const gid = req.body.gid;
let obj = req.body.newObj;
if (gid.toString().match(/^[0-9]+$/) && GameModel.checkGameUpdate(obj)) {
const gid = req.body.gid;
let obj = req.body.newObj;
if (gid.toString().match(/^[0-9]+$/) && GameModel.checkGameUpdate(obj)) {