diff --git a/foftickets.js b/foftickets.js index 604bd29..559058e 100644 --- a/foftickets.js +++ b/foftickets.js @@ -269,7 +269,7 @@ app.get('/mytickets',requireLogin, async (req,res)=> { const hash0=crypto.createHash('sha256'); const hash1=hash0.update(theticket+QRSalt); 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); 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 hash1=hash0.update(theticket+QRSalt); 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 }); }); @@ -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) => { const changes={}; 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 ticket=req.body.ticket; 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) }); }) app.post('/qrcodesu',requireSuperUser,async (req,res) => { const ticket=req.body.ticket; 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) }); })