X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Fmodels%2FGame.js;h=e45c18275ce2453d949667956a37544ad22106a7;hp=fc48591065f67813a992122dcea465c039ebd2aa;hb=c292ebb2a014646005b01e27253c162f1d639387;hpb=afde76668963c4d0d96002fcae2ebabb9acf81e4 diff --git a/server/models/Game.js b/server/models/Game.js index fc485910..e45c1827 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -212,6 +212,8 @@ const GameModel = ) ) && ( !obj.drawOffer || !!(obj.drawOffer.match(/^[wbtn]$/)) + ) && ( + !obj.rematchOffer || !!(obj.rematchOffer.match(/^[wbn]$/)) ) && ( !obj.fen || !!(obj.fen.match(/^[a-zA-Z0-9, /-]*$/)) ) && ( @@ -234,12 +236,18 @@ const GameModel = let modifs = ""; // NOTE: if drawOffer is set, we should check that it's player's turn // A bit overcomplicated. Let's trust the client on that for now... - if (obj.drawOffer) + if (!!obj.drawOffer) { - if (obj.drawOffer == "n") //Special "None" update + if (obj.drawOffer == "n") //special "None" update obj.drawOffer = ""; modifs += "drawOffer = '" + obj.drawOffer + "',"; } + if (!!obj.rematchOffer) + { + if (obj.rematchOffer == "n") //special "None" update + obj.rematchOffer = ""; + modifs += "rematchOffer = '" + obj.rematchOffer + "',"; + } if (!!obj.fen) modifs += "fen = '" + obj.fen + "',"; if (!!obj.score)