This commit is contained in:
dni ⚡ 2024-10-16 15:52:13 +02:00
commit 8394e56f5d
No known key found for this signature in database
GPG key ID: D1F416F29AD26E87
4 changed files with 36 additions and 34 deletions

View file

@ -8,11 +8,9 @@
<q-badge color="red" class="q-mb-md">Withdraw is spent.</q-badge> <q-badge color="red" class="q-mb-md">Withdraw is spent.</q-badge>
{% endif %} {% endif %}
<a class="text-secondary" href="lightning:{{ lnurl }}"> <a class="text-secondary" href="lightning:{{ lnurl }}">
<q-responsive :ratio="1" class="q-mx-md"> <lnbits-qrcode
<lnbits-qrcode :value="this.here + '/?lightning={{lnurl }}'"
:value="this.here + '/?lightning={{lnurl }}'" ></lnbits-qrcode>
></lnbits-qrcode>
</q-responsive>
</a> </a>
</div> </div>
<div class="row q-mt-lg q-gutter-sm"> <div class="row q-mt-lg q-gutter-sm">

View file

@ -38,14 +38,16 @@
v-model:pagination="withdrawLinksTable.pagination" v-model:pagination="withdrawLinksTable.pagination"
@request="getWithdrawLinks" @request="getWithdrawLinks"
> >
{% raw %}
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
<q-th auto-width></q-th> <q-th auto-width></q-th>
<q-th auto-width></q-th> <q-th auto-width></q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props"> <q-th
{{ col.label }} v-for="col in props.cols"
</q-th> :key="col.name"
:props="props"
v-text="col.label"
></q-th>
<q-th auto-width></q-th> <q-th auto-width></q-th>
</q-tr> </q-tr>
</template> </template>
@ -114,17 +116,22 @@
color="pink" color="pink"
></q-btn> ></q-btn>
</q-td> </q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td
{{ col.value }} v-for="col in props.cols"
:key="col.name"
:props="props"
v-text="col.value"
>
</q-td> </q-td>
<q-td> <q-td>
<q-icon v-if="props.row.webhook_url" size="14px" name="http"> <q-icon v-if="props.row.webhook_url" size="14px" name="http">
<q-tooltip>Webhook to {{ props.row.webhook_url}}</q-tooltip> <q-tooltip
>Webhook to <span v-text="props.row.webhook_url"></span
></q-tooltip>
</q-icon> </q-icon>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
{% endraw %}
</q-table> </q-table>
</q-card-section> </q-card-section>
</q-card> </q-card>
@ -408,32 +415,29 @@
<q-dialog v-model="qrCodeDialog.show" position="top"> <q-dialog v-model="qrCodeDialog.show" position="top">
<q-card v-if="qrCodeDialog.data" class="q-pa-lg lnbits__dialog-card"> <q-card v-if="qrCodeDialog.data" class="q-pa-lg lnbits__dialog-card">
<q-responsive :ratio="1" class="q-mx-xl q-mb-md"> <lnbits-qrcode
<lnbits-qrcode :value="qrCodeDialog.data.url + '/?lightning=' + qrCodeDialog.data.lnurl"
:value="qrCodeDialog.data.url + '/?lightning=' + qrCodeDialog.data.lnurl" ></lnbits-qrcode>
></lnbits-qrcode>
{% raw %}
</q-responsive>
<p style="word-break: break-all"> <p style="word-break: break-all">
<strong>ID:</strong> {{ qrCodeDialog.data.id }}<br /> <strong>ID:</strong> <span v-text="qrCodeDialog.data.id"></span><br />
<strong>Unique:</strong> {{ qrCodeDialog.data.is_unique }}<span <strong>Unique:</strong>
v-if="qrCodeDialog.data.is_unique" <span v-text="qrCodeDialog.data.is_unique"></span>
class="text-deep-purple" <span v-if="qrCodeDialog.data.is_unique" class="text-deep-purple">
>
(QR code will change after each withdrawal)</span (QR code will change after each withdrawal)</span
><br /> ><br />
<strong>Max. withdrawable:</strong> {{ <strong>Max. withdrawable:</strong>
qrCodeDialog.data.max_withdrawable }} sat<br /> <span v-text="qrCodeDialog.data.max_withdrawable"></span> sat<br />
<strong>Wait time:</strong> {{ qrCodeDialog.data.wait_time }} seconds<br /> <strong>Wait time:</strong>
<strong>Withdraws:</strong> {{ qrCodeDialog.data.used }} / {{ <span v-text="qrCodeDialog.data.wait_time"></span> seconds<br />
qrCodeDialog.data.uses }} <strong>Withdraws:</strong>
<span v-text="qrCodeDialog.data.used"></span>/
<span v-text="qrCodeDialog.data.uses"></span><br />
<q-linear-progress <q-linear-progress
:value="qrCodeDialog.data.used / qrCodeDialog.data.uses" :value="qrCodeDialog.data.used / qrCodeDialog.data.uses"
color="primary" color="primary"
class="q-mt-sm" class="q-mt-sm"
></q-linear-progress> ></q-linear-progress>
</p> </p>
{% endraw %}
<div class="row q-mt-lg q-gutter-sm"> <div class="row q-mt-lg q-gutter-sm">
<q-btn <q-btn
outline outline

View file

@ -36,7 +36,7 @@ async def display(request: Request, link_id):
"withdraw/display.html", "withdraw/display.html",
{ {
"request": request, "request": request,
"link": link.dict(), "link": link.json(),
"lnurl": link.lnurl(req=request), "lnurl": link.lnurl(req=request),
"unique": True, "unique": True,
}, },
@ -83,7 +83,7 @@ async def print_qr(request: Request, link_id):
return withdraw_renderer().TemplateResponse( return withdraw_renderer().TemplateResponse(
"withdraw/print_qr.html", "withdraw/print_qr.html",
{"request": request, "link": link.dict(), "unique": False}, {"request": request, "link": link.json(), "unique": False},
) )
links = [] links = []
count = 0 count = 0
@ -130,7 +130,7 @@ async def csv(request: Request, link_id):
return withdraw_renderer().TemplateResponse( return withdraw_renderer().TemplateResponse(
"withdraw/csv.html", "withdraw/csv.html",
{"request": request, "link": link.dict(), "unique": False}, {"request": request, "link": link.json(), "unique": False},
) )
links = [] links = []
count = 0 count = 0

View file

@ -9,8 +9,8 @@ import shortuuid
from fastapi import APIRouter, HTTPException, Request, Response from fastapi import APIRouter, HTTPException, Request, Response
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from fastapi.routing import APIRoute from fastapi.routing import APIRoute
from lnbits.core.models import Payment
from lnbits.core.crud import update_payment from lnbits.core.crud import update_payment
from lnbits.core.models import Payment
from lnbits.core.services import pay_invoice from lnbits.core.services import pay_invoice
from loguru import logger from loguru import logger