projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Draft rematch (not working yet) + fix Crazyhouse getPromotedFen()
[vchess.git]
/
server
/
models
/
Game.js
diff --git
a/server/models/Game.js
b/server/models/Game.js
index
fc48591
..
e45c182
100644
(file)
--- a/
server/models/Game.js
+++ b/
server/models/Game.js
@@
-212,6
+212,8
@@
const GameModel =
)
) && (
!obj.drawOffer || !!(obj.drawOffer.match(/^[wbtn]$/))
)
) && (
!obj.drawOffer || !!(obj.drawOffer.match(/^[wbtn]$/))
+ ) && (
+ !obj.rematchOffer || !!(obj.rematchOffer.match(/^[wbn]$/))
) && (
!obj.fen || !!(obj.fen.match(/^[a-zA-Z0-9, /-]*$/))
) && (
) && (
!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...
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") //
S
pecial "None" update
+ if (obj.drawOffer == "n") //
s
pecial "None" update
obj.drawOffer = "";
modifs += "drawOffer = '" + obj.drawOffer + "',";
}
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)
if (!!obj.fen)
modifs += "fen = '" + obj.fen + "',";
if (!!obj.score)