Peach: Local-first video metadata scraper and media manager.
fix: bound remote media streaming sessions
Peach local maintenancec66bab878a0f
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 63c46fa86..d4dcb1410 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -20,6 +20,7 @@- 禁止 `git add .`、`git add -A`、目录或 glob 暂存。只暂存任务明确拥有的文件,并检查 `git diff --cached --name-status`。测试和对应实现必须原子提交。- `bba0b77` 是已发生的反例:测试被误判为本任务文件而进入提交,对应 `probe.py` 未暂存,导致 HEAD 出现“测试指向不存在实现”。独立 worktree、暂存路径复核和实现/测试原子性因此是强制规则。- 在 worktree 运行测试时,项目 venv 的 editable install 可能仍指向主目录。必须设置 `PYTHONPATH=<当前工作树>\src`,先输出 `peach.__file__` 核对来源,再运行测试。+- **唯一测试入口**:本仓库只使用 Python 标准库 `unittest`,完整命令为 `python -m unittest discover -s tests -p 'test_*.py' -v`;项目依赖不含 pytest,不得再凭通用习惯调用 pytest。健康检查契约固定为 `/healthz`,不是 `/health`。## Claude 在本项目中的实际能力边界@@ -173,8 +174,12 @@ Claude 的 `.claude/settings.json` 已配置 Stop、StopFailure、SessionEnd hoo- 首页聚合数据在浏览器会话中合并并缓存 30 秒;相邻筛选复用同一进行中的请求。首页、顶部聚合、索引和实体页都有请求序号,迟到的旧响应不得覆盖新状态或再次重建 DOM。- 无限滚动同一时间只允许一个追加请求;先判断加载锁再递增 offset,避免快速触发时跳页。图片继续使用原生 `loading=lazy`。只有本地资源可使用真视频 hover;115/PikPak 等远端源必须使用本地接触印相。滚动、换页、隐藏页面或替换卡片 DOM 时,统一停止 hover 并释放 `src`。- 2026-08-15 实测:Prestige 显示 248 个总结果时首屏只构建 48 张卡片,点击“载入更多”后为 96;艺人索引 120 条约 311 ms,Prestige 第二页 48 条且跳过总数统计约 94 ms。具体耗时随 ledger 和磁盘状态变化,只把批量边界作为稳定契约。-- 0.5.4 起,标签筛选行与排序/换批行都常驻顶栏下方,不再按滚动方向隐藏;两行使用半透明黑色磨砂底,分别占位,不能盖住卡片内容。+- 0.5.5 起,标签筛选行与排序/换批行都常驻顶栏下方,不再按滚动方向隐藏;两行在原始位置保持透明,只在真正吸顶后加半透明黑色磨砂底与分隔线,分别占位,不能盖住卡片内容。- 首页、女优、厂牌等普通卡片统一由 `wireCards` 调用 `openItem`。只有沉浸/短片等显式传入 `onClick` 的场景允许覆盖。隐藏的 hover 工具必须 `pointer-events:none`,只在实际显示时恢复命中,避免截走海报详情点击。+- 详情媒体用随机 `session` 标识同一次播放;收起详情、路由切换或替换详情时,前端必须清空 video 后调用 `/api/stream-cancel`,服务端取消该 session 下全部 Range 请求并拒绝迟到请求。只移除 DOM 不能保证 CloudDrive 停止读盘。+- 115/PikPak 继续采用视频网站式按需 Range,不增加“点击后才拉流”的额外门槛。远端 session 的单次 Range 响应上限为 32 MiB,避免浏览器的开放区间请求让 CloudDrive 一路读到文件尾;移动端 390 px 下,结果数与排序拆成两行,排序横向滚动,禁止按钮逐字换行。+- Peach 测试唯一入口是 `python -m unittest discover -s tests -v`;仓库不依赖 `pytest`。健康检查端点是 `/healthz`,不是 `/health`。+- Windows 千兆线路理论上限约 125 MB/s。115 实测单文件由 CloudDrive 启动 2 条约 2 MB/s 的 CDN 连接;`max_download_speed_kbyps=0` 表示未设本地限速。卡顿排查先看 FlowLens 是否存在关闭详情后仍下载的旧连接,再查 Range/缓存,不把单连接速度直接归因于本地带宽。## 恢复入口diff --git a/src/peach/__init__.py b/src/peach/__init__.pyindex 5f7204baf..eae99e711 100644--- a/src/peach/__init__.py+++ b/src/peach/__init__.py@@ -1,3 +1,3 @@"""Peach application package."""-__version__ = "0.5.4"+__version__ = "0.5.5"diff --git a/src/peach/api.py b/src/peach/api.pyindex 7e05675ba..e107f4f97 100644--- a/src/peach/api.py+++ b/src/peach/api.py@@ -23,6 +23,7 @@ from .previews import PreviewService, PreviewUnavailablefrom .providers import OpenCodeGoClient, ProviderUnavailable, default_registryfrom .repository import LedgerRepositoryfrom .stash import StashClient+from .streaming import CappedRangeFileResponse, CancellableFileResponse, StreamSessionRegistryfrom .transcodes import TranscodeService, TranscodeUnavailable@@ -105,6 +106,8 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:app.state.providers = providersapp.state.opencode_go = opencode_goapp.state.http_transport = http_transport+ stream_sessions = StreamSessionRegistry()+ app.state.stream_sessions = stream_sessions@app.middleware("http")async def no_store(request: Request, call_next):@@ -152,12 +155,13 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:return response@app.api_route("/stream", methods=["GET", "HEAD"])- def stream(request: Request, id: int):+ def stream(request: Request, id: int, session: str = ""):args = _first_query_values(request)if not _authorized(request, settings.token, args):return JSONResponse({"error": "unauthorized"}, status_code=401)try:- path = media_engine.file_for(id, thumbnail=False)+ asset = media_engine.asset(id)+ path = media_engine.filesystem.file_for(asset, thumbnail=False)except MediaNotFound:return JSONResponse({"error": "no such id"}, status_code=404)except MediaUnavailable:@@ -167,12 +171,28 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:except TranscodeUnavailable:logging.getLogger(__name__).exception("browser transcode failed for asset %s", id)return JSONResponse({"error": "transcode unavailable"}, status_code=503)- response = FileResponse(path, media_type="video/mp4" if transcoded else None)+ media_type = "video/mp4" if transcoded else None+ response = (+ (CappedRangeFileResponse if asset.location not in (None, "local") else CancellableFileResponse)(+ path, session=session, registry=stream_sessions, media_type=media_type,+ )+ if session else FileResponse(path, media_type=media_type)+ )if transcoded:response.headers["X-Peach-Transcoded"] = "1"response.headers["Cache-Control"] = "no-store"return response+ @app.post("/api/stream-cancel")+ async def stream_cancel(request: Request, session: str):+ args = _first_query_values(request)+ if not _authorized(request, settings.token, args):+ return JSONResponse({"error": "unauthorized"}, status_code=401)+ if not session or len(session) > 128:+ return JSONResponse({"error": "invalid session"}, status_code=400)+ cancelled = stream_sessions.cancel(session)+ return JSONResponse({"ok": True, "cancelled": cancelled})+@app.api_route("/thumb", methods=["GET", "HEAD"])def thumbnail(request: Request, id: int):args = _first_query_values(request)diff --git a/src/peach/repository.py b/src/peach/repository.pyindex e6ca8699d..9672d1ac5 100644--- a/src/peach/repository.py+++ b/src/peach/repository.py@@ -11,6 +11,7 @@ class MediaAsset:path: str | Nonesnapshot_path: str | Nonebindings: tuple[tuple[str, str], ...] = ()+ location: str | None = Nonedef external_id(self, backend: str) -> str | None:return next((value for name, value in self.bindings if name == backend), None)@@ -25,7 +26,7 @@ class LedgerRepository:connection.row_factory = sqlite3.Rowtry:row = connection.execute(- "SELECT id,path,snapshot_path FROM asset WHERE id=?",+ "SELECT id,path,snapshot_path,location FROM asset WHERE id=?",(asset_id,),).fetchone()bindings = connection.execute(@@ -42,4 +43,5 @@ class LedgerRepository:row["path"],row["snapshot_path"],tuple((item["backend"], item["external_id"]) for item in bindings),+ row["location"],)diff --git a/src/peach/streaming.py b/src/peach/streaming.pynew file mode 100644index 000000000..e179947a2--- /dev/null+++ b/src/peach/streaming.py@@ -0,0 +1,126 @@+from __future__ import annotations++import asyncio+import logging+import threading+from collections.abc import MutableSet+from pathlib import Path+from time import monotonic++from starlette.responses import FileResponse, Response+from starlette.types import Receive, Scope, Send+++class StreamSessionRegistry:+ """Track addressable browser stream requests so the UI can cancel them."""++ def __init__(self, *, tombstone_seconds: float = 300.0) -> None:+ self._active: dict[str, MutableSet[asyncio.Task[object]]] = {}+ self._cancelled: dict[str, float] = {}+ self._tombstone_seconds = tombstone_seconds+ self._lock = threading.RLock()++ def _prune(self, now: float) -> None:+ expired = [+ session for session, cancelled_at in self._cancelled.items()+ if now - cancelled_at >= self._tombstone_seconds+ ]+ for session in expired:+ self._cancelled.pop(session, None)++ def register(self, session: str, task: asyncio.Task[object]) -> bool:+ with self._lock:+ self._prune(monotonic())+ if session in self._cancelled:+ return False+ self._active.setdefault(session, set()).add(task)+ return True++ def unregister(self, session: str, task: asyncio.Task[object]) -> None:+ with self._lock:+ tasks = self._active.get(session)+ if not tasks:+ return+ tasks.discard(task)+ if not tasks:+ self._active.pop(session, None)++ def cancel(self, session: str) -> int:+ with self._lock:+ self._prune(monotonic())+ self._cancelled[session] = monotonic()+ tasks = tuple(self._active.pop(session, ()))+ for task in tasks:+ task.cancel()+ return len(tasks)++ def active_count(self, session: str) -> int:+ with self._lock:+ return len(self._active.get(session, ()))+++class CancellableFileResponse(FileResponse):+ """FileResponse whose active ASGI task can be cancelled by a session id."""++ def __init__(+ self,+ path: str | Path,+ *,+ session: str,+ registry: StreamSessionRegistry,+ media_type: str | None = None,+ ) -> None:+ super().__init__(path, media_type=media_type)+ self.session = session+ self.registry = registry++ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:+ task = asyncio.current_task()+ if task is None or not self.registry.register(self.session, task):+ await Response(status_code=410, headers={"Cache-Control": "no-store"})(scope, receive, send)+ return+ try:+ await super().__call__(scope, receive, send)+ except asyncio.CancelledError:+ logging.getLogger(__name__).info("stream session cancelled: %s", self.session)+ raise+ finally:+ self.registry.unregister(self.session, task)+++class CappedRangeFileResponse(CancellableFileResponse):+ """Bound each remote Range response so CloudDrive does not read to EOF."""++ def __init__(self, *args, max_range_bytes: int = 32 * 1024 * 1024, **kwargs) -> None:+ super().__init__(*args, **kwargs)+ if max_range_bytes <= 0:+ raise ValueError("max_range_bytes must be positive")+ self.max_range_bytes = max_range_bytes++ async def _handle_single_range(+ self,+ send: Send,+ start: int,+ end: int,+ file_size: int,+ send_header_only: bool,+ ) -> None:+ capped_end = min(end, start + self.max_range_bytes)+ await super()._handle_single_range(+ send, start, capped_end, file_size, send_header_only,+ )++ async def _handle_multiple_ranges(+ self,+ send: Send,+ ranges: list[tuple[int, int]],+ file_size: int,+ send_header_only: bool,+ ) -> None:+ capped = [+ (start, min(end, start + self.max_range_bytes))+ for start, end in ranges+ ]+ await super()._handle_multiple_ranges(+ send, capped, file_size, send_header_only,+ )diff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.pyindex a982ca529..a898b7819 100644--- a/tests/test_fastapi_api.py+++ b/tests/test_fastapi_api.py@@ -258,6 +258,21 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):self.assertEqual(head.content, b"")self.assertEqual(head.headers["content-length"], "10")+ async def test_stream_session_cancel_is_authenticated_and_tombstoned(self):+ denied = await self.client.post("/api/stream-cancel?session=detail-1")+ self.assertEqual(denied.status_code, 401)++ cancelled = await self.client.post(+ "/api/stream-cancel?t=secret&session=detail-1"+ )+ self.assertEqual(cancelled.status_code, 200)+ self.assertEqual(cancelled.json(), {"ok": True, "cancelled": 0})++ stale = await self.client.get(+ "/stream?id=1&session=detail-1", headers={"X-Token": "secret"}+ )+ self.assertEqual(stale.status_code, 410)+async def test_transcoded_stream_has_browser_mime_and_marker(self):avi = self.media_root / "two.avi"avi.write_bytes(b"avi-source")diff --git a/tests/test_streaming.py b/tests/test_streaming.pynew file mode 100644index 000000000..649fc0804--- /dev/null+++ b/tests/test_streaming.py@@ -0,0 +1,70 @@+from __future__ import annotations++import asyncio+import unittest++from peach.streaming import CappedRangeFileResponse, StreamSessionRegistry+++class StreamSessionRegistryTests(unittest.IsolatedAsyncioTestCase):+ async def test_cancel_stops_every_active_request_in_the_session(self):+ registry = StreamSessionRegistry()+ started = asyncio.Event()++ async def wait_for_cancel() -> None:+ task = asyncio.current_task()+ assert task is not None+ self.assertTrue(registry.register("detail-1", task))+ started.set()+ try:+ await asyncio.Event().wait()+ finally:+ registry.unregister("detail-1", task)++ task = asyncio.create_task(wait_for_cancel())+ await started.wait()+ self.assertEqual(registry.active_count("detail-1"), 1)+ self.assertEqual(registry.cancel("detail-1"), 1)+ with self.assertRaises(asyncio.CancelledError):+ await task+ self.assertEqual(registry.active_count("detail-1"), 0)++ async def test_cancelled_session_rejects_late_range_requests(self):+ registry = StreamSessionRegistry()+ registry.cancel("detail-1")+ task = asyncio.current_task()+ assert task is not None+ self.assertFalse(registry.register("detail-1", task))++ async def test_remote_range_is_capped_without_losing_total_size(self):+ import tempfile+ from pathlib import Path++ with tempfile.TemporaryDirectory() as tmp:+ path = Path(tmp) / "remote.mp4"+ path.write_bytes(bytes(range(64)))+ registry = StreamSessionRegistry()+ response = CappedRangeFileResponse(+ path, session="detail-2", registry=registry, max_range_bytes=8,+ )+ messages: list[dict] = []++ async def receive() -> dict:+ return {"type": "http.request", "body": b"", "more_body": False}++ async def send(message: dict) -> None:+ messages.append(message)++ scope = {+ "type": "http", "method": "GET", "path": "/stream",+ "headers": [(b"range", b"bytes=0-")],+ }+ await response(scope, receive, send)++ start = messages[0]+ headers = {key.decode(): value.decode() for key, value in start["headers"]}+ body = b"".join(message.get("body", b"") for message in messages[1:])+ self.assertEqual(start["status"], 206)+ self.assertEqual(headers["content-range"], "bytes 0-7/64")+ self.assertEqual(headers["content-length"], "8")+ self.assertEqual(body, bytes(range(8)))diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 9ec132a3b..c5c5f1f9f 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -24,6 +24,11 @@ class WebUiSourceTests(unittest.TestCase):self.assertIn("function disposeStage", self.page)self.assertIn("video.pause();video.removeAttribute('src');video.load();video.remove()", self.page)self.assertIn("$('#closeStage').onclick=()=>disposeStage(true)", self.page)+ self.assertIn("function cancelDetailStream()", self.page)+ self.assertIn("/api/stream-cancel?session=", self.page)+ self.assertIn("keepalive:true", self.page)+ self.assertIn("dataset.peachStreamCancel=JSON.stringify(result)", self.page)+ self.assertIn('src="${detailStreamUrl(it.id)}"', self.page)def test_tag_geometry_uses_shared_tokens(self):self.assertIn("--tag-radius:999px", self.page)@@ -110,10 +115,19 @@ class WebUiSourceTests(unittest.TestCase):self.assertIn("--filterH:58px", self.page)self.assertIn(".tagbar{position:sticky;top:var(--topH)", self.page)self.assertIn(".count{position:sticky;top:calc(var(--topH) + var(--filterH))", self.page)+ self.assertIn("border-bottom:1px solid transparent;background:transparent", self.page)+ self.assertIn("background:transparent;border-bottom:1px solid transparent", self.page)+ self.assertIn(".tagbar.is-stuck,.count.is-stuck{background:color-mix(in srgb,#020408 84%,transparent)", self.page)self.assertIn("background:color-mix(in srgb,#020408 84%,transparent)", self.page)self.assertIn("backdrop-filter:saturate(1.35) blur(16px)", self.page)+ self.assertIn("function updateStickySurfaces()", self.page)+ self.assertIn("css.position==='sticky'", self.page)+ self.assertIn("el.classList.toggle('is-stuck',stuck)", self.page)self.assertNotIn(".tagbar.tuck", self.page)self.assertNotIn("function onScrollFrame", self.page)+ self.assertIn(":root{--tile:168px;--topH:52px;--sortH:96px}", self.page)+ self.assertIn(".count{align-items:stretch;flex-direction:column", self.page)+ self.assertIn(".count .sorts button{flex:0 0 auto", self.page)def test_entity_collection_posters_and_titles_open_item_details(self):self.assertIn('class="cardopenhit" data-open', self.page)diff --git a/web/index.html b/web/index.htmlindex a241421de..c392c8083 100644--- a/web/index.html+++ b/web/index.html@@ -132,11 +132,9 @@ button,input,textarea{font:inherit;color:inherit}.brandpill .mk img{position:absolute;inset:3px;width:calc(100% - 6px);height:calc(100% - 6px);object-fit:contain;display:block;filter:saturate(.72) brightness(.84);opacity:.9}-/* ── 常驻筛选层:上下滚动都保留;磨砂黑底避免盖住卡片文字 ── */+/* ── 常驻筛选层:原位保持透明,只在真正吸顶后加磨砂黑底 ── */.tagbar{position:sticky;top:var(--topH);z-index:61;height:var(--filterH);padding:9px 16px;- border-bottom:1px solid var(--line-soft);- background:color-mix(in srgb,#020408 84%,transparent);- backdrop-filter:saturate(1.35) blur(16px);-webkit-backdrop-filter:saturate(1.35) blur(16px);+ border-bottom:1px solid transparent;background:transparent;display:flex;gap:7px;overflow-x:auto;scrollbar-width:none;align-items:center}.tagbar::-webkit-scrollbar{display:none}.pill{flex:none;height:40px;padding:0 20px;border:1px solid var(--border-15);@@ -275,8 +273,11 @@ main{position:relative;z-index:1;padding:14px 16px 90px}.count{position:sticky;top:calc(var(--topH) + var(--filterH));z-index:60;min-height:var(--sortH);color:var(--ink-2);margin:0 -16px 12px;padding:8px 16px;display:flex;align-items:center;gap:10px;flex-wrap:nowrap;- background:color-mix(in srgb,#020408 84%,transparent);border-bottom:1px solid var(--line-soft);- backdrop-filter:saturate(1.35) blur(16px);-webkit-backdrop-filter:saturate(1.35) blur(16px)}+ background:transparent;border-bottom:1px solid transparent}+.tagbar,.count{transition:background-color .16s ease,border-color .16s ease}+.tagbar.is-stuck,.count.is-stuck{background:color-mix(in srgb,#020408 84%,transparent);+ border-bottom-color:var(--line-soft);backdrop-filter:saturate(1.35) blur(16px);+ -webkit-backdrop-filter:saturate(1.35) blur(16px)}.count:empty{display:none}.count>span:first-child{flex:none}.count .sorts{display:flex;gap:5px;margin-left:auto;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}@@ -640,8 +641,12 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.side{border-left:0;border-top:1px solid var(--line-soft);max-height:none}}@media (max-width:760px){.readout{display:none} .brand .sub{display:none}- :root{--tile:168px;--topH:52px;--sortH:51px}+ :root{--tile:168px;--topH:52px;--sortH:96px}.grid{gap:16px 8px}+ .count{align-items:stretch;flex-direction:column;gap:7px;padding-block:8px}+ .count>span:first-child{line-height:28px}+ .count .sorts{width:100%;margin-left:0;flex:none}+ .count .sorts button{flex:0 0 auto;min-height:36px;white-space:nowrap}/* 顶栏在窄屏会被搜索框撑破 —— 搜索收成一个按钮,点了才展开 */.top{gap:4px;padding:0 8px;overflow:hidden}.brand h1{font-size:17px}@@ -789,11 +794,29 @@ const REP={}; // 创作者/厂牌 → 代表作 id,用来做圆头像(裁let offset=0,total=0,facets=null,current=null,detailReturnPath='/';const CACHE={};const cache=items=>{items.forEach(x=>CACHE[x.id]=x);return items};+let detailStreamSession='';+function newStreamSession(){+ return globalThis.crypto?.randomUUID?.()||`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;+}+function detailStreamUrl(id){+ if(!detailStreamSession)detailStreamSession=newStreamSession();+ return `/stream?id=${id}&session=${encodeURIComponent(detailStreamSession)}`;+}+function cancelDetailStream(){+ const session=detailStreamSession;if(!session)return;+ detailStreamSession='';+ fetch(`/api/stream-cancel?session=${encodeURIComponent(session)}`,{+ method:'POST',credentials:'same-origin',keepalive:true+ }).then(r=>r.json()).then(result=>{+ document.documentElement.dataset.peachStreamCancel=JSON.stringify(result)+ }).catch(()=>{});+}function disposeStage(push=false){const stage=$('#stage');stage.querySelectorAll('video').forEach(video=>{if(video._hop)clearInterval(video._hop);video.pause();video.removeAttribute('src');video.load();video.remove()});+ cancelDetailStream();stage.innerHTML='';stage.hidden=true;document.body.classList.remove('detail-open');current=null;if(push)route(detailReturnPath||'/');}@@ -1406,13 +1429,28 @@ $('#edge').addEventListener('mouseenter',()=>{if(Date.now()<drawerSuppressUntil)/* 滚动期间挂起悬停预览:内容在鼠标下滑过会连续触发 mouseenter,每次都新建 video 并发起 /stream 请求,直接把页面拖垮。 */window.__scrolling=false; let scrollT=null;+let stickyFrame=0;+function updateStickySurfaces(){+ ['#tagbar','#count'].forEach(selector=>{+ const el=$(selector),css=el&&getComputedStyle(el),top=css?parseFloat(css.top):NaN;+ const stuck=!!el&&css.position==='sticky'&&el.offsetParent!==null&&window.scrollY>0&&+ Number.isFinite(top)&&el.getBoundingClientRect().top<=top+1;+ if(el)el.classList.toggle('is-stuck',stuck);+ });+}+function scheduleStickySurfaces(){+ if(stickyFrame)return;+ stickyFrame=requestAnimationFrame(()=>{stickyFrame=0;updateStickySurfaces()});+}window.addEventListener('scroll',()=>{+ scheduleStickySurfaces();window.__scrolling=true;// 滚动中挂起悬停预览:内容从鼠标下滑过会连续触发 mouseenter,// 每次新建 video 并发 /stream,几十个并发直接把页面拖垮releaseHoverPreviews();clearTimeout(scrollT); scrollT=setTimeout(()=>{window.__scrolling=false},180);},{passive:true});+window.addEventListener('resize',scheduleStickySurfaces,{passive:true});/* 只在真正进入 72 px 图标栏时展开;内容区左缘不再设隐形热区。 */$('#edge').addEventListener('mouseleave',()=>clearTimeout(edgeT));@@ -1523,7 +1561,7 @@ async function openItem(id,push=true){${srcBadge(it.location,it.cost,'srcbig')}<span style="font-size:12px;color:var(--muted)">点此开始拉流 · ${fmtSize(it.size||0)}</span></div><video id="vid" controls preload="none" hidden></video>`- :`<video id="vid" controls autoplay preload="metadata" src="/stream?id=${it.id}"></video>`}+ :`<video id="vid" controls autoplay preload="metadata" src="${detailStreamUrl(it.id)}"></video>`}</div><div class="side"><div class="stitle">${esc(it.name)}</div>@@ -1557,7 +1595,7 @@ async function openItem(id,push=true){$('#closeStage').onclick=()=>disposeStage(true);const g=$('#gate'); if(g)g.onclick=()=>{const v=$('#vid');- v.src='/stream?id='+it.id;v.hidden=false;g.remove();v.play()};+ v.src=detailStreamUrl(it.id);v.hidden=false;g.remove();v.play()};$('#stage').querySelectorAll('[data-kind]').forEach(b=>b.onclick=async()=>{const r=await api('/api/feedback',{method:'POST',body:JSON.stringify({id:it.id,kind:b.dataset.kind})});Object.assign(it,{feedback:r.feedback,disposal:r.disposal,o_count:r.o_count});@@ -1868,7 +1906,7 @@ async function restoreRoute(){}window.addEventListener('popstate',restoreRoute);buildEdge();-buildBars().then(async()=>{buildEdge();wireAllDrag();await load(true);await restoreRoute()});+buildBars().then(async()=>{buildEdge();wireAllDrag();await load(true);await restoreRoute();scheduleStickySurfaces()});</script></body></html>