db.query('select * from users where username=$1 and password_hash=$2 limit 1',[req.body.username,sh.SecretHash(req.body.password)])
.then((data)=>{
.then((data)=>{
if(data.rows.length>0){
res.status(200).json(data.rows)
res.status(200).json({verified:true})
}else{
res.status(200).json({verified:false})
}
})
})
.catch((err)=>{
.catch((err)=>{
res.status(500).send(err.message)
res.status(500).send(err.message)
})
})
})
})
app.post(PREFIX+"/saveskilltree",(req,res)=>{
app.post("/updateItem",(req,res)=>{
db4.query('select * from password where password=$1',[req.body.pass])
db.query("update crafting_list set obtained=$1 where id=$2",[req.body.obtained,req.body.id])
.then((data)=>{
.then((data)=>{
if(data.rows.length>0){
returndb.query("update site_data set last_modified=$1",[req.body.last_modified])
returndb.query('select * from skill_tree_data where class_id=$1 limit 1',[req.body.class_id])
}else{
varmsg="Could not authenticate!";res.status(500).send(msg);throwmsg
}
})
})
.then((data)=>{
.then((data)=>{
if(data.rows.length>0){
res.status(200).send("Yay!")
returndb.query('update skill_tree_data set data=$1,skill_data=$2,line_color=$3,line_width=$4,gridsizex=$5,gridsizey=$6,gridpaddingx=$7,gridpaddingy=$8,halflineheight=$9 where class_id=$10',
returndb.query('insert into skill_tree_data(data,skill_data,line_color,line_width,gridsizex,gridsizey,gridpaddingx,gridpaddingy,class_id,halflineheight) values($1,$2,$3,$4,$5,$6,$7,$8,$10,$9)',
db4.query('select * from password where password=$1',[req.body.pass])
db.query('insert into crafting_list(itemid,name,obtained,required,icon) values($1,$2,$3,$4,$5)',[req.body.itemid,req.body.name,req.body.obtained,req.body.required,req.body.icon])
.then((data)=>{
.then((data)=>{
if(data.rows.length>0){
res.status(200).send("Yay!")
returndb2.query('select * from skill_tree_data where class_id=$1 limit 1',[req.body.class_id])
}else{
varmsg="Could not authenticate!";res.status(500).send(msg);throwmsg
}
})
.then((data)=>{
if(data.rows.length>0){
returndb2.query('update skill_tree_data set data=$1,skill_data=$2,line_color=$3,line_width=$4,gridsizex=$5,gridsizey=$6,gridpaddingx=$7,gridpaddingy=$8,halflineheight=$9 where class_id=$10',
returndb2.query('insert into skill_tree_data(data,skill_data,line_color,line_width,gridsizex,gridsizey,gridpaddingx,gridpaddingy,class_id,halflineheight) values($1,$2,$3,$4,$5,$6,$7,$8,$10,$9)',