fix require admin key endpoints
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import asyncio
|
||||
|
||||
from fastapi import APIRouter, FastAPI
|
||||
from fastapi import APIRouter
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from starlette.routing import Mount
|
||||
|
||||
from lnbits.db import Database
|
||||
from lnbits.helpers import template_renderer
|
||||
@@ -29,10 +28,10 @@ def lnurlp_renderer():
|
||||
return template_renderer(["lnbits/extensions/lnurlp/templates"])
|
||||
|
||||
|
||||
from .views_api import * # noqa
|
||||
from .views import * # noqa
|
||||
from .tasks import wait_for_paid_invoices
|
||||
from .lnurl import * # noqa
|
||||
from .tasks import wait_for_paid_invoices
|
||||
from .views import * # noqa
|
||||
from .views_api import * # noqa
|
||||
|
||||
|
||||
def lnurlp_start():
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import hashlib
|
||||
import math
|
||||
from http import HTTPStatus
|
||||
from fastapi import FastAPI, Request
|
||||
from starlette.exceptions import HTTPException
|
||||
from lnurl import (
|
||||
LnurlPayResponse,
|
||||
LnurlPayActionResponse,
|
||||
|
||||
from fastapi import Request
|
||||
from lnurl import ( # type: ignore
|
||||
LnurlErrorResponse,
|
||||
) # type: ignore
|
||||
LnurlPayActionResponse,
|
||||
LnurlPayResponse,
|
||||
)
|
||||
from starlette.exceptions import HTTPException
|
||||
|
||||
from lnbits.core.services import create_invoice
|
||||
from lnbits.utils.exchange_rates import get_fiat_rate_satoshis
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
from http import HTTPStatus
|
||||
|
||||
from fastapi import Request
|
||||
from fastapi.params import Depends
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
|
||||
from lnbits.core.models import User
|
||||
from lnbits.decorators import check_user_exists
|
||||
|
||||
from . import lnurlp_ext, lnurlp_renderer
|
||||
from .crud import get_pay_link
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.params import Depends
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
from lnbits.core.models import User
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
|
||||
@lnurlp_ext.get("/", response_class=HTMLResponse)
|
||||
# @validate_uuids(["usr"], required=True)
|
||||
# @check_user_exists()
|
||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
return lnurlp_renderer().TemplateResponse(
|
||||
"lnurlp/index.html", {"request": request, "user": user.dict()}
|
||||
@@ -31,7 +29,6 @@ async def display(request: Request, link_id):
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.NOT_FOUND, detail="Pay link does not exist."
|
||||
)
|
||||
# abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
||||
ctx = {"request": request, "lnurl": link.lnurl(req=request)}
|
||||
return lnurlp_renderer().TemplateResponse("lnurlp/display.html", ctx)
|
||||
|
||||
@@ -43,6 +40,5 @@ async def print_qr(request: Request, link_id):
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.NOT_FOUND, detail="Pay link does not exist."
|
||||
)
|
||||
# abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
||||
ctx = {"request": request, "lnurl": link.lnurl(req=request)}
|
||||
return lnurlp_renderer().TemplateResponse("lnurlp/print_qr.html", ctx)
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
from typing import Optional
|
||||
from fastapi.params import Depends
|
||||
from fastapi.param_functions import Query
|
||||
from pydantic.main import BaseModel
|
||||
|
||||
from http import HTTPStatus
|
||||
|
||||
from fastapi import Request
|
||||
from fastapi.param_functions import Query
|
||||
from fastapi.params import Depends
|
||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
||||
from starlette.exceptions import HTTPException
|
||||
from fastapi import Request
|
||||
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
|
||||
|
||||
from lnbits.core.crud import get_user
|
||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||
from lnbits.utils.exchange_rates import currencies, get_fiat_rate_satoshis
|
||||
from .models import CreatePayLinkData
|
||||
|
||||
from . import lnurlp_ext
|
||||
from .crud import (
|
||||
create_pay_link,
|
||||
delete_pay_link,
|
||||
get_pay_link,
|
||||
get_pay_links,
|
||||
update_pay_link,
|
||||
delete_pay_link,
|
||||
)
|
||||
from .models import CreatePayLinkData
|
||||
|
||||
|
||||
@lnurlp_ext.get("/api/v1/currencies")
|
||||
|
||||
Reference in New Issue
Block a user