projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Draft or user bio support (ready in Hall, TODO in Game)
[vchess.git]
/
server
/
models
/
Game.js
diff --git
a/server/models/Game.js
b/server/models/Game.js
index
516c4bc
..
1d2cd68
100644
(file)
--- a/
server/models/Game.js
+++ b/
server/models/Game.js
@@
-128,12
+128,13
@@
const GameModel =
db.serialize(function() {
let query =
"SELECT id, vid, cadence, created, score, white, black " +
db.serialize(function() {
let query =
"SELECT id, vid, cadence, created, score, white, black " +
- "FROM Games ";
- if (uid > 0) query +=
- "WHERE " +
- " created < " + cursor + " AND " +
- " white <> " + uid + " AND " +
- " black <> " + uid + " ";
+ "FROM Games " +
+ "WHERE created < " + cursor + " ";
+ if (uid > 0) {
+ query +=
+ " AND white <> " + uid + " " +
+ " AND black <> " + uid + " ";
+ }
query +=
"ORDER BY created DESC " +
"LIMIT 20"; //TODO: 20 hard-coded...
query +=
"ORDER BY created DESC " +
"LIMIT 20"; //TODO: 20 hard-coded...
@@
-309,7
+310,8
@@
const GameModel =
) && (
!obj.rematchOffer || !!(obj.rematchOffer.match(/^[wbn]$/))
) && (
) && (
!obj.rematchOffer || !!(obj.rematchOffer.match(/^[wbn]$/))
) && (
- !obj.fen || !!(obj.fen.match(/^[a-zA-Z0-9, /-]*$/))
+ // TODO: check if commas are still used (probably not)
+ !obj.fen || !!(obj.fen.match(/^[a-zA-Z0-9,. /-]*$/))
) && (
!obj.score || !!(obj.score.match(/^[012?*\/-]+$/))
) && (
) && (
!obj.score || !!(obj.score.match(/^[012?*\/-]+$/))
) && (