From 3acfaf6fbda00a7788a49736477cb6bde7928a2e Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Fri, 16 Apr 2021 21:59:45 +0100 Subject: [PATCH] dwasdv --- lnbits/extensions/copilot/lnurl.py | 2 +- lnbits/extensions/copilot/views.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lnbits/extensions/copilot/lnurl.py b/lnbits/extensions/copilot/lnurl.py index bb178b2f4..c7878a160 100644 --- a/lnbits/extensions/copilot/lnurl.py +++ b/lnbits/extensions/copilot/lnurl.py @@ -67,7 +67,7 @@ async def lnurl_callback(cp_id): wallet_id=cp.wallet, amount=int(amount_received / 1000), memo=cp.lnurl_title, - webhook="/copilot/api/v1/copilot/hook/" + cp_id + "/" + str(amount_received), + webhook=url_for("copilot.lnurl_callback", copilot=cp_id, amount=int(amount_received / 1000), _external=True), description_hash=hashlib.sha256((LnurlPayMetadata(json.dumps([["text/plain", str(cp.lnurl_title)]]))).encode("utf-8")).digest(), extra={"tag": "copilot", "comment": comment}, ) diff --git a/lnbits/extensions/copilot/views.py b/lnbits/extensions/copilot/views.py index 30b0b3570..b36752a8c 100644 --- a/lnbits/extensions/copilot/views.py +++ b/lnbits/extensions/copilot/views.py @@ -64,8 +64,10 @@ async def panel(copilot_id): return await render_template("copilot/panel.html", copilot=copilot) -@copilot_ext.route("/api/v1/copilot/hook//", methods=["GET"]) -async def api_copilot_hooker(copilot_id, amount): +@copilot_ext.route("/api/v1/copilot/hook/", methods=["GET"]) +async def api_copilot_hooker(): + copilot_id = request.args.get("copilot") + amount = request.args.get("amount") copilot = await get_copilot(copilot_id) print("amount") if not copilot: