Use new `status` field, display expired invoices as such
This commit is contained in:
parent
ae6e72de18
commit
6c38e6a56e
2
app.js
2
app.js
|
@ -76,7 +76,7 @@ app.get('/:rpath(*)', pwrap(async (req, res) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (invoice) {
|
else if (invoice) {
|
||||||
if (invoice.completed) res.redirect(escape(file.name) + '?token=' + tokenr.make(invoice, conf.download_ttl))
|
if (invoice.status == 'paid') res.redirect(escape(file.name) + '?token=' + tokenr.make(invoice, conf.download_ttl))
|
||||||
else res.render('file', { ...file, invoice })
|
else res.render('file', { ...file, invoice })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,26 @@
|
||||||
- expiry_str = new Date(invoice.expires_at*1000).toUTCString()
|
- expiry_str = new Date(invoice.expires_at*1000).toUTCString()
|
||||||
|
|
||||||
.checkout
|
if invoice.status == 'expired'
|
||||||
h3 Pay with Lightning
|
h3 Invoice expired
|
||||||
h4 #[strong= invoice.quoted_amount] #{invoice.quoted_currency } = #[strong= fmsat(invoice.msatoshi)] mBTC
|
p Please go back and try again.
|
||||||
.row
|
|
||||||
.pay.col-sm-8
|
|
||||||
pre= invoice.payreq
|
|
||||||
|
|
||||||
p.small.text-muted
|
else
|
||||||
noscript Your browser has JavaScript turned off. Please refresh the page manually after making the payment.
|
.checkout
|
||||||
span.yesscript #[img(src='_assets/loader.gif', alt='loading')] Awaiting payment.
|
h3 Pay with Lightning
|
||||||
| The invoice expires #[span(data-countdown-to=invoice.expires_at, title=expiry_str) at #{ expiry_str }].
|
h4 #[strong= invoice.quoted_amount] #{invoice.quoted_currency } = #[strong= fmsat(invoice.msatoshi)] mBTC
|
||||||
|
.row
|
||||||
|
.pay.col-sm-8
|
||||||
|
pre= invoice.payreq
|
||||||
|
|
||||||
p: a.btn.btn-lg.btn-primary(href=`lightning:${invoice.payreq}`) Pay now
|
p.small.text-muted
|
||||||
|
noscript Your browser has JavaScript turned off. Please refresh the page manually after making the payment.
|
||||||
|
span.yesscript #[img(src='_assets/loader.gif', alt='loading')] Awaiting payment.
|
||||||
|
| The invoice expires #[span(data-countdown-to=invoice.expires_at, title=expiry_str) at #{ expiry_str }].
|
||||||
|
|
||||||
.qr.col-sm-4.mb-3: img(src=qruri('lightning:'+invoice.payreq, { mode: 'alphanumeric', margin: 0 }))
|
p: a.btn.btn-lg.btn-primary(href=`lightning:${invoice.payreq}`) Pay now
|
||||||
|
|
||||||
//- long-pull payment updates via <img> reloading hack. not the prettiest, but extremely terse, and it works
|
.qr.col-sm-4.mb-3: img(src=qruri('lightning:'+invoice.payreq, { mode: 'alphanumeric', margin: 0 }))
|
||||||
img.d-none(src='_invoice/'+invoice.id+'/longpoll.png', onerror='this.src=this.src', onload='location.reload()')
|
|
||||||
script(src='_assets/countdown.js')
|
//- long-pull payment updates via <img> reloading hack. not the prettiest, but extremely terse, and it works
|
||||||
|
img.d-none(src='_invoice/'+invoice.id+'/longpoll.png', onerror='this.src=this.src', onload='location.reload()')
|
||||||
|
script(src='_assets/countdown.js')
|
||||||
|
|
Loading…
Reference in New Issue