|
|
|
@ -120,6 +120,42 @@ app.post("/updateItem",(req,res)=>{ |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
app.post("/updateTimer",(req,res)=>{ |
|
|
|
|
if (req.body.timer_start!==null&&req.body.timer_end!==null&&req.body.timer_start!==undefined&&req.body.timer_end!==undefined){ |
|
|
|
|
var splitter=req.body.timer_start.split(",") |
|
|
|
|
var splitter2=req.body.timer_end.split(",") |
|
|
|
|
for (t of splitter){ |
|
|
|
|
if (t=="")continue; |
|
|
|
|
if (t.split(":").length!=2||(t.split(":").length==2&&(isNaN(t.split(":")[0])||isNaN(t.split(":")[1])))){ |
|
|
|
|
res.status(500).send("Invalid input!") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (t of splitter2){ |
|
|
|
|
if (t=="")continue; |
|
|
|
|
if (t.split(":").length!=2||(t.split(":").length==2&&(isNaN(t.split(":")[0])||isNaN(t.split(":")[1])))){ |
|
|
|
|
console.log(t) |
|
|
|
|
res.status(500).send("Invalid input!") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
db.query("update crafting_list set timer_start=$1,timer_end=$2 where id=$3 returning *",[req.body.timer_start,req.body.timer_end,req.body.id]) |
|
|
|
|
.then((data)=>{ |
|
|
|
|
itemIcon = "https://xivapi.com"+data.rows[0].icon |
|
|
|
|
return db.query("update site_data set last_modified=$1",[req.body.last_modified]) |
|
|
|
|
}) |
|
|
|
|
.then((data)=>{
|
|
|
|
|
res.status(200).send("Yay!") |
|
|
|
|
}) |
|
|
|
|
.catch((err)=>{ |
|
|
|
|
console.log(err.message) |
|
|
|
|
res.status(500).send(err.message) |
|
|
|
|
})
|
|
|
|
|
} else { |
|
|
|
|
res.status(500).send("Invalid input!") |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
app.post('/setItem',async(req,res)=>{ |
|
|
|
|
await db.query('select * from crafting_list where itemid=$1',[req.body.itemid]) |
|
|
|
|
.then((data)=>{ |
|
|
|
|