fix: 清掉无用接口和样式,并收紧登录与工号边界

This commit is contained in:
2026-11-16 11:30:59 +08:00
parent 7381b49e4c
commit 5b83b7e415
15 changed files with 232 additions and 329 deletions
+6 -6
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from fastapi import APIRouter, Depends, HTTPException, Request, Response
from fastapi import APIRouter, Depends, HTTPException, Path, Query, Request, Response
from pydantic import BaseModel
from sqlalchemy.orm import Session
@@ -130,8 +130,8 @@ def post_courses_load(_: str = Depends(require_admin)) -> dict:
def get_courses(
q: str = "",
kind: str = "",
offset: int = 0,
limit: int = 50,
offset: int = Query(default=0, ge=0, le=10**9),
limit: int = Query(default=50, ge=1, le=10**9),
db: Session = Depends(get_db),
_: str = Depends(require_admin),
) -> dict:
@@ -144,8 +144,8 @@ def get_courses(
def get_proxies(
q: str = "",
status: str = "",
offset: int = 0,
limit: int = 50,
offset: int = Query(default=0, ge=0, le=10**9),
limit: int = Query(default=50, ge=1, le=10**9),
db: Session = Depends(get_db),
_: str = Depends(require_admin),
) -> dict:
@@ -168,7 +168,7 @@ def get_proxies_probe(_: str = Depends(require_admin)) -> dict:
@admin_router.post("/proxies/{proxy_id}/probe")
def post_proxy_probe(proxy_id: int, _: str = Depends(require_admin)) -> dict:
def post_proxy_probe(proxy_id: int = Path(ge=1, le=10**9), _: str = Depends(require_admin)) -> dict:
try:
return probe_proxy_one(proxy_id)
except ProxyProbeError as exc: