Black
This commit is contained in:
parent
aefd1fad69
commit
bb84f6b0e8
3 changed files with 65 additions and 25 deletions
|
|
@ -13,18 +13,27 @@ from loguru import logger
|
||||||
|
|
||||||
from lnbits import bolt11
|
from lnbits import bolt11
|
||||||
from lnbits.db import Connection
|
from lnbits.db import Connection
|
||||||
from lnbits.decorators import (WalletTypeInfo, get_key_type, require_admin_key,
|
from lnbits.decorators import (
|
||||||
require_invoice_key)
|
WalletTypeInfo,
|
||||||
|
get_key_type,
|
||||||
|
require_admin_key,
|
||||||
|
require_invoice_key,
|
||||||
|
)
|
||||||
from lnbits.helpers import url_for, urlsafe_short_hash
|
from lnbits.helpers import url_for, urlsafe_short_hash
|
||||||
from lnbits.requestvars import g
|
from lnbits.requestvars import g
|
||||||
from lnbits.settings import (FAKE_WALLET, RESERVE_FEE_MIN, RESERVE_FEE_PERCENT,
|
from lnbits.settings import FAKE_WALLET, RESERVE_FEE_MIN, RESERVE_FEE_PERCENT, WALLET
|
||||||
WALLET)
|
|
||||||
from lnbits.wallets.base import PaymentResponse, PaymentStatus
|
from lnbits.wallets.base import PaymentResponse, PaymentStatus
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
from .crud import (check_internal, create_payment, delete_wallet_payment,
|
from .crud import (
|
||||||
get_wallet, get_wallet_payment, update_payment_details,
|
check_internal,
|
||||||
update_payment_status)
|
create_payment,
|
||||||
|
delete_wallet_payment,
|
||||||
|
get_wallet,
|
||||||
|
get_wallet_payment,
|
||||||
|
update_payment_details,
|
||||||
|
update_payment_status,
|
||||||
|
)
|
||||||
from .models import Payment
|
from .models import Payment
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@ from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import pyqrcode
|
import pyqrcode
|
||||||
from fastapi import (Depends, Header, Query, Request, WebSocket,
|
from fastapi import Depends, Header, Query, Request, WebSocket, WebSocketDisconnect
|
||||||
WebSocketDisconnect)
|
|
||||||
from fastapi.exceptions import HTTPException
|
from fastapi.exceptions import HTTPException
|
||||||
from fastapi.params import Body
|
from fastapi.params import Body
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
@ -24,20 +23,42 @@ from starlette.responses import HTMLResponse, StreamingResponse
|
||||||
import async_timeout
|
import async_timeout
|
||||||
from lnbits import bolt11, lnurl
|
from lnbits import bolt11, lnurl
|
||||||
from lnbits.core.models import Payment, Wallet
|
from lnbits.core.models import Payment, Wallet
|
||||||
from lnbits.decorators import (WalletTypeInfo, get_key_type, require_admin_key,
|
from lnbits.decorators import (
|
||||||
require_invoice_key)
|
WalletTypeInfo,
|
||||||
|
get_key_type,
|
||||||
|
require_admin_key,
|
||||||
|
require_invoice_key,
|
||||||
|
)
|
||||||
from lnbits.helpers import url_for, urlsafe_short_hash
|
from lnbits.helpers import url_for, urlsafe_short_hash
|
||||||
from lnbits.settings import LNBITS_ADMIN_USERS, LNBITS_SITE_TITLE, WALLET
|
from lnbits.settings import LNBITS_ADMIN_USERS, LNBITS_SITE_TITLE, WALLET
|
||||||
from lnbits.utils.exchange_rates import (currencies, fiat_amount_as_satoshis,
|
from lnbits.utils.exchange_rates import (
|
||||||
satoshis_amount_as_fiat)
|
currencies,
|
||||||
|
fiat_amount_as_satoshis,
|
||||||
|
satoshis_amount_as_fiat,
|
||||||
|
)
|
||||||
|
|
||||||
from .. import core_app, db
|
from .. import core_app, db
|
||||||
from ..crud import (create_payment, get_payments, get_standalone_payment,
|
from ..crud import (
|
||||||
get_total_balance, get_wallet, get_wallet_for_key,
|
create_payment,
|
||||||
save_balance_check, update_payment_status, update_wallet)
|
get_payments,
|
||||||
from ..services import (InvoiceFailure, PaymentFailure,
|
get_standalone_payment,
|
||||||
check_transaction_status, create_invoice, pay_invoice,
|
get_total_balance,
|
||||||
perform_lnurlauth, websocketManager, websocketUpdater)
|
get_wallet,
|
||||||
|
get_wallet_for_key,
|
||||||
|
save_balance_check,
|
||||||
|
update_payment_status,
|
||||||
|
update_wallet,
|
||||||
|
)
|
||||||
|
from ..services import (
|
||||||
|
InvoiceFailure,
|
||||||
|
PaymentFailure,
|
||||||
|
check_transaction_status,
|
||||||
|
create_invoice,
|
||||||
|
pay_invoice,
|
||||||
|
perform_lnurlauth,
|
||||||
|
websocketManager,
|
||||||
|
websocketUpdater,
|
||||||
|
)
|
||||||
from ..tasks import api_invoice_listeners
|
from ..tasks import api_invoice_listeners
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,24 @@ from lnbits.core import db
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
from lnbits.decorators import check_user_exists
|
from lnbits.decorators import check_user_exists
|
||||||
from lnbits.helpers import template_renderer, url_for
|
from lnbits.helpers import template_renderer, url_for
|
||||||
from lnbits.settings import (LNBITS_ADMIN_USERS, LNBITS_ALLOWED_USERS,
|
from lnbits.settings import (
|
||||||
LNBITS_CUSTOM_LOGO, LNBITS_SITE_TITLE,
|
LNBITS_ADMIN_USERS,
|
||||||
SERVICE_FEE)
|
LNBITS_ALLOWED_USERS,
|
||||||
|
LNBITS_CUSTOM_LOGO,
|
||||||
|
LNBITS_SITE_TITLE,
|
||||||
|
SERVICE_FEE,
|
||||||
|
)
|
||||||
|
|
||||||
from ...helpers import get_valid_extensions
|
from ...helpers import get_valid_extensions
|
||||||
from ..crud import (create_account, create_wallet, delete_wallet,
|
from ..crud import (
|
||||||
get_balance_check, get_user, save_balance_notify,
|
create_account,
|
||||||
update_user_extension)
|
create_wallet,
|
||||||
|
delete_wallet,
|
||||||
|
get_balance_check,
|
||||||
|
get_user,
|
||||||
|
save_balance_notify,
|
||||||
|
update_user_extension,
|
||||||
|
)
|
||||||
from ..services import pay_invoice, redeem_lnurl_withdraw
|
from ..services import pay_invoice, redeem_lnurl_withdraw
|
||||||
|
|
||||||
core_html_routes: APIRouter = APIRouter(tags=["Core NON-API Website Routes"])
|
core_html_routes: APIRouter = APIRouter(tags=["Core NON-API Website Routes"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue