feat: 只保留管理入口,缓存小区信息表解析,连接中显示提示,移除脚本管理打包方式
This commit is contained in:
+4
-9
@@ -7,19 +7,13 @@ from contextlib import asynccontextmanager
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body, Depends, FastAPI, HTTPException
|
||||
from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse
|
||||
from fastapi.responses import JSONResponse, PlainTextResponse, RedirectResponse
|
||||
|
||||
from .auth import Identity, require_admin
|
||||
from .config import SettingsError, data_dir, public_view
|
||||
from .data import DataQuery
|
||||
from .service import EtlService
|
||||
|
||||
LANDING_HTML = """<!doctype html>
|
||||
<html><head><meta charset="utf-8"><title>干扰数据处理</title>
|
||||
<script>location.replace(location.pathname.replace(/\\/?$/, '/') + 'admin');</script>
|
||||
</head><body><a href="admin">干扰数据处理</a></body></html>
|
||||
"""
|
||||
|
||||
|
||||
def settings_error(exc: SettingsError) -> JSONResponse:
|
||||
return JSONResponse(status_code=422, content={"error": exc.key, "field": exc.field, "params": exc.params})
|
||||
@@ -37,8 +31,9 @@ def build_api(service: EtlService) -> FastAPI:
|
||||
api = FastAPI(title="InterferenceETL", lifespan=lifespan, docs_url=None, redoc_url=None, openapi_url=None)
|
||||
|
||||
@api.get("/", include_in_schema=False)
|
||||
def landing() -> HTMLResponse:
|
||||
return HTMLResponse(LANDING_HTML)
|
||||
def landing() -> RedirectResponse:
|
||||
# Relative on purpose: the app is served under a path prefix it does not know.
|
||||
return RedirectResponse("admin")
|
||||
|
||||
@api.get("/healthz")
|
||||
def health() -> dict[str, bool]:
|
||||
|
||||
Reference in New Issue
Block a user