fixup!
This commit is contained in:
@@ -2,10 +2,10 @@ import asyncio
|
|||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Request, Security, WebSocket
|
from fastapi import APIRouter, Depends, HTTPException, WebSocket
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from lnbits.decorators import KeyChecker, KeyType, api_key_header, api_key_query
|
from lnbits.decorators import optional_user_id
|
||||||
from lnbits.settings import settings
|
from lnbits.settings import settings
|
||||||
from lnbits.utils.electrum import (
|
from lnbits.utils.electrum import (
|
||||||
AddressResponse,
|
AddressResponse,
|
||||||
@@ -37,17 +37,14 @@ def _check_enabled() -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def _check_api_access(
|
async def _check_api_access(
|
||||||
request: Request,
|
user_id: str | None = Depends(optional_user_id),
|
||||||
key_header: str = Security(api_key_header),
|
|
||||||
key_query: str = Security(api_key_query),
|
|
||||||
) -> None:
|
) -> None:
|
||||||
_check_enabled()
|
_check_enabled()
|
||||||
if not settings.lnbits_blockexplorer_public_api:
|
if not settings.lnbits_blockexplorer_public_api and not user_id:
|
||||||
checker = KeyChecker(
|
raise HTTPException(
|
||||||
api_key=key_header or key_query,
|
status_code=HTTPStatus.UNAUTHORIZED,
|
||||||
expected_key_type=KeyType.invoice,
|
detail="Authentication required.",
|
||||||
)
|
)
|
||||||
await checker(request)
|
|
||||||
|
|
||||||
|
|
||||||
def _client() -> ElectrumClient:
|
def _client() -> ElectrumClient:
|
||||||
|
|||||||
@@ -98,10 +98,7 @@ window.PageBlockExplorer = {
|
|||||||
},
|
},
|
||||||
async loadBlocks() {
|
async loadBlocks() {
|
||||||
try {
|
try {
|
||||||
const r = await LNbits.api.request(
|
const r = await LNbits.api.request('GET', '/blockexplorer/api/v1/blocks')
|
||||||
'GET',
|
|
||||||
'/blockexplorer/api/v1/blocks'
|
|
||||||
)
|
|
||||||
this.blocks = r.data
|
this.blocks = r.data
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user