Refactor router dependency wiring to explicit app state providers
This commit is contained in:
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
||||
from app.services.jail_service import IpLookupResult
|
||||
|
||||
import aiosqlite
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, Request, status
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, status
|
||||
|
||||
from app.dependencies import (
|
||||
AuthDep,
|
||||
@@ -40,7 +40,6 @@ _IpPath = Annotated[str, Path(description="IPv4 or IPv6 address to look up.")]
|
||||
summary="Look up ban status and geo information for an IP",
|
||||
)
|
||||
async def lookup_ip(
|
||||
request: Request,
|
||||
_auth: AuthDep,
|
||||
ip: _IpPath,
|
||||
socket_path: Fail2BanSocketDep,
|
||||
@@ -53,7 +52,6 @@ async def lookup_ip(
|
||||
organisation data from ip-api.com.
|
||||
|
||||
Args:
|
||||
request: Incoming request (used to access ``app.state``).
|
||||
_auth: Validated session — enforces authentication.
|
||||
ip: The IP address to look up.
|
||||
|
||||
@@ -140,7 +138,6 @@ async def geo_stats(
|
||||
summary="Re-resolve all IPs whose country could not be determined",
|
||||
)
|
||||
async def re_resolve_geo(
|
||||
request: Request,
|
||||
_auth: AuthDep,
|
||||
db: Annotated[aiosqlite.Connection, Depends(get_db)],
|
||||
http_session: HttpSessionDep,
|
||||
@@ -151,9 +148,9 @@ async def re_resolve_geo(
|
||||
are immediately eligible for a new API attempt.
|
||||
|
||||
Args:
|
||||
request: Incoming request (used to access ``app.state.http_session``).
|
||||
_auth: Validated session — enforces authentication.
|
||||
db: BanGUI application database (for reading/writing ``geo_cache``).
|
||||
http_session: Shared HTTP session for geo lookups.
|
||||
|
||||
Returns:
|
||||
JSON object ``{"resolved": N, "total": M}`` where *N* is the number
|
||||
|
||||
Reference in New Issue
Block a user