mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-20 13:34:47 +01:00
fix: lnurlp templates and path functions
While rendering the tempaltes the link.lnurl() function was not found as no request object was passed. Compute the lnurl before rendering the template. This way we can avoid computing it multiple times and do not to have to pass the request object in the template.
This commit is contained in:
parent
d319aca6cf
commit
c1a82dad9d
3 changed files with 8 additions and 8 deletions
|
@ -4,10 +4,10 @@
|
|||
<q-card class="q-pa-lg">
|
||||
<q-card-section class="q-pa-none">
|
||||
<div class="text-center">
|
||||
<a href="lightning:{{ link.lnurl }}">
|
||||
<a href="lightning:{{ lnurl }}">
|
||||
<q-responsive :ratio="1" class="q-mx-md">
|
||||
<qrcode
|
||||
value="{{ link.lnurl }}"
|
||||
value="{{ lnurl }}"
|
||||
:options="{width: 800}"
|
||||
class="rounded-borders"
|
||||
></qrcode>
|
||||
|
@ -15,7 +15,7 @@
|
|||
</a>
|
||||
</div>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn outline color="grey" @click="copyText('{{ link.lnurl }}')"
|
||||
<q-btn outline color="grey" @click="copyText('{{ lnurl }}')"
|
||||
>Copy LNURL</q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "print.html" %} {% block page %}
|
||||
<div class="row justify-center">
|
||||
<div class="qr">
|
||||
<qrcode value="{{ link.lnurl }}" :options="{width}"></qrcode>
|
||||
<qrcode value="{{ lnurl }}" :options="{width}"></qrcode>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %} {% block styles %}
|
||||
|
|
|
@ -30,8 +30,8 @@ async def display(request: Request,link_id):
|
|||
detail="Pay link does not exist."
|
||||
)
|
||||
# abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
||||
|
||||
return lnurlp_renderer().TemplateResponse("lnurlp/display.html", {"request": request, "link":link})
|
||||
ctx = {"request": request, "lnurl":link.lnurl(req=request)}
|
||||
return lnurlp_renderer().TemplateResponse("lnurlp/display.html", ctx)
|
||||
|
||||
|
||||
@lnurlp_ext.get("/print/{link_id}", response_class=HTMLResponse)
|
||||
|
@ -43,5 +43,5 @@ async def print_qr(request: Request,link_id):
|
|||
detail="Pay link does not exist."
|
||||
)
|
||||
# abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
||||
|
||||
return lnurlp_renderer().TemplateResponse("lnurlp/print_qr.html", {"request": request, "link":link})
|
||||
ctx = {"request": request, "lnurl":link.lnurl(req=request)}
|
||||
return lnurlp_renderer().TemplateResponse("lnurlp/print_qr.html", ctx)
|
||||
|
|
Loading…
Add table
Reference in a new issue