- {% raw %}
-
- ID: {{ qrCodeDialog.data.id }}
-
- {% endraw %}
+ Copy LNURL
+
Copy LNURL
+ color="primary"
+ :label="'Switch PIN:' + switch_[0]"
+ @click="lnurlValueFetch(switch_[3])"
+ >
Close
@@ -333,11 +527,14 @@
mixins: [windowMixin],
data: function () {
return {
+ tab: 'mails',
protocol: window.location.protocol,
location: window.location.hostname,
wslocation: window.location.hostname,
filter: '',
currency: 'USD',
+ lnurlValue: '',
+ switches: 0,
lnurldeviceLinks: [],
lnurldeviceLinksObj: [],
devices: [
@@ -386,12 +583,6 @@
label: 'device',
field: 'device'
},
- {
- name: 'profit',
- align: 'left',
- label: 'profit',
- field: 'profit'
- },
{
name: 'currency',
align: 'left',
@@ -440,8 +631,20 @@
this.qrCodeDialog.data = _.clone(lnurldevice)
this.qrCodeDialog.data.url =
window.location.protocol + '//' + window.location.host
+ this.lnurlValueFetch(this.qrCodeDialog.data.switches[0][3])
this.qrCodeDialog.show = true
},
+ lnurlValueFetch: function (lnurl) {
+ this.lnurlValue = lnurl
+ },
+ addSwitch: function () {
+ var self = this
+ self.switches = self.switches + 1
+ },
+ removeSwitch: function () {
+ var self = this
+ self.switches = self.switches - 1
+ },
cancellnurldevice: function (data) {
var self = this
self.formDialoglnurldevice.show = false
@@ -498,7 +701,9 @@
.then(function (response) {
if (response.data) {
self.lnurldeviceLinks = response.data.map(maplnurldevice)
+ console.log('response.data')
console.log(response.data)
+ console.log('response.data')
}
})
.catch(function (error) {
@@ -592,7 +797,7 @@
LNbits.utils.notifyApiError(error)
})
},
- clearFormDialoglnurldevice() {
+ clearFormDialoglnurldevice () {
this.formDialoglnurldevice.data = {
lnurl_toggle: false,
show_message: false,
diff --git a/lnbits/extensions/lnurldevice/views.py b/lnbits/extensions/lnurldevice/views.py
index 5c6eba24..f435931b 100644
--- a/lnbits/extensions/lnurldevice/views.py
+++ b/lnbits/extensions/lnurldevice/views.py
@@ -103,8 +103,10 @@ async def websocket_endpoint(websocket: WebSocket, lnurldevice_id: str):
manager.disconnect(websocket)
-async def updater(lnurldevice_id):
+async def updater(lnurldevice_id, lnurldevice_pin, lnurldevice_amount):
lnurldevice = await get_lnurldevice(lnurldevice_id)
if not lnurldevice:
return
- await manager.send_personal_message(f"{lnurldevice.amount}", lnurldevice_id)
+ return await manager.send_personal_message(
+ f"{lnurldevice_pin}-{lnurldevice_amount}", lnurldevice_id
+ )
diff --git a/lnbits/extensions/lnurldevice/views_api.py b/lnbits/extensions/lnurldevice/views_api.py
index c034f66e..c6766423 100644
--- a/lnbits/extensions/lnurldevice/views_api.py
+++ b/lnbits/extensions/lnurldevice/views_api.py
@@ -39,10 +39,10 @@ async def api_lnurldevice_create_or_update(
):
if not lnurldevice_id:
lnurldevice = await create_lnurldevice(data)
- return {**lnurldevice.dict(), **{"lnurl": lnurldevice.lnurl(req)}}
+ return {**lnurldevice.dict(), **{"switches": lnurldevice.switches(req)}}
else:
lnurldevice = await update_lnurldevice(data, lnurldevice_id=lnurldevice_id)
- return {**lnurldevice.dict(), **{"lnurl": lnurldevice.lnurl(req)}}
+ return {**lnurldevice.dict(), **{"switches": lnurldevice.switches(req)}}
@lnurldevice_ext.get("/api/v1/lnurlpos")
@@ -52,7 +52,7 @@ async def api_lnurldevices_retrieve(
wallet_ids = (await get_user(wallet.wallet.user)).wallet_ids
try:
return [
- {**lnurldevice.dict(), **{"lnurl": lnurldevice.lnurl(req)}}
+ {**lnurldevice.dict(), **{"switches": lnurldevice.switches(req)}}
for lnurldevice in await get_lnurldevices(wallet_ids)
]
except:
@@ -78,7 +78,7 @@ async def api_lnurldevice_retrieve(
)
if not lnurldevice.lnurl_toggle:
return {**lnurldevice.dict()}
- return {**lnurldevice.dict(), **{"lnurl": lnurldevice.lnurl(req)}}
+ return {**lnurldevice.dict(), **{"switches": lnurldevice.switches(req)}}
@lnurldevice_ext.delete("/api/v1/lnurlpos/{lnurldevice_id}")