projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4c1fea4
)
Update TODO + cosmetics
author
Benjamin Auder
<benjamin.auder@somewhere>
Sat, 5 Dec 2020 23:16:44 +0000
(
00:16
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Sat, 5 Dec 2020 23:16:44 +0000
(
00:16
+0100)
12 files changed:
TODO
patch
|
blob
|
blame
|
history
client/src/utils/array.js
patch
|
blob
|
blame
|
history
client/src/utils/compgameStorage.js
patch
|
blob
|
blame
|
history
client/src/utils/gameStorage.js
patch
|
blob
|
blame
|
history
client/src/utils/importgameStorage.js
patch
|
blob
|
blame
|
history
server/config/parameters.js.dist
patch
|
blob
|
blame
|
history
server/models/Challenge.js
patch
|
blob
|
blame
|
history
server/models/Game.js
patch
|
blob
|
blame
|
history
server/models/Problem.js
patch
|
blob
|
blame
|
history
server/models/User.js
patch
|
blob
|
blame
|
history
server/models/Variant.js
patch
|
blob
|
blame
|
history
server/utils/access.js
patch
|
blob
|
blame
|
history
diff --git
a/TODO
b/TODO
index
9ae357c
..
09f538b
100644
(file)
--- a/
TODO
+++ b/
TODO
@@
-1,3
+1,6
@@
+getRepetitionStatus() lose or draw... (for some variants)
+Chakart: king remote capture, is an option if short range
+
WON'T IMPLEMENT:
Simultaneous games: view Game + Simultaneous, using component (One)Game
Storage: just key ID => IDs of actual games (in indexedDB)
WON'T IMPLEMENT:
Simultaneous games: view Game + Simultaneous, using component (One)Game
Storage: just key ID => IDs of actual games (in indexedDB)
diff --git
a/client/src/utils/array.js
b/client/src/utils/array.js
index
d02552c
..
3d7f7ae
100644
(file)
--- a/
client/src/utils/array.js
+++ b/
client/src/utils/array.js
@@
-1,5
+1,6
@@
// Remove item(s) in array (if present)
export const ArrayFun = {
// Remove item(s) in array (if present)
export const ArrayFun = {
+
remove: function(arr, rfun, all) {
const index = arr.findIndex(rfun);
if (index >= 0) {
remove: function(arr, rfun, all) {
const index = arr.findIndex(rfun);
if (index >= 0) {
@@
-21,4
+22,5
@@
export const ArrayFun = {
range: function(max) {
return [...Array(max).keys()];
}
range: function(max) {
return [...Array(max).keys()];
}
+
};
};
diff --git
a/client/src/utils/compgameStorage.js
b/client/src/utils/compgameStorage.js
index
4f5181e
..
c846304
100644
(file)
--- a/
client/src/utils/compgameStorage.js
+++ b/
client/src/utils/compgameStorage.js
@@
-37,6
+37,7
@@
function dbOperation(callback) {
}
export const CompgameStorage = {
}
export const CompgameStorage = {
+
add: function(game) {
dbOperation((err, db) => {
if (err) return;
add: function(game) {
dbOperation((err, db) => {
if (err) return;
@@
-90,4
+91,5
@@
export const CompgameStorage = {
}
});
}
}
});
}
+
};
};
diff --git
a/client/src/utils/gameStorage.js
b/client/src/utils/gameStorage.js
index
6885ed1
..
3e3b684
100644
(file)
--- a/
client/src/utils/gameStorage.js
+++ b/
client/src/utils/gameStorage.js
@@
-51,6
+51,7
@@
function dbOperation(callback) {
}
export const GameStorage = {
}
export const GameStorage = {
+
// Optional callback to get error status
add: function(game, callback) {
dbOperation((err, db) => {
// Optional callback to get error status
add: function(game, callback) {
dbOperation((err, db) => {
@@
-183,4
+184,5
@@
export const GameStorage = {
}
});
}
}
});
}
+
};
};
diff --git
a/client/src/utils/importgameStorage.js
b/client/src/utils/importgameStorage.js
index
46a60bb
..
bcda4fd
100644
(file)
--- a/
client/src/utils/importgameStorage.js
+++ b/
client/src/utils/importgameStorage.js
@@
-33,6
+33,7
@@
function dbOperation(callback) {
}
export const ImportgameStorage = {
}
export const ImportgameStorage = {
+
// Optional callback to get error status
add: function(game, callback) {
dbOperation((err, db) => {
// Optional callback to get error status
add: function(game, callback) {
dbOperation((err, db) => {
@@
-110,4
+111,5
@@
export const ImportgameStorage = {
}
});
}
}
});
}
+
};
};
diff --git
a/server/config/parameters.js.dist
b/server/config/parameters.js.dist
index
c0640cd
..
9ba7618
100644
(file)
--- a/
server/config/parameters.js.dist
+++ b/
server/config/parameters.js.dist
@@
-1,4
+1,5
@@
module.exports = {
module.exports = {
+
// For mail sending. NOTE: *no trailing slash*
siteURL: "http://localhost:8080",
// For mail sending. NOTE: *no trailing slash*
siteURL: "http://localhost:8080",
@@
-33,4
+34,5
@@
module.exports = {
// IDs of users allowed to post news and edit any problem
devs: []
// IDs of users allowed to post news and edit any problem
devs: []
+
};
};
diff --git
a/server/models/Challenge.js
b/server/models/Challenge.js
index
dea0ac3
..
a528ca6
100644
(file)
--- a/
server/models/Challenge.js
+++ b/
server/models/Challenge.js
@@
-14,6
+14,7
@@
const UserModel = require("./User");
*/
const ChallengeModel = {
*/
const ChallengeModel = {
+
checkChallenge: function(c) {
return (
c.vid.toString().match(/^[0-9]+$/) &&
checkChallenge: function(c) {
return (
c.vid.toString().match(/^[0-9]+$/) &&
@@
-76,7
+77,8
@@
const ChallengeModel = {
ChallengeModel.remove(id);
});
});
ChallengeModel.remove(id);
});
});
- },
-}
+ }
+
+};
module.exports = ChallengeModel;
module.exports = ChallengeModel;
diff --git
a/server/models/Game.js
b/server/models/Game.js
index
0d59d6e
..
02ef2d1
100644
(file)
--- a/
server/models/Game.js
+++ b/
server/models/Game.js
@@
-34,8
+34,8
@@
const UserModel = require("./User");
* added: datetime
*/
* added: datetime
*/
-const GameModel =
-{
+const GameModel =
{
+
checkGameInfo: function(g) {
return (
g.vid.toString().match(/^[0-9]+$/) &&
checkGameInfo: function(g) {
return (
g.vid.toString().match(/^[0-9]+$/) &&
@@
-502,6
+502,7
@@
const GameModel =
});
});
}
});
});
}
-}
+
+};
module.exports = GameModel;
module.exports = GameModel;
diff --git
a/server/models/Problem.js
b/server/models/Problem.js
index
eef4270
..
cc74006
100644
(file)
--- a/
server/models/Problem.js
+++ b/
server/models/Problem.js
@@
-12,6
+12,7
@@
const db = require("../utils/database");
*/
const ProblemModel = {
*/
const ProblemModel = {
+
checkProblem: function(p) {
return (
p.id.toString().match(/^[0-9]+$/) &&
checkProblem: function(p) {
return (
p.id.toString().match(/^[0-9]+$/) &&
@@
-88,7
+89,8
@@
const ProblemModel = {
whereClause;
db.run(query);
});
whereClause;
db.run(query);
});
- },
-}
+ }
+
+};
module.exports = ProblemModel;
module.exports = ProblemModel;
diff --git
a/server/models/User.js
b/server/models/User.js
index
6a070e2
..
ebda4c3
100644
(file)
--- a/
server/models/User.js
+++ b/
server/models/User.js
@@
-17,6
+17,7
@@
const sendEmail = require('../utils/mailer');
*/
const UserModel = {
*/
const UserModel = {
+
checkNameEmail: function(o) {
return (
(!o.name || !!(o.name.match(/^[\w-]+$/))) &&
checkNameEmail: function(o) {
return (
(!o.name || !!(o.name.match(/^[\w-]+$/))) &&
@@
-177,7
+178,8
@@
const UserModel = {
}
});
});
}
});
});
- },
-}
+ }
+
+};
module.exports = UserModel;
module.exports = UserModel;
diff --git
a/server/models/Variant.js
b/server/models/Variant.js
index
85abf5a
..
d01d2a2
100644
(file)
--- a/
server/models/Variant.js
+++ b/
server/models/Variant.js
@@
-8,6
+8,7
@@
const db = require("../utils/database");
*/
const VariantModel = {
*/
const VariantModel = {
+
getAll: function(callback) {
db.serialize(function() {
const query =
getAll: function(callback) {
db.serialize(function() {
const query =
@@
-15,9
+16,10
@@
const VariantModel = {
"FROM Variants";
db.all(query, callback);
});
"FROM Variants";
db.all(query, callback);
});
- }
,
+ }
//create, update, delete: directly in DB
//create, update, delete: directly in DB
-}
+
+};
module.exports = VariantModel;
module.exports = VariantModel;
diff --git
a/server/utils/access.js
b/server/utils/access.js
index
bf6430c
..
88aab68
100644
(file)
--- a/
server/utils/access.js
+++ b/
server/utils/access.js
@@
-1,6
+1,7
@@
var UserModel = require("../models/User");
module.exports = {
var UserModel = require("../models/User");
module.exports = {
+
// Prevent access to "users pages"
logged: function(req, res, next) {
const callback = () => {
// Prevent access to "users pages"
logged: function(req, res, next) {
const callback = () => {
@@
-55,4
+56,5
@@
module.exports = {
res.json({ errmsg: msg });
} else cb();
}
res.json({ errmsg: msg });
} else cb();
}
+
};
};