Merge branch 'main' into matthewcroughan/nixify

This commit is contained in:
ben
2022-07-23 20:09:24 +01:00
114 changed files with 1720 additions and 988 deletions
+2 -4
View File
@@ -1,15 +1,13 @@
import json
import traceback
import httpx
from datetime import datetime
from http import HTTPStatus
from loguru import logger
import httpx
import shortuuid # type: ignore
from fastapi import HTTPException
from fastapi.param_functions import Query
from loguru import logger
from starlette.requests import Request
from starlette.responses import HTMLResponse # type: ignore
@@ -53,6 +53,7 @@ new Vue({
rowsPerPage: 10
}
},
nfcTagWriting: false,
formDialog: {
show: false,
secondMultiplier: 'seconds',
@@ -231,6 +232,42 @@ new Vue({
})
})
},
writeNfcTag: async function (lnurl) {
try {
if (typeof NDEFReader == 'undefined') {
throw {
toString: function () {
return 'NFC not supported on this device or browser.'
}
}
}
const ndef = new NDEFReader()
this.nfcTagWriting = true
this.$q.notify({
message: 'Tap your NFC tag to write the LNURL-withdraw link to it.'
})
await ndef.write({
records: [{recordType: 'url', data: 'lightning:' + lnurl, lang: 'en'}]
})
this.nfcTagWriting = false
this.$q.notify({
type: 'positive',
message: 'NFC tag written successfully.'
})
} catch (error) {
this.nfcTagWriting = false
this.$q.notify({
type: 'negative',
message: error
? error.toString()
: 'An unexpected error has occurred.'
})
}
},
exportCSV: function () {
LNbits.utils.exportCSV(this.paywallsTable.columns, this.paywalls)
}
@@ -13,14 +13,22 @@
:value="this.here + '/?lightning={{lnurl }}'"
:options="{width: 800}"
class="rounded-borders"
></qrcode>
>
</qrcode>
</q-responsive>
</a>
</div>
<div class="row q-mt-lg">
<div class="row q-mt-lg q-gutter-sm">
<q-btn outline color="grey" @click="copyText('{{ lnurl }}')"
>Copy LNURL</q-btn
>
<q-btn
outline
color="grey"
icon="nfc"
@click="writeNfcTag(' {{ lnurl }} ')"
:disable="nfcTagWriting"
></q-btn>
</div>
</q-card-section>
</q-card>
@@ -51,7 +59,8 @@
mixins: [windowMixin],
data: function () {
return {
here: location.protocol + '//' + location.host
here: location.protocol + '//' + location.host,
nfcTagWriting: false
}
}
})
@@ -369,6 +369,13 @@
@click="copyText(qrCodeDialog.data.withdraw_url, 'Link copied to clipboard!')"
>Shareable link</q-btn
>
<q-btn
outline
color="grey"
icon="nfc"
@click="writeNfcTag(qrCodeDialog.data.lnurl)"
:disable="nfcTagWriting"
></q-btn>
<q-btn
outline
color="grey"