mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-20 13:04:23 +02:00
Get donation form to load
This commit is contained in:
@@ -156,11 +156,18 @@ async def create_service(
|
|||||||
return service
|
return service
|
||||||
|
|
||||||
|
|
||||||
async def get_service(service_id: int) -> Optional[Service]:
|
async def get_service(service_id: int,
|
||||||
row = await db.fetchone(
|
by_state: str = None) -> Optional[Service]:
|
||||||
"SELECT * FROM Services WHERE id = ?",
|
if by_state:
|
||||||
(service_id,)
|
row = await db.fetchone(
|
||||||
)
|
"SELECT * FROM Services WHERE state = ?",
|
||||||
|
(by_state,)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
row = await db.fetchone(
|
||||||
|
"SELECT * FROM Services WHERE id = ?",
|
||||||
|
(service_id,)
|
||||||
|
)
|
||||||
return Service.from_row(row) if row else None
|
return Service.from_row(row) if row else None
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,9 +3,7 @@
|
|||||||
<div class="col-12 col-md-7 col-lg-6 q-gutter-y-md">
|
<div class="col-12 col-md-7 col-lg-6 q-gutter-y-md">
|
||||||
<q-card class="q-pa-lg">
|
<q-card class="q-pa-lg">
|
||||||
<q-card-section class="q-pa-none">
|
<q-card-section class="q-pa-none">
|
||||||
<h3 class="q-my-none">{{ form_name }}</h3>
|
<h3 class="q-my-none">Donate Bitcoin to {{ twitchuser }}!</h3>
|
||||||
<br />
|
|
||||||
<h5 class="q-my-none">{{ form_desc }}</h5>
|
|
||||||
<br />
|
<br />
|
||||||
<q-form @submit="Invoice()" class="q-gutter-md">
|
<q-form @submit="Invoice()" class="q-gutter-md">
|
||||||
<q-input
|
<q-input
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
from quart import g, render_template
|
from quart import g, abort, render_template
|
||||||
|
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
from http import HTTPStatus
|
||||||
|
|
||||||
from . import twitchalerts_ext
|
from . import twitchalerts_ext
|
||||||
|
from .crud import get_service
|
||||||
|
|
||||||
|
|
||||||
@twitchalerts_ext.route("/")
|
@twitchalerts_ext.route("/")
|
||||||
@@ -10,3 +12,13 @@ from . import twitchalerts_ext
|
|||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index():
|
||||||
return await render_template("twitchalerts/index.html", user=g.user)
|
return await render_template("twitchalerts/index.html", user=g.user)
|
||||||
|
|
||||||
|
|
||||||
|
@twitchalerts_ext.route("/<state>")
|
||||||
|
async def donation(state):
|
||||||
|
service = await get_service(0, by_state=state)
|
||||||
|
if not service:
|
||||||
|
abort(HTTPStatus.NOT_FOUND, "Service does not exist.")
|
||||||
|
return await render_template("twitchalerts/display.html",
|
||||||
|
twitchuser=service.twitchuser,
|
||||||
|
service=service.id)
|
||||||
|
Reference in New Issue
Block a user