mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-09 20:12:34 +02:00
Merge branch 'bensbits' into ext-boltcards-2
This commit is contained in:
@@ -26,6 +26,7 @@ new Vue({
|
|||||||
k0: '',
|
k0: '',
|
||||||
k1: '',
|
k1: '',
|
||||||
k2: '',
|
k2: '',
|
||||||
|
uid: '',
|
||||||
card_name: ''
|
card_name: ''
|
||||||
},
|
},
|
||||||
temp: {}
|
temp: {}
|
||||||
@@ -146,6 +147,64 @@ new Vue({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
readNfcTag: function () {
|
||||||
|
try {
|
||||||
|
const self = this
|
||||||
|
|
||||||
|
if (typeof NDEFReader == 'undefined') {
|
||||||
|
throw {
|
||||||
|
toString: function () {
|
||||||
|
return 'NFC not supported on this device or browser.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ndef = new NDEFReader()
|
||||||
|
|
||||||
|
const readerAbortController = new AbortController()
|
||||||
|
readerAbortController.signal.onabort = event => {
|
||||||
|
console.log('All NFC Read operations have been aborted.')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.nfcTagReading = true
|
||||||
|
this.$q.notify({
|
||||||
|
message: 'Tap your NFC tag to pay this invoice with LNURLw.'
|
||||||
|
})
|
||||||
|
|
||||||
|
return ndef.scan({signal: readerAbortController.signal}).then(() => {
|
||||||
|
ndef.onreadingerror = () => {
|
||||||
|
self.nfcTagReading = false
|
||||||
|
|
||||||
|
this.$q.notify({
|
||||||
|
type: 'negative',
|
||||||
|
message: 'There was an error reading this NFC tag.'
|
||||||
|
})
|
||||||
|
|
||||||
|
readerAbortController.abort()
|
||||||
|
}
|
||||||
|
|
||||||
|
ndef.onreading = ({message, serialNumber}) => {
|
||||||
|
//Decode NDEF data from tag
|
||||||
|
var self = this
|
||||||
|
self.cardDialog.data.uid = serialNumber
|
||||||
|
.toUpperCase()
|
||||||
|
.replaceAll(':', '')
|
||||||
|
this.$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
message: 'NFC tag read successfully.'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
this.nfcTagReading = false
|
||||||
|
this.$q.notify({
|
||||||
|
type: 'negative',
|
||||||
|
message: error
|
||||||
|
? error.toString()
|
||||||
|
: 'An unexpected error has occurred.'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
getCards: function () {
|
getCards: function () {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
|
@@ -43,7 +43,6 @@
|
|||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-th auto-width></q-th>
|
<q-th auto-width></q-th>
|
||||||
<q-th auto-width>Base URL</q-th>
|
|
||||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
{{ col.label }}
|
{{ col.label }}
|
||||||
</q-th>
|
</q-th>
|
||||||
@@ -60,18 +59,8 @@
|
|||||||
icon="qr_code"
|
icon="qr_code"
|
||||||
:color="($q.dark.isActive) ? 'grey-7' : 'grey-5'"
|
:color="($q.dark.isActive) ? 'grey-7' : 'grey-5'"
|
||||||
@click="openQrCodeDialog(props.row.id)"
|
@click="openQrCodeDialog(props.row.id)"
|
||||||
><q-tooltip>Card key credentials</q-tooltip></q-btn
|
|
||||||
>
|
|
||||||
</q-td>
|
|
||||||
<q-td auto-width>
|
|
||||||
<q-btn
|
|
||||||
outline
|
|
||||||
color="grey"
|
|
||||||
@click="copyText(lnurlLink + props.row.uid)"
|
|
||||||
lnurlLink
|
|
||||||
>lnurl://...<q-tooltip
|
|
||||||
>Click to copy, then add to NFC card</q-tooltip
|
|
||||||
>
|
>
|
||||||
|
<q-tooltip>Card key credentials</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
@@ -90,8 +79,8 @@
|
|||||||
dense
|
dense
|
||||||
@click="enableCard(props.row.wallet, props.row.id, true)"
|
@click="enableCard(props.row.wallet, props.row.id, true)"
|
||||||
color="green"
|
color="green"
|
||||||
>ENABLE</q-btn
|
>ENABLE
|
||||||
>
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -101,8 +90,9 @@
|
|||||||
@click="updateCardDialog(props.row.id)"
|
@click="updateCardDialog(props.row.id)"
|
||||||
icon="edit"
|
icon="edit"
|
||||||
color="light-blue"
|
color="light-blue"
|
||||||
><q-tooltip>Edit card</q-tooltip></q-btn
|
|
||||||
>
|
>
|
||||||
|
<q-tooltip>Edit card</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -112,10 +102,11 @@
|
|||||||
@click="deleteCard(props.row.id)"
|
@click="deleteCard(props.row.id)"
|
||||||
icon="cancel"
|
icon="cancel"
|
||||||
color="pink"
|
color="pink"
|
||||||
><q-tooltip
|
|
||||||
>Deleting card will also delete all records</q-tooltip
|
|
||||||
></q-btn
|
|
||||||
>
|
>
|
||||||
|
<q-tooltip
|
||||||
|
>Deleting card will also delete all records</q-tooltip
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
@@ -257,7 +248,8 @@
|
|||||||
v-model.trim="cardDialog.data.card_name"
|
v-model.trim="cardDialog.data.card_name"
|
||||||
type="text"
|
type="text"
|
||||||
label="Card name "
|
label="Card name "
|
||||||
></q-input>
|
>
|
||||||
|
</q-input>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<q-input
|
<q-input
|
||||||
@@ -267,10 +259,11 @@
|
|||||||
v-model.trim="cardDialog.data.uid"
|
v-model.trim="cardDialog.data.uid"
|
||||||
type="text"
|
type="text"
|
||||||
label="Card UID "
|
label="Card UID "
|
||||||
><q-tooltip
|
|
||||||
>Get from the card you'll use, using an NFC app</q-tooltip
|
|
||||||
></q-input
|
|
||||||
>
|
>
|
||||||
|
<q-tooltip
|
||||||
|
>Get from the card you'll use, using an NFC app</q-tooltip
|
||||||
|
>
|
||||||
|
</q-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 q-pl-sm">
|
<div class="col-2 q-pl-sm">
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -279,8 +272,10 @@
|
|||||||
color="grey"
|
color="grey"
|
||||||
icon="nfc"
|
icon="nfc"
|
||||||
:disable="nfcTagReading"
|
:disable="nfcTagReading"
|
||||||
><q-tooltip>Tap card to scan UID (coming soon)</q-tooltip></q-btn
|
@click="readNfcTag()"
|
||||||
>
|
>
|
||||||
|
<q-tooltip>Tap card to scan UID</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -322,10 +317,11 @@
|
|||||||
v-model.number="cardDialog.data.counter"
|
v-model.number="cardDialog.data.counter"
|
||||||
type="number"
|
type="number"
|
||||||
label="Initial counter"
|
label="Initial counter"
|
||||||
><q-tooltip class="bg-grey-8" anchor="bottom left" self="top left"
|
|
||||||
>Zero if you don't know.</q-tooltip
|
|
||||||
></q-input
|
|
||||||
>
|
>
|
||||||
|
<q-tooltip class="bg-grey-8" anchor="bottom left" self="top left"
|
||||||
|
>Zero if you don't know.</q-tooltip
|
||||||
|
>
|
||||||
|
</q-input>
|
||||||
<q-btn
|
<q-btn
|
||||||
unelevated
|
unelevated
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -350,8 +346,8 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
:disable="cardDialog.data.uid == null"
|
:disable="cardDialog.data.uid == null"
|
||||||
type="submit"
|
type="submit"
|
||||||
>Create Card</q-btn
|
>Create Card
|
||||||
>
|
</q-btn>
|
||||||
<q-btn v-close-popup flat color="grey" class="q-ml-auto"
|
<q-btn v-close-popup flat color="grey" class="q-ml-auto"
|
||||||
>Cancel</q-btn
|
>Cancel</q-btn
|
||||||
>
|
>
|
||||||
@@ -371,7 +367,7 @@
|
|||||||
></qrcode>
|
></qrcode>
|
||||||
</q-responsive>
|
</q-responsive>
|
||||||
<p style="word-break: break-all" class="text-center">
|
<p style="word-break: break-all" class="text-center">
|
||||||
(QR code is for setting the keys with bolt-nfc-android-app)
|
(Keys for bolt-nfc-android-app)
|
||||||
</p>
|
</p>
|
||||||
<p style="word-break: break-all">
|
<p style="word-break: break-all">
|
||||||
<strong>Name:</strong> {{ qrCodeDialog.data.name }}<br />
|
<strong>Name:</strong> {{ qrCodeDialog.data.name }}<br />
|
||||||
@@ -380,6 +376,26 @@
|
|||||||
<strong>Meta key:</strong> {{ qrCodeDialog.data.k1 }}<br />
|
<strong>Meta key:</strong> {{ qrCodeDialog.data.k1 }}<br />
|
||||||
<strong>File key:</strong> {{ qrCodeDialog.data.k2 }}<br />
|
<strong>File key:</strong> {{ qrCodeDialog.data.k2 }}<br />
|
||||||
</p>
|
</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
outline
|
||||||
|
color="grey"
|
||||||
|
@click="copyText(lnurlLink + qrCodeDialog.data.uid)"
|
||||||
|
label="Base url (LNURL://)"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
outline
|
||||||
|
color="grey"
|
||||||
|
@click="copyText(qrCodeDialog.data.link)"
|
||||||
|
label="Keys/Auth link"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
<q-tooltip>Click to copy, then add to NFC card</q-tooltip>
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
<div class="row q-mt-lg q-gutter-sm">
|
<div class="row q-mt-lg q-gutter-sm">
|
||||||
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
|
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
|
||||||
|
Reference in New Issue
Block a user