mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-03 17:37:06 +01:00
parent
c2399cf9aa
commit
17c79cd044
7 changed files with 26 additions and 10 deletions
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
|||
|
||||
all: format check requirements.txt
|
||||
|
||||
format: prettier black
|
||||
format: black
|
||||
|
||||
check: mypy checkprettier checkblack
|
||||
|
||||
|
|
|
@ -14,10 +14,12 @@ tpos_ext: APIRouter = APIRouter(prefix="/tpos", tags=["TPoS"])
|
|||
def tpos_renderer():
|
||||
return template_renderer(["lnbits/extensions/tpos/templates"])
|
||||
|
||||
|
||||
from .tasks import wait_for_paid_invoices
|
||||
from .views_api import * # noqa
|
||||
from .views import * # noqa
|
||||
|
||||
|
||||
def tpos_start():
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|
||||
|
|
|
@ -13,7 +13,14 @@ async def create_tpos(wallet_id: str, data: CreateTposData) -> TPoS:
|
|||
INSERT INTO tpos.tposs (id, wallet, name, currency, tip_options, tip_wallet)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
(tpos_id, wallet_id, data.name, data.currency, data.tip_options, data.tip_wallet),
|
||||
(
|
||||
tpos_id,
|
||||
wallet_id,
|
||||
data.name,
|
||||
data.currency,
|
||||
data.tip_options,
|
||||
data.tip_wallet,
|
||||
),
|
||||
)
|
||||
|
||||
tpos = await get_tpos(tpos_id)
|
||||
|
|
|
@ -13,6 +13,7 @@ async def m001_initial(db):
|
|||
"""
|
||||
)
|
||||
|
||||
|
||||
async def m002_addtip_wallet(db):
|
||||
"""
|
||||
Add tips to tposs table
|
||||
|
@ -23,6 +24,7 @@ async def m002_addtip_wallet(db):
|
|||
"""
|
||||
)
|
||||
|
||||
|
||||
async def m003_addtip_options(db):
|
||||
"""
|
||||
Add tips to tposs table
|
||||
|
@ -31,4 +33,4 @@ async def m003_addtip_options(db):
|
|||
"""
|
||||
ALTER TABLE tpos.tposs ADD tip_options TEXT NULL;
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
|
|
@ -30,7 +30,7 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||
tipAmount = payment.extra.get("tipAmount")
|
||||
|
||||
if tipAmount is None:
|
||||
#no tip amount
|
||||
# no tip amount
|
||||
return
|
||||
|
||||
tipAmount = tipAmount * 1000
|
||||
|
|
|
@ -38,6 +38,7 @@ async def tpos(request: Request, tpos_id):
|
|||
"tpos/tpos.html", {"request": request, "tpos": tpos}
|
||||
)
|
||||
|
||||
|
||||
@tpos_ext.get("/manifest/{tpos_id}.webmanifest")
|
||||
async def manifest(tpos_id: str):
|
||||
tpos = await get_tpos(tpos_id)
|
||||
|
@ -48,10 +49,12 @@ async def manifest(tpos_id: str):
|
|||
|
||||
return {
|
||||
"short_name": LNBITS_SITE_TITLE,
|
||||
"name": tpos.name + ' - ' + LNBITS_SITE_TITLE,
|
||||
"name": tpos.name + " - " + LNBITS_SITE_TITLE,
|
||||
"icons": [
|
||||
{
|
||||
"src": LNBITS_CUSTOM_LOGO if LNBITS_CUSTOM_LOGO else "https://cdn.jsdelivr.net/gh/lnbits/lnbits@0.3.0/docs/logos/lnbits.png",
|
||||
"src": LNBITS_CUSTOM_LOGO
|
||||
if LNBITS_CUSTOM_LOGO
|
||||
else "https://cdn.jsdelivr.net/gh/lnbits/lnbits@0.3.0/docs/logos/lnbits.png",
|
||||
"type": "image/png",
|
||||
"sizes": "900x900",
|
||||
}
|
||||
|
@ -64,10 +67,10 @@ async def manifest(tpos_id: str):
|
|||
"theme_color": "#1F2234",
|
||||
"shortcuts": [
|
||||
{
|
||||
"name": tpos.name + ' - ' + LNBITS_SITE_TITLE,
|
||||
"name": tpos.name + " - " + LNBITS_SITE_TITLE,
|
||||
"short_name": tpos.name,
|
||||
"description": tpos.name + ' - ' + LNBITS_SITE_TITLE,
|
||||
"description": tpos.name + " - " + LNBITS_SITE_TITLE,
|
||||
"url": "/tpos/" + tpos_id,
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,9 @@ async def api_tpos_delete(
|
|||
|
||||
|
||||
@tpos_ext.post("/api/v1/tposs/{tpos_id}/invoices", status_code=HTTPStatus.CREATED)
|
||||
async def api_tpos_create_invoice(amount: int = Query(..., ge=1), tipAmount: int = None, tpos_id: str = None):
|
||||
async def api_tpos_create_invoice(
|
||||
amount: int = Query(..., ge=1), tipAmount: int = None, tpos_id: str = None
|
||||
):
|
||||
tpos = await get_tpos(tpos_id)
|
||||
|
||||
if not tpos:
|
||||
|
|
Loading…
Add table
Reference in a new issue