diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index 8818196..f3dd8b6 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -136,7 +136,7 @@ new Vue({ bolt11: '' } }, - sendCamera: { + theCamera: { show: false, camera: 'auto' }, @@ -206,11 +206,17 @@ new Vue({ } }, methods: { + // closeCamera: function () { + // this.sendCamera.show = false + // }, + // showCamera: function () { + // this.sendCamera.show = true + // }, closeCamera: function () { - this.sendCamera.show = false + this.theCamera.show = false }, showCamera: function () { - this.sendCamera.show = true + this.theCamera.show = true }, showChart: function () { this.paymentsChart.show = true @@ -247,7 +253,7 @@ new Vue({ }, 10000) }, closeSendDialog: function () { - this.sendCamera.show = false + // this.sendCamera.show = false var checker = this.send.paymentChecker setTimeout(function () { clearInterval(checker) @@ -284,10 +290,26 @@ new Vue({ }) }, decodeQR: function (res) { - this.send.data.bolt11 = res - this.decodeInvoice() - this.sendCamera.show = false + if (res.substring(0, 4) == 'lnurl') { + console.log(res) + var self = this + + LNbits.api + .request('GET', '/lnurlscan/' + res, this.g.user.wallets[0].adminkey) + .then(function (response) { + console.log(response.data) + }) + .catch(function (error) { + clearInterval(self.checker) + LNbits.utils.notifyApiError(error) + }) + } else { + this.send.data.bolt11 = res + this.decodeInvoice() + this.theCamera.show = false + } }, + decodeInvoice: function () { if (this.send.data.bolt11.startsWith('lightning:')) { this.send.data.bolt11 = this.send.data.bolt11.slice(10) diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html index 5d62046..5bf94da 100644 --- a/lnbits/core/templates/core/wallet.html +++ b/lnbits/core/templates/core/wallet.html @@ -14,7 +14,7 @@
SendReceive
+
+ scan + Use camera to scan an invoice/QR + +
@@ -187,6 +197,7 @@ +
@@ -304,11 +315,6 @@ type="textarea" label="Paste an invoice *" > -
{{ send.invoice.fsat }} sat

- Memo: {{ send.invoice.description }}
+ Description: {{ send.invoice.description }}
Expire date: {{ send.invoice.expireDate }}
Hash: {{ send.invoice.hash }}

@@ -363,8 +369,21 @@ + + +
+ +
+
+ Cancel +
+
+
+ - +