diff --git a/Dockerfile b/Dockerfile index c4e260c..b14e7cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN find ./src -type f -name "route.ts" -print0 \ ENV DOCKER_ENV=true # 海报走站内 /api/image-proxy(浏览器直连豆瓣图被拦导致全裂) ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy -ENV NEXT_PUBLIC_SITE_VERSION=fixed122 +ENV NEXT_PUBLIC_SITE_VERSION=fixed123 ENV NEXT_PUBLIC_ENABLE_REGISTER=true # For Docker builds, force dynamic rendering to read runtime environment variables. @@ -56,7 +56,7 @@ ENV HOSTNAME=0.0.0.0 ENV PORT=3000 ENV DOCKER_ENV=true ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy -ENV NEXT_PUBLIC_SITE_VERSION=fixed122 +ENV NEXT_PUBLIC_SITE_VERSION=fixed123 ENV NEXT_PUBLIC_ENABLE_REGISTER=true # 从构建器中复制 standalone 输出 diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 2f9c041..d724803 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -659,6 +659,7 @@ const VideoSourceConfig = ({ const [orderChanged, setOrderChanged] = useState(false); const [batchMode, setBatchMode] = useState(false); const [selectedSources, setSelectedSources] = useState>(new Set()); + const [speeds, setSpeeds] = useState>({}); const [newSource, setNewSource] = useState({ name: '', key: '', @@ -693,6 +694,29 @@ const VideoSourceConfig = ({ } }, [config]); + // 打开页面自动测速各资源站响应时间 + useEffect(() => { + let alive = true; + const run = async () => { + try { + const r = await fetch('/api/filter?action=probe'); + const j = await r.json().catch(() => null); + if (!alive) return; + const map: Record = {}; + (j?.results || []).forEach((x: any) => { + map[x.key] = { ms: x.ms, ok: x.ok }; + }); + setSpeeds(map); + } catch { + /* 忽略测速失败 */ + } + }; + run(); + return () => { + alive = false; + }; + }, []); + // 通用 API 请求 const callSourceApi = async (body: Record) => { try { @@ -1120,6 +1144,21 @@ const VideoSourceConfig = ({ > {!source.disabled ? '启用中' : '已禁用'} + {!source.disabled && ( +
+ {speeds[source.key] ? ( + speeds[source.key].ok ? ( + + {(speeds[source.key].ms / 1000).toFixed(2)}s + + ) : ( + 超时 + ) + ) : ( + 测速中… + )} +
+ )}