projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix README + typo in Wildebeest rules
[vchess.git]
/
routes
/
all.js
diff --git
a/routes/all.js
b/routes/all.js
index
b1e0fda
..
d5b4e56
100644
(file)
--- a/
routes/all.js
+++ b/
routes/all.js
@@
-69,12
+69,13
@@
router.post("/problems/:variant([a-zA-Z0-9]+)", (req,res) => {
const timestamp = Date.now();
// Sanitize them
const fen = req.body["fen"];
const timestamp = Date.now();
// Sanitize them
const fen = req.body["fen"];
- if (!fen.match(/^[a-zA-Z0-9
/
]*$/))
+ if (!fen.match(/^[a-zA-Z0-9
, /-
]*$/))
return res.json({errmsg: "Bad characters in FEN string"});
const instructions = sanitizeHtml(req.body["instructions"]);
const solution = sanitizeHtml(req.body["solution"]);
db.serialize(function() {
return res.json({errmsg: "Bad characters in FEN string"});
const instructions = sanitizeHtml(req.body["instructions"]);
const solution = sanitizeHtml(req.body["solution"]);
db.serialize(function() {
- let stmt = db.prepare("INSERT INTO Problems VALUES (?,?,?,?,?)");
+ let stmt = db.prepare("INSERT INTO Problems " +
+ "(added,variant,fen,instructions,solution) VALUES (?,?,?,?,?)");
stmt.run(timestamp, vname, fen, instructions, solution);
stmt.finalize();
});
stmt.run(timestamp, vname, fen, instructions, solution);
stmt.finalize();
});