From 1fa7e9155c9ebfd29d8fc25a4992f28fdae22e9a Mon Sep 17 00:00:00 2001 From: benarc Date: Wed, 17 Jan 2024 13:26:04 +0000 Subject: [PATCH] fronte nd page working --- __pycache__/views.cpython-39.pyc | Bin 2256 -> 2231 bytes templates/myextension/myextension.html | 61 ++++++++++--------------- views.py | 6 +-- 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/__pycache__/views.cpython-39.pyc b/__pycache__/views.cpython-39.pyc index ca80ade14986eff07c2d2f7231a1ef0d91497ec8..4af6fe04024aeec6a58bf6fb433603ef3a8e63f3 100644 GIT binary patch delta 146 zcmca0xLuGpk(ZZ?fq{Wx(z)fSS2yxXFiUtaFff!b)G*dCG&6ZJq%e3e)H2mD6)SDF zW)^1TDpFuzU?@^#U|^VB%%Ulv!oa|w#K6E%ECVuxNnr9C7AZ!R&Bs~JGO}rdRBBD0 u#iqfiGx;!E6rZwXZ>;rZe#| zvM@3+vi)acW@BVxVq#=sWMO1suSjk4I+nAHY`P2#3`IJV8`(4%^(L=ki(=H7 j%*rm$s5V)ZJ%-V8aufRlZjhO`n2Sq_iYzDRa(Dp%LKiQ( diff --git a/templates/myextension/myextension.html b/templates/myextension/myextension.html index 66f6ba5..3c95e20 100644 --- a/templates/myextension/myextension.html +++ b/templates/myextension/myextension.html @@ -7,7 +7,7 @@ @@ -15,25 +15,36 @@
- Copy LNURLCopy LNURL -
+ +
+
+ lnurlpay + +
+
+ lnurlwithdraw + +
+
+
-
LNbits LNURL-pay link
-

Use an LNURL compatible bitcoin wallet to pay.

+
Public page
+

+ Moat extensions have a public page that can be shared + (this page will still be accessible even if you have restricted + access to your LNbits install). +
+ In this example when a user pays the LNURLpay it triggers an event via a websocket waiting for the payment. +

.

@@ -51,35 +62,13 @@ mixins: [windowMixin], data: function () { return { - lnurlpay: "{{ lnurlpay|tojson }}", - lnurlwithdraw: "{{ lnurlwithdraw|tojson }}", + qrValue: '' } }, created: function () { - if (this.g.user.wallets.length) { - this.getTemps() - } + this.qrValue = '{{lnurlpay}}' }, methods: { - copyText: function (text) { - var self = this - navigator.clipboard.writeText(text).then( - function () { - self.$q.notify({ - message: 'LNURL copied to clipboard', - color: 'positive', - icon: 'done', - }) - }, - function (err) { - self.$q.notify({ - message: 'LNURL copy failed', - color: 'negative', - icon: 'error', - }) - } - ) - }, createInvoice(walletId) { console.log(walletId) const wallet = _.findWhere(this.g.user.wallets, { diff --git a/views.py b/views.py index 6dcc99e..aaaf8ff 100644 --- a/views.py +++ b/views.py @@ -33,7 +33,7 @@ async def index(request: Request, user: User = Depends(check_user_exists)): @myextension_ext.get("/{myextension_id}") async def myextension(request: Request, myextension_id): - myextension = await get_myextension(myextension_id) + myextension = await get_myextension(myextension_id, request) if not myextension: raise HTTPException( status_code=HTTPStatus.NOT_FOUND, detail="MyExtension does not exist." @@ -43,8 +43,8 @@ async def myextension(request: Request, myextension_id): { "request": request, "myextension_id": myextension_id, - "lnurlpay": myextension.lnurlpayamount, - "lnurlwithdraw": myextension.lnurlwithdrawamount, + "lnurlpay": myextension.lnurlpay, + "lnurlwithdraw": myextension.lnurlwithdraw, "web_manifest": f"/myextension/manifest/{myextension_id}.webmanifest", }, )