|
|
|
@ -33,7 +33,7 @@ router.get("/:fqdn", (req, res) => {
|
|
|
|
|
router.get("/:fqdn/:code", (req, res) => {
|
|
|
|
|
let addr = ipaddr.parse(req.ip);
|
|
|
|
|
if (!["ipv4", "ipv6"].includes(addr.kind())) return res.status(400).send("Invalid ip address");
|
|
|
|
|
db.query("UDPATE addresses SET " + addr.kind() + " = ? WHERE fqdn = ? AND code = ?", [addr.toString(), req.params.fqdn, req.params.code], (e, d) => {
|
|
|
|
|
db.query("UPDATE addresses SET " + addr.kind() + " = ? WHERE fqdn = ? AND code = ?", [addr.toString(), req.params.fqdn, req.params.code], (e, d) => {
|
|
|
|
|
if (e) return res.status(400).send("Error");
|
|
|
|
|
res.send(d);
|
|
|
|
|
});
|
|
|
|
|