fix explorer
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Any
|
from typing import Annotated, Any
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, WebSocket
|
from fastapi import APIRouter, Depends, HTTPException, Request, WebSocket
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
from pydantic.types import UUID4
|
||||||
|
|
||||||
from lnbits.decorators import optional_user_id
|
from lnbits.decorators import check_access_token, check_user_exists
|
||||||
from lnbits.settings import settings
|
from lnbits.settings import settings
|
||||||
from lnbits.utils.electrum import (
|
from lnbits.utils.electrum import (
|
||||||
AddressResponse,
|
AddressResponse,
|
||||||
@@ -37,14 +38,13 @@ def _check_enabled() -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def _check_api_access(
|
async def _check_api_access(
|
||||||
user_id: str | None = Depends(optional_user_id),
|
r: Request,
|
||||||
|
access_token: Annotated[str | None, Depends(check_access_token)],
|
||||||
|
usr: UUID4 | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
_check_enabled()
|
_check_enabled()
|
||||||
if not settings.lnbits_blockexplorer_public_api and not user_id:
|
if not settings.lnbits_blockexplorer_public_api:
|
||||||
raise HTTPException(
|
await check_user_exists(r, access_token, usr)
|
||||||
status_code=HTTPStatus.UNAUTHORIZED,
|
|
||||||
detail="Authentication required.",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _client() -> ElectrumClient:
|
def _client() -> ElectrumClient:
|
||||||
|
|||||||
Reference in New Issue
Block a user