merge main

This commit is contained in:
dni ⚡ 2022-12-01 12:37:08 +01:00
commit 803c9349d4
6 changed files with 21 additions and 8 deletions

View file

@ -6,7 +6,8 @@ PORT=5000
DEBUG=false
# User IDs seperated by comma
# Allow users and admins by user IDs (comma separated list)
LNBITS_ALLOWED_USERS=""
LNBITS_ADMIN_USERS=""
# Extensions only admin can access
LNBITS_ADMIN_EXTENSIONS="ngrok, admin"

View file

@ -86,7 +86,8 @@ class Connection(Compat):
return raw_html
# tuple to list and back to tuple
values = tuple([cleanhtml(l) for l in list(values)])
value_list = [values] if isinstance(values, str) else list(values)
values = tuple([cleanhtml(l) for l in value_list])
return values
async def fetchall(self, query: str, values: tuple = ()) -> list:

View file

@ -16,6 +16,7 @@ from .models import Charges, CreateCharge, SatsPayThemes
async def create_charge(user: str, data: CreateCharge) -> Charges:
data = CreateCharge(**data.dict())
charge_id = urlsafe_short_hash()
if data.onchainwallet:
config = await get_config(user)

View file

@ -6,6 +6,10 @@ from typing import Optional
from fastapi.param_functions import Query
from pydantic import BaseModel
DEFAULT_MEMPOOL_CONFIG = (
'{"mempool_endpoint": "https://mempool.space", "network": "Mainnet"}'
)
class CreateCharge(BaseModel):
onchainwallet: str = Query(None)
@ -17,7 +21,7 @@ class CreateCharge(BaseModel):
custom_css: Optional[str]
time: int = Query(..., ge=1)
amount: int = Query(..., ge=1)
extra: str = "{}"
extra: str = DEFAULT_MEMPOOL_CONFIG
class ChargeConfig(BaseModel):
@ -38,8 +42,13 @@ class Charges(BaseModel):
webhook: Optional[str]
completelink: Optional[str]
completelinktext: Optional[str] = "Back to Merchant"
<<<<<<< HEAD
extra: str = "{}"
custom_css: Optional[str]
=======
custom_css: Optional[str]
extra: str = DEFAULT_MEMPOOL_CONFIG
>>>>>>> main
time: int
amount: int
balance: int

View file

@ -5,6 +5,7 @@ from fastapi.params import Depends
from loguru import logger
from starlette.exceptions import HTTPException
from lnbits.core.crud import get_wallet
from lnbits.decorators import (
WalletTypeInfo,
get_key_type,

View file

@ -203,7 +203,7 @@ async def update_address(id: str, **kwargs) -> Optional[Address]:
f"""UPDATE watchonly.addresses SET {q} WHERE id = ? """,
(*kwargs.values(), id),
)
row = await db.fetchone("SELECT * FROM watchonly.addresses WHERE id = ?", (id))
row = await db.fetchone("SELECT * FROM watchonly.addresses WHERE id = ?", (id,))
return Address.from_row(row) if row else None