-
-
- {% raw %}
-
-
- ID: {{ qrCodeDialog.data.id }}
- Unique: {{ qrCodeDialog.data.is_unique }}
+
+
+
+
+ {% raw %}
+
+
+ ID: {{ qrCodeDialog.data.id }}
+ Unique: {{ qrCodeDialog.data.is_unique }}
(QR code will change after each withdrawal)
Max. withdrawable: {{
@@ -356,4 +245,4 @@
-{% endblock %}
+{% endblock %}
\ No newline at end of file
diff --git a/lnbits/extensions/withdraw/views.py b/lnbits/extensions/withdraw/views.py
index c409919a..81aeef98 100644
--- a/lnbits/extensions/withdraw/views.py
+++ b/lnbits/extensions/withdraw/views.py
@@ -102,3 +102,37 @@ async def print_qr(request: Request, link_id):
return withdraw_renderer().TemplateResponse(
"withdraw/print_qr.html", {"request": request, "link": linked, "unique": True}
)
+
+@withdraw_ext.get("/csv/{link_id}", response_class=HTMLResponse)
+async def print_qr(request: Request, link_id):
+ link = await get_withdraw_link(link_id)
+ if not link:
+ raise HTTPException(
+ status_code=HTTPStatus.NOT_FOUND, detail="Withdraw link does not exist."
+ )
+ # response.status_code = HTTPStatus.NOT_FOUND
+ # return "Withdraw link does not exist."
+
+ if link.uses == 0:
+
+ return withdraw_renderer().TemplateResponse(
+ "withdraw/csv.html",
+ {"request": request, "link": link.dict(), "unique": False},
+ )
+ links = []
+ count = 0
+
+ for x in link.usescsv.split(","):
+ linkk = await get_withdraw_link(link_id, count)
+ if not linkk:
+ raise HTTPException(
+ status_code=HTTPStatus.NOT_FOUND, detail="Withdraw link does not exist."
+ )
+ links.append(str(linkk.lnurl(request)))
+ count = count + 1
+ page_link = list(chunks(links, 2))
+ linked = list(chunks(page_link, 5))
+
+ return withdraw_renderer().TemplateResponse(
+ "withdraw/csv.html", {"request": request, "link": linked, "unique": True}
+ )
\ No newline at end of file