changes
This commit is contained in:
@@ -269,7 +269,7 @@ app.get('/mytickets',requireLogin, async (req,res)=> {
|
|||||||
const hash0=crypto.createHash('sha256');
|
const hash0=crypto.createHash('sha256');
|
||||||
const hash1=hash0.update(theticket+QRSalt);
|
const hash1=hash0.update(theticket+QRSalt);
|
||||||
const hash=hash1.digest("base64").slice(0,6);
|
const hash=hash1.digest("base64").slice(0,6);
|
||||||
const useurl='/useticket?t='+theticket+'&h='+hashQR(theticket,username);
|
const useurl=MainURL+'/useticket?t='+theticket+'&h='+hashQR(theticket,username);
|
||||||
const dataURL=await QRCode.toDataURL(useurl);
|
const dataURL=await QRCode.toDataURL(useurl);
|
||||||
return res.render("oneticket",{ username:username, superuser:req.session.superuser, message:message, ticket:theticket, offered:tickets[theticket].offered, qrcode:dataURL, useurl:useurl });
|
return res.render("oneticket",{ username:username, superuser:req.session.superuser, message:message, ticket:theticket, offered:tickets[theticket].offered, qrcode:dataURL, useurl:useurl });
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ app.post('/oneticket',requireLogin, async (req,res)=> {
|
|||||||
const hash0=crypto.createHash('sha256');
|
const hash0=crypto.createHash('sha256');
|
||||||
const hash1=hash0.update(theticket+QRSalt);
|
const hash1=hash0.update(theticket+QRSalt);
|
||||||
const hash=hash1.digest("base64").slice(0,6);
|
const hash=hash1.digest("base64").slice(0,6);
|
||||||
const dataURL=await QRCode.toDataURL('/useticket?t='+theticket+'&h='+hashQR(theticket,username));
|
const dataURL=await QRCode.toDataURL(MainURL+'/useticket?t='+theticket+'&h='+hashQR(theticket,username));
|
||||||
return res.render("oneticket", { username:username, superuser:req.session.superuser, message:message, magiclink:GetMagicLink(username), ticket:theticket, offered:tickets[theticket].offered, qrcode:dataURL });
|
return res.render("oneticket", { username:username, superuser:req.session.superuser, message:message, magiclink:GetMagicLink(username), ticket:theticket, offered:tickets[theticket].offered, qrcode:dataURL });
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ app.post("/updateoffered", requireLogin, (req,res) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Need a SuperUser version of tghis
|
// Need a SuperUser version of this
|
||||||
app.post("/updateoffered2", requireLogin, (req,res) => {
|
app.post("/updateoffered2", requireLogin, (req,res) => {
|
||||||
const changes={};
|
const changes={};
|
||||||
for (ticket in req.body) if (tickets[ticket] && tickets[ticket].owner==req.session.username && req.body[ticket]!=tickets[ticket].offered) {
|
for (ticket in req.body) if (tickets[ticket] && tickets[ticket].owner==req.session.username && req.body[ticket]!=tickets[ticket].offered) {
|
||||||
@@ -478,14 +478,14 @@ app.post('/qrcode',requireLogin,async (req,res) => {
|
|||||||
const username=req.session.username;
|
const username=req.session.username;
|
||||||
const ticket=req.body.ticket;
|
const ticket=req.body.ticket;
|
||||||
if (tickets[ticket].owner!=username) return res.status(500).send("Only a ticket owner can generate a QR code");
|
if (tickets[ticket].owner!=username) return res.status(500).send("Only a ticket owner can generate a QR code");
|
||||||
const URL=await QRCode.toDataURL('/useticket?t='+ticket+'&h='+hashQR(ticket,username));
|
const URL=await QRCode.toDataURL(MainURL+'/useticket?t='+ticket+'&h='+hashQR(ticket,username));
|
||||||
return res.send({ owner:username, qrcode: URL, magiclink:GetMagicLink(username) });
|
return res.send({ owner:username, qrcode: URL, magiclink:GetMagicLink(username) });
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/qrcodesu',requireSuperUser,async (req,res) => {
|
app.post('/qrcodesu',requireSuperUser,async (req,res) => {
|
||||||
const ticket=req.body.ticket;
|
const ticket=req.body.ticket;
|
||||||
const username=tickets[ticket].owner;
|
const username=tickets[ticket].owner;
|
||||||
const URL=await QRCode.toDataURL('/useticket?t='+ticket+'&h='+hashQR(ticket,username));
|
const URL=await QRCode.toDataURL(MainURL+'/useticket?t='+ticket+'&h='+hashQR(ticket,username));
|
||||||
return res.send({ owner:username, qrcode: URL, magiclink:GetMagicLink(username) });
|
return res.send({ owner:username, qrcode: URL, magiclink:GetMagicLink(username) });
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user