mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-28 04:46:18 +02:00
move scan to outside of receive.
This commit is contained in:
@@ -136,7 +136,7 @@ new Vue({
|
|||||||
bolt11: ''
|
bolt11: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sendCamera: {
|
theCamera: {
|
||||||
show: false,
|
show: false,
|
||||||
camera: 'auto'
|
camera: 'auto'
|
||||||
},
|
},
|
||||||
@@ -206,11 +206,17 @@ new Vue({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// closeCamera: function () {
|
||||||
|
// this.sendCamera.show = false
|
||||||
|
// },
|
||||||
|
// showCamera: function () {
|
||||||
|
// this.sendCamera.show = true
|
||||||
|
// },
|
||||||
closeCamera: function () {
|
closeCamera: function () {
|
||||||
this.sendCamera.show = false
|
this.theCamera.show = false
|
||||||
},
|
},
|
||||||
showCamera: function () {
|
showCamera: function () {
|
||||||
this.sendCamera.show = true
|
this.theCamera.show = true
|
||||||
},
|
},
|
||||||
showChart: function () {
|
showChart: function () {
|
||||||
this.paymentsChart.show = true
|
this.paymentsChart.show = true
|
||||||
@@ -247,7 +253,7 @@ new Vue({
|
|||||||
}, 10000)
|
}, 10000)
|
||||||
},
|
},
|
||||||
closeSendDialog: function () {
|
closeSendDialog: function () {
|
||||||
this.sendCamera.show = false
|
// this.sendCamera.show = false
|
||||||
var checker = this.send.paymentChecker
|
var checker = this.send.paymentChecker
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
clearInterval(checker)
|
clearInterval(checker)
|
||||||
@@ -284,10 +290,26 @@ new Vue({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
decodeQR: function (res) {
|
decodeQR: function (res) {
|
||||||
this.send.data.bolt11 = res
|
if (res.substring(0, 4) == 'lnurl') {
|
||||||
this.decodeInvoice()
|
console.log(res)
|
||||||
this.sendCamera.show = false
|
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 () {
|
decodeInvoice: function () {
|
||||||
if (this.send.data.bolt11.startsWith('lightning:')) {
|
if (this.send.data.bolt11.startsWith('lightning:')) {
|
||||||
this.send.data.bolt11 = this.send.data.bolt11.slice(10)
|
this.send.data.bolt11 = this.send.data.bolt11.slice(10)
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<q-btn
|
<q-btn
|
||||||
unelevated
|
unelevated
|
||||||
color="purple"
|
color="deep-purple"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
@click="showSendDialog"
|
@click="showSendDialog"
|
||||||
>Send</q-btn
|
>Send</q-btn
|
||||||
@@ -29,6 +29,16 @@
|
|||||||
>Receive</q-btn
|
>Receive</q-btn
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
color="purple"
|
||||||
|
icon="photo_camera"
|
||||||
|
@click="showCamera"
|
||||||
|
>scan
|
||||||
|
<q-tooltip>Use camera to scan an invoice/QR</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
@@ -187,6 +197,7 @@
|
|||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-md-5 q-gutter-y-md">
|
<div class="col-12 col-md-5 q-gutter-y-md">
|
||||||
<q-card>
|
<q-card>
|
||||||
@@ -304,11 +315,6 @@
|
|||||||
type="textarea"
|
type="textarea"
|
||||||
label="Paste an invoice *"
|
label="Paste an invoice *"
|
||||||
>
|
>
|
||||||
<template v-slot:after>
|
|
||||||
<q-btn round dense flat icon="photo_camera" @click="showCamera">
|
|
||||||
<q-tooltip>Use camera to scan an invoice</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</template>
|
|
||||||
</q-input>
|
</q-input>
|
||||||
<div class="row q-mt-lg">
|
<div class="row q-mt-lg">
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -342,7 +348,7 @@
|
|||||||
<h6 class="q-my-none">{{ send.invoice.fsat }} sat</h6>
|
<h6 class="q-my-none">{{ send.invoice.fsat }} sat</h6>
|
||||||
<q-separator class="q-my-sm"></q-separator>
|
<q-separator class="q-my-sm"></q-separator>
|
||||||
<p style="word-break: break-all">
|
<p style="word-break: break-all">
|
||||||
<strong>Memo:</strong> {{ send.invoice.description }}<br />
|
<strong>Description:</strong> {{ send.invoice.description }}<br />
|
||||||
<strong>Expire date:</strong> {{ send.invoice.expireDate }}<br />
|
<strong>Expire date:</strong> {{ send.invoice.expireDate }}<br />
|
||||||
<strong>Hash:</strong> {{ send.invoice.hash }}
|
<strong>Hash:</strong> {{ send.invoice.hash }}
|
||||||
</p>
|
</p>
|
||||||
@@ -363,8 +369,21 @@
|
|||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
||||||
|
<q-dialog v-model="theCamera.show" position="top">
|
||||||
|
<q-card class="q-pa-lg q-pt-xl">
|
||||||
|
<div class="text-center q-mb-lg">
|
||||||
|
<qrcode-stream @decode="decodeQR" class="rounded-borders"></qrcode-stream>
|
||||||
|
</div>
|
||||||
|
<div class="row q-mt-lg">
|
||||||
|
<q-btn @click="closeCamera" flat color="grey" class="q-ml-auto"
|
||||||
|
>Cancel</q-btn
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
|
||||||
<q-dialog v-model="paymentsChart.show" position="top">
|
<q-dialog v-model="paymentsChart.show" position="top">
|
||||||
<q-card class="q-pa-sm" style="width: 800px; max-width: unset">
|
<q-card class="q-pa-sm" style="width: 800px; max-width: unset;">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<canvas ref="canvas" width="600" height="400"></canvas>
|
<canvas ref="canvas" width="600" height="400"></canvas>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
Reference in New Issue
Block a user