From 0f73501a889701ce8e15fc9a0d7211ecdec64fee Mon Sep 17 00:00:00 2001 From: calle <93376500+callebtc@users.noreply.github.com> Date: Tue, 19 Jul 2022 17:20:50 +0200 Subject: [PATCH] LNURLw: NFC fix uri prefix (#761) * fix uri prefix * prettier --- lnbits/extensions/withdraw/static/js/index.js | 4 +- .../withdraw/templates/withdraw/display.html | 37 +------------------ 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/lnbits/extensions/withdraw/static/js/index.js b/lnbits/extensions/withdraw/static/js/index.js index a2563d84..1a811d4f 100644 --- a/lnbits/extensions/withdraw/static/js/index.js +++ b/lnbits/extensions/withdraw/static/js/index.js @@ -249,7 +249,9 @@ new Vue({ message: 'Tap your NFC tag now to write the LNURLw to it' }) - await ndef.write(lnurl) + await ndef.write({ + records: [{recordType: 'url', data: 'lnurlw://' + lnurl, lang: 'en'}] + }) this.nfcTagWriting = false this.$q.notify({ diff --git a/lnbits/extensions/withdraw/templates/withdraw/display.html b/lnbits/extensions/withdraw/templates/withdraw/display.html index 0c523b27..1e632741 100644 --- a/lnbits/extensions/withdraw/templates/withdraw/display.html +++ b/lnbits/extensions/withdraw/templates/withdraw/display.html @@ -13,7 +13,8 @@ :value="this.here + '/?lightning={{lnurl }}'" :options="{width: 800}" class="rounded-borders" - > + > + @@ -61,40 +62,6 @@ here: location.protocol + '//' + location.host, nfcTagWriting: false } - }, - methods: { - writeNfcTag: async function (lnurl) { - try { - if (typeof NDEFReader == 'undefined') { - throw { - toString: function () { - return 'NFC not supported on this device and/or browser.' - } - } - } - - const ndef = new NDEFReader() - - this.nfcTagWriting = true - this.$q.notify({ - message: 'Tap your NFC tag now to write the LNURLw to it' - }) - - await ndef.write(lnurl) - - this.nfcTagWriting = false - this.$q.notify({ - message: 'NFC Tag written successfully!' - }) - } catch (error) { - this.nfcTagWriting = false - this.$q.notify({ - message: error - ? error.toString() - : 'An unexpected error has occurred' - }) - } - } } })