projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4b24c8a
)
Continue debug attempt for move update on server
author
Benjamin Auder
<benjamin.auder@somewhere>
Wed, 4 Mar 2020 23:29:16 +0000
(
00:29
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Wed, 4 Mar 2020 23:29:16 +0000
(
00:29
+0100)
client/src/variants/Allmate1.js
patch
|
blob
|
blame
|
history
client/src/variants/Allmate2.js
patch
|
blob
|
blame
|
history
client/src/views/Game.vue
patch
|
blob
|
blame
|
history
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
server/models/Game.js
patch
|
blob
|
blame
|
history
server/models/User.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/variants/Allmate1.js
b/client/src/variants/Allmate1.js
index
5511dd5
..
1149ea9
100644
(file)
--- a/
client/src/variants/Allmate1.js
+++ b/
client/src/variants/Allmate1.js
@@
-291,7
+291,7
@@
export const VariantRules = class Allmate1Rules extends ChessRules {
let notation = super.getNotation(move);
// Add a capture mark (not describing what is captured...):
if (move.vanish.length > 1 && move.appear.length == 1) {
let notation = super.getNotation(move);
// Add a capture mark (not describing what is captured...):
if (move.vanish.length > 1 && move.appear.length == 1) {
- if (
notation.match(/^[a-h]x/
))
+ if (
!!(notation.match(/^[a-h]x/)
))
// Pawn capture: remove initial "b" in bxc4 for example
notation = notation.substr(1);
notation = notation.replace("x","") + "X";
// Pawn capture: remove initial "b" in bxc4 for example
notation = notation.substr(1);
notation = notation.replace("x","") + "X";
diff --git
a/client/src/variants/Allmate2.js
b/client/src/variants/Allmate2.js
index
0e515b2
..
fe5e98c
100644
(file)
--- a/
client/src/variants/Allmate2.js
+++ b/
client/src/variants/Allmate2.js
@@
-295,7
+295,7
@@
export const VariantRules = class Allmate2Rules extends ChessRules {
let notation = super.getNotation(move);
// Add a capture mark (not describing what is captured...):
if (move.vanish.length > 1 && move.appear.length == 1) {
let notation = super.getNotation(move);
// Add a capture mark (not describing what is captured...):
if (move.vanish.length > 1 && move.appear.length == 1) {
- if (
notation.match(/^[a-h]x/
))
+ if (
!!(notation.match(/^[a-h]x/)
))
// Pawn capture: remove initial "b" in bxc4 for example
notation = notation.substr(1);
notation = notation.replace("x","") + "X";
// Pawn capture: remove initial "b" in bxc4 for example
notation = notation.substr(1);
notation = notation.replace("x","") + "X";
diff --git
a/client/src/views/Game.vue
b/client/src/views/Game.vue
index
8f49c5d
..
69878a0
100644
(file)
--- a/
client/src/views/Game.vue
+++ b/
client/src/views/Game.vue
@@
-727,6
+727,10
@@
export default {
break;
}
if (this.game.type == "corr") {
break;
}
if (this.game.type == "corr") {
+
+
+console.log("new fen : " + this.game.fen);
+
GameStorage.update(this.gameRef.id, {
fen: this.game.fen,
move: {
GameStorage.update(this.gameRef.id, {
fen: this.game.fen,
move: {
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
5cbe0c8
..
2b0a148
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-706,7
+706,7
@@
export default {
}
},
newChallenge: async function() {
}
},
newChallenge: async function() {
- if (
this.newchallenge.cadence.match(/^[0-9]+$/
))
+ if (
!!(this.newchallenge.cadence.match(/^[0-9]+$/)
))
this.newchallenge.cadence += "+0"; //assume minutes, no increment
const ctype = this.classifyObject(this.newchallenge);
// TODO: cadence still unchecked so ctype could be wrong...
this.newchallenge.cadence += "+0"; //assume minutes, no increment
const ctype = this.classifyObject(this.newchallenge);
// TODO: cadence still unchecked so ctype could be wrong...
diff --git
a/server/models/Game.js
b/server/models/Game.js
index
e970bfb
..
3945917
100644
(file)
--- a/
server/models/Game.js
+++ b/
server/models/Game.js
@@
-197,17
+197,17
@@
const GameModel =
return (
(
!obj.move || (
return (
(
!obj.move || (
-
obj.move.played.toString().match(/^[0-9]+$/
) &&
-
obj.move.idx.toString().match(/^[0-9]+$/
)
+
!!(obj.move.played.toString().match(/^[0-9]+$/)
) &&
+
!!(obj.move.idx.toString().match(/^[0-9]+$/)
)
)
) && (
)
) && (
- !obj.drawOffer ||
obj.drawOffer.match(/^[wbtn]$/
)
+ !obj.drawOffer ||
!!(obj.drawOffer.match(/^[wbtn]$/)
)
) && (
) && (
- !obj.fen ||
obj.fen.match(/^[a-zA-Z0-9, /-]*$/
)
+ !obj.fen ||
!!(obj.fen.match(/^[a-zA-Z0-9, /-]*$/)
)
) && (
) && (
- !obj.score ||
obj.score.match(/^[012?*\/-]+$/
)
+ !obj.score ||
!!(obj.score.match(/^[012?*\/-]+$/)
)
) && (
) && (
- !obj.scoreMsg ||
obj.scoreMsg.match(/^[a-zA-Z ]+$/
)
+ !obj.scoreMsg ||
!!(obj.scoreMsg.match(/^[a-zA-Z ]+$/)
)
) && (
!obj.chat || UserModel.checkNameEmail({name: obj.chat.name})
)
) && (
!obj.chat || UserModel.checkNameEmail({name: obj.chat.name})
)
@@
-242,11
+242,6
@@
const GameModel =
query += modifs + " WHERE id = " + id;
db.run(query);
}
query += modifs + " WHERE id = " + id;
db.run(query);
}
-
-
-return cb({errmsg: JSON.stringify(obj.move) + " " + (!!obj.move)});
-
-
// NOTE: move, chat and delchat are mutually exclusive
if (!!obj.move)
{
// NOTE: move, chat and delchat are mutually exclusive
if (!!obj.move)
{
@@
-257,10
+252,6
@@
return cb({errmsg: JSON.stringify(obj.move) + " " + (!!obj.move)});
"WHERE gid = " + id;
db.get(query, (err,ret) => {
const m = obj.move;
"WHERE gid = " + id;
db.get(query, (err,ret) => {
const m = obj.move;
-
-//return cb({errmsg: ret.maxIdx + " " + m.idx + " " + (!ret.maxIdx || ret.maxIdx + 1 == m.idx) + " " + query});
-
-
if (!ret.maxIdx || ret.maxIdx + 1 == m.idx) {
query =
"INSERT INTO Moves (gid, squares, played, idx) VALUES " +
if (!ret.maxIdx || ret.maxIdx + 1 == m.idx) {
query =
"INSERT INTO Moves (gid, squares, played, idx) VALUES " +
diff --git
a/server/models/User.js
b/server/models/User.js
index
3b88850
..
2984af4
100644
(file)
--- a/
server/models/User.js
+++ b/
server/models/User.js
@@
-20,8
+20,8
@@
const UserModel =
checkNameEmail: function(o)
{
return (
checkNameEmail: function(o)
{
return (
- (!o.name ||
o.name.match(/^[\w-]+$/
)) &&
- (!o.email ||
o.email.match(/^[\w.+-]+@[\w.+-]+$/
))
+ (!o.name ||
!!(o.name.match(/^[\w-]+$/)
)) &&
+ (!o.email ||
!!(o.email.match(/^[\w.+-]+@[\w.+-]+$/)
))
);
},
);
},