Peach: Local-first video metadata scraper and media manager.
feat: reveal source files and reconcile deletions per directory
longmeidao14132d4357cb
diff --git a/src/peach/api.py b/src/peach/api.pyindex 46b4f5cf9..c12df19b7 100644--- a/src/peach/api.py+++ b/src/peach/api.py@@ -2,6 +2,7 @@ import hmacimport asyncioimport htmlimport logging+import subprocessfrom concurrent.futures import ThreadPoolExecutorfrom contextlib import asynccontextmanagerfrom functools import partial@@ -27,7 +28,12 @@ from .media import (StashAdapter,)from .mdns import create_mdns_publisher-from .platform import is_unmapped, root_online, translate_ledger_path+from .platform import (+ is_unmapped,+ reveal_command,+ root_online,+ translate_ledger_path,+)from .previews import PhotoThumbnailService, PreviewService, PreviewUnavailablefrom .providers import OpenCodeGoClient, ProviderUnavailable, default_registryfrom .repository import LedgerDatabase, LedgerRepository@@ -672,6 +678,48 @@ def create_app("offline": [row["location"] for row in rows if not row["online"]],}+ @app.post("/api/reveal")+ def reveal(request: Request, body: dict[str, Any] = Body(default_factory=dict)):+ """在本机文件管理器里定位某个资产的源文件。++ 用于「跳过去自己整理网盘目录」:A:/B: 是 CloudDrive 挂上来的盘符,在+ 资源管理器里和本地目录没有区别。路径一律由服务端按 asset id 查出来——+ `q_item` 刻意不把 `path` 发给前端,这里不能反过来让前端把路径传进来。++ 写不进 ledger,所以不受 reader 的只读闸门约束;但它会在**服务端所在的+ 机器**上弹窗,从 Mac 浏览时弹在 Windows 那台,也正是文件所在的机器。+ """+ args = _first_query_values(request)+ if not _authorized(request, settings.token, args):+ return JSONResponse({"error": "unauthorized"}, status_code=401)+ try:+ asset_id = int(body.get("id"))+ except (TypeError, ValueError):+ return JSONResponse({"error": "id must be an integer"}, status_code=400)+ asset = repository.media_asset(asset_id)+ if asset is None or not asset.path:+ return JSONResponse({"error": "not found"}, status_code=404)+ target = translate_ledger_path(asset.path)+ if is_unmapped(target):+ return JSONResponse(+ {"error": "source not mapped", "location": asset.location},+ status_code=409)+ if not target.exists():+ # 文件已经不在了——正是「删完回来同步」的入口,前端据此提示对账。+ return JSONResponse(+ {"error": "file missing", "location": asset.location},+ status_code=410)+ command = reveal_command(target)+ if command is None:+ return JSONResponse({"error": "unsupported platform"}, status_code=501)+ try:+ # explorer 成功时也返回 1,所以不能用 check=True 判成败。+ subprocess.Popen(command, close_fds=True)+ except OSError as error:+ LOGGER.warning("reveal failed for asset %s: %s", asset_id, error)+ return JSONResponse({"error": "reveal failed"}, status_code=500)+ return {"ok": True, "id": asset_id, "location": asset.location}+@app.get("/api/providers/opencode-go/models")def opencode_go_models(request: Request):args = _first_query_values(request)diff --git a/src/peach/platform.py b/src/peach/platform.pyindex 6a1080f09..3596e9369 100644--- a/src/peach/platform.py+++ b/src/peach/platform.py@@ -13,6 +13,7 @@ Windows 上运行,账本因此保持单一路径口径。from __future__ import annotationsimport os+import sysfrom functools import lru_cachefrom pathlib import Path, PureWindowsPath@@ -135,3 +136,18 @@ def media_root_status(roots) -> tuple[dict[str, object], ...]:})return tuple(status)+++def reveal_command(path: Path) -> list[str] | None:+ """在文件管理器里定位这个文件的 argv;本平台不支持时返回 None。++ 做成纯函数是为了能在没有桌面的环境里测:真正 spawn 的那一步只有一行。+ `explorer` 要求 `/select,<路径>` 整体是**一个**参数,逗号后不能断开,所以+ 必须用列表传参而不是拼字符串——顺带也就没有引号注入的余地。+ """+ target = os.fspath(path)+ if os.name == "nt":+ return ["explorer", f"/select,{target}"]+ if sys.platform == "darwin":+ return ["open", "-R", target]+ return Nonediff --git a/src/peach/web_contract.py b/src/peach/web_contract.pyindex 2b18b84a4..4186f07ec 100644--- a/src/peach/web_contract.py+++ b/src/peach/web_contract.py@@ -18,7 +18,7 @@ from pathlib import Pathfrom typing import Sequencefrom urllib.parse import quote, urlsplit-from .config import COVER_DIR, GENERATED_DIR+from .config import COVER_DIR, GENERATED_DIR, LOCATION_ROOT_DECLARATIONSfrom .entities import (canonicalize_entity_name,collapse_repeated_entity_name,@@ -26,7 +26,12 @@ from .entities import (upsert_asset_entity,)from .media import remap_managed_path-from .platform import system_volume+from .platform import (+ is_unmapped,+ root_online,+ system_volume,+ translate_ledger_path,+)from .repository import LedgerDatabasefrom .web_activity import (DEFAULT_PROFILE_ID,@@ -790,8 +795,18 @@ def q_entity(contract: WebContract, args):# `<作品目录>\P\001.jpg` 这种约定在 A:/B: 上到处都是。图集的 id 用目录里最小的# 资产 id,既稳定又不用把真实路径发给前端(`q_item` 同样不发 `path`)。-#: 从 `path` 去掉 `name` 和分隔符,剩下的就是所在目录。-PHOTO_DIR = "substr(a.path,1,length(a.path)-length(a.name)-1)"+def dir_expr(alias: str = "a.") -> str:+ """从 `path` 去掉 `name` 和分隔符,剩下的就是所在目录。++ 表别名做成参数,是因为图集查询用 `a.`、按目录对账时直接查 `asset` 不带别名;+ 早先靠对常量做字符串替换来凑另一种写法,改一次别名就会悄悄失配。+ """+ return (f"substr({alias}path,1,"+ f"length({alias}path)-length({alias}name)-1)")+++#: 图集查询一律带 `a.` 别名。+PHOTO_DIR = dir_expr()#: 只写「这是图片」的通用目录名。它们做标题没有信息量,改用上一级目录名。GENERIC_PHOTO_DIRS = frozenset({@@ -1763,6 +1778,70 @@ def w_empty_trash(contract: WebContract):return {"ok": True, "operation": "empty-trash", **_finish_purge(outcome)}+def source_is_online(location: str) -> bool:+ """这个来源整体在不在线。对账前的唯一闸门。"""+ declared = LOCATION_ROOT_DECLARATIONS.get(location)+ if not declared:+ return False+ resolved = translate_ledger_path(declared)+ return not is_unmapped(resolved) and root_online(resolved)+++def w_purge_missing(contract: WebContract, body):+ """按目录对账:文件已经在磁盘上删掉的,账本行一并删掉。++ 这条路径服务的是「我在资源管理器里整理网盘目录」——删掉的就是不要的,所以+ 不进复核、不进回收站、不可恢复,播放历史等衍生行跟着一起走。++ 真正危险的不是删得太干净,而是把「盘没挂上」误判成「文件没了」:R: 掉线时+ 整条来源 2,552 行都会看起来像被删。所以先做来源级在线判定,整源不在线就+ 一行都不碰。CloudDrive 掉线后挂载点目录仍然存在,`root_online` 因此判的是+ 「能否列出一个条目」而不是「目录在不在」。+ """+ asset_id = int(body["id"])+ with contract.read_connection() as connection:+ anchor = connection.execute(+ "SELECT id,location,path,name FROM asset WHERE id=?", (asset_id,),+ ).fetchone()+ if not anchor:+ return {"error": "not found"}+ location, path, name = anchor["location"], anchor["path"], anchor["name"]+ if not path or not name:+ return {"error": "asset has no path"}+ if not source_is_online(location):+ # 不是失败,是拒绝:盘不在时无法区分「文件删了」和「盘没挂上」。+ return {"ok": False, "error": "source offline", "location": location}+ directory = path[: len(path) - len(name) - 1]+ rows = connection.execute(+ f"SELECT id,path,name FROM asset WHERE location=? "+ f"AND {dir_expr('')}=?",+ (location, directory),+ ).fetchall()++ missing = [+ {"id": row["id"], "name": row["name"]}+ for row in rows+ if not translate_ledger_path(row["path"]).is_file()+ ]+ if not missing:+ return {"ok": True, "directory": photo_set_title(directory),+ "checked": len(rows), "removed": 0, "items": []}++ contract.cache_bust()+ ids = [item["id"] for item in missing]+ marks = ",".join("?" * len(ids))+ with contract.write_transaction() as connection:+ for table in ASSET_REFERENCE_TABLES:+ connection.execute(+ f"DELETE FROM {table} WHERE asset_id IN ({marks})", ids)+ # asset_search 交给 0004 的删除触发器,这里再删一遍只会重复。+ connection.execute(f"DELETE FROM asset WHERE id IN ({marks})", ids)+ return {+ "ok": True, "directory": photo_set_title(directory),+ "checked": len(rows), "removed": len(missing), "items": missing,+ }++def w_batch(contract: WebContract, body):"""Apply one explicit, reversible marker to a bounded selected set."""raw_ids = body.get("ids")@@ -2017,6 +2096,7 @@ POST_HANDLERS = {"/api/batch": w_batch,"/api/search-history": w_search_history,"/api/trash/empty": _post_empty_trash,+ "/api/purge-missing": w_purge_missing,"/api/review/decision": w_review_decision,}diff --git a/tests/test_platform.py b/tests/test_platform.pyindex 0984db36c..1ac427ae2 100644--- a/tests/test_platform.py+++ b/tests/test_platform.py@@ -9,6 +9,7 @@ from peach.platform import (UNMAPPED_ROOT,is_unmapped,is_windows_path,+ reveal_command,root_online,system_volume,translate_ledger_path,@@ -130,5 +131,27 @@ class OfflineModeTests(unittest.TestCase):self.assertEqual([row["online"] for row in status], [True, False])+class RevealCommandTests(unittest.TestCase):+ """在文件管理器里定位源文件的 argv。"""++ def test_windows_selects_the_file_in_one_argument(self):+ with patch("peach.platform.os.name", "nt"):+ command = reveal_command(Path(r"B:\创作者 b\c,d.mp4"))+ # explorer 要求 `/select,<路径>` 整体是一个参数:拆开或加引号都会+ # 变成「打开我的文档」。含空格和逗号的真实路径必须原样落在同一个参数里。+ self.assertEqual(command, ["explorer", r"/select,B:\创作者 b\c,d.mp4"])++ def test_macos_reveals_in_finder(self):+ with patch("peach.platform.os.name", "posix"), patch("peach.platform.sys.platform", "darwin"):+ self.assertEqual(+ reveal_command(Path("/Volumes/RESOURCES/media/a.mp4")),+ ["open", "-R", "/Volumes/RESOURCES/media/a.mp4"])++ def test_unsupported_platform_returns_none_instead_of_guessing(self):+ with patch("peach.platform.os.name", "posix"), patch("peach.platform.sys.platform", "linux"):+ self.assertIsNone(reveal_command(Path("/srv/a.mp4")))+++if __name__ == "__main__":unittest.main()diff --git a/tests/test_rm_web.py b/tests/test_rm_web.pyindex d0a39b46e..3a4567684 100644--- a/tests/test_rm_web.py+++ b/tests/test_rm_web.py@@ -365,6 +365,7 @@ class WebDataTests(unittest.TestCase):"/api/activity", "/api/play", "/api/feedback", "/api/watch-later","/api/preference", "/api/quality-goal", "/api/item-tag", "/api/batch","/api/search-history", "/api/trash/empty", "/api/review/decision",+ "/api/purge-missing",})with self.assertRaises(rm_web.ContractRouteNotFound):rm_web.dispatch_api_get(self.contract, "/api/typo", {})@@ -1587,5 +1588,102 @@ class PhotoSetTests(unittest.TestCase):{"error": "invalid id"})+class PurgeMissingTests(unittest.TestCase):+ """按目录对账:磁盘上已删掉的,账本行一并删掉。++ 这条路径不可恢复,所以测试重点全在「什么时候**不该**删」。+ """++ LEDGER_DIR = r"B:\creator\P"+ OTHER_DIR = r"B:\creator\V"++ def setUp(self):+ self.tmp = tempfile.TemporaryDirectory()+ self.root = Path(self.tmp.name)+ self.db_path = str(self.root / "ledger.db")+ con = sqlite3.connect(self.db_path)+ con.executescript(BASE_SCHEMA)+ sep = chr(92)+ rows = [+ (1, "115", self.LEDGER_DIR + sep + "001.jpg", "001.jpg"),+ (2, "115", self.LEDGER_DIR + sep + "002.jpg", "002.jpg"),+ (3, "115", self.LEDGER_DIR + sep + "003.jpg", "003.jpg"),+ # 同来源但另一个目录,任何情况下都不该被这次对账碰到。+ (4, "115", self.OTHER_DIR + sep + "a.mp4", "a.mp4"),+ ]+ con.executemany(+ "INSERT INTO asset(id,location,path,name,medium,size) "+ "VALUES(?,?,?,?,'image',10)", rows)+ con.executemany("INSERT INTO asset_tag(asset_id,tag,source) VALUES(?,?,'t')",+ [(2, "标签"), (4, "标签")])+ con.executemany(+ "INSERT INTO asset_preference(profile_id,asset_id,liked,reason) "+ "VALUES('default',?,1,'')", [(2,), (4,)])+ con.commit()+ con.close()+ self.contract = rm_web.WebContract(Path(self.db_path))+ # 只有 001 和 a.mp4 还在盘上;002、003 当作已被手动删除。+ for name in ("001.jpg", "a.mp4"):+ (self.root / name).write_bytes(b"x")++ def tearDown(self):+ self.tmp.cleanup()++ def _translate(self, raw):+ """把账本的 Windows 路径映射到临时目录里的同名文件。"""+ return self.root / str(raw).rsplit(chr(92), 1)[-1]++ def _run(self, online=True):+ patch_translate = mock.patch.object(+ rm_web, "translate_ledger_path", self._translate)+ patch_online = mock.patch.object(+ rm_web, "source_is_online", lambda _loc: online)+ with patch_translate, patch_online:+ return rm_web.w_purge_missing(self.contract, {"id": 1})++ def ids(self):+ con = sqlite3.connect(self.db_path)+ try:+ return [r[0] for r in con.execute("SELECT id FROM asset ORDER BY id")]+ finally:+ con.close()++ def test_offline_source_refuses_instead_of_deleting_everything(self):+ """盘没挂上时,整目录都会 stat 失败——那不是「文件被删」。++ R: 实测掉线过;若不拦,2,552 条本地资产会一次全部消失。+ """+ result = self._run(online=False)+ self.assertFalse(result["ok"])+ self.assertEqual(result["error"], "source offline")+ self.assertEqual(self.ids(), [1, 2, 3, 4])++ def test_missing_files_are_removed_with_their_derived_rows(self):+ result = self._run()+ self.assertTrue(result["ok"])+ self.assertEqual(result["checked"], 3)+ self.assertEqual(result["removed"], 2)+ self.assertEqual(sorted(x["id"] for x in result["items"]), [2, 3])+ # 另一个目录的 4 必须原样留下。+ self.assertEqual(self.ids(), [1, 4])+ con = sqlite3.connect(self.db_path)+ try:+ # 衍生行跟着走:用户要的是「删干净」,不是留一堆孤儿。+ self.assertEqual(+ [r[0] for r in con.execute("SELECT asset_id FROM asset_tag")], [4])+ self.assertEqual(+ [r[0] for r in con.execute("SELECT asset_id FROM asset_preference")], [4])+ finally:+ con.close()++ def test_intact_directory_reports_no_change(self):+ for name in ("002.jpg", "003.jpg"):+ (self.root / name).write_bytes(b"x")+ result = self._run()+ self.assertEqual(result["removed"], 0)+ self.assertEqual(result["checked"], 3)+ self.assertEqual(self.ids(), [1, 2, 3, 4])++if __name__ == "__main__":unittest.main()diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex f8354bf74..680ab320a 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -995,6 +995,28 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("new ResizeObserver(()=>{main.update();strip.update()})")self.assertPageContains("activeLightbox.resize?.disconnect()")+ def test_source_tools_never_take_a_path_from_the_client(self):+ """定位和对账都只发 asset id,路径由服务端查。++ `q_item` 是刻意不把 `path` 发给前端的;这两个入口不能反过来让前端把+ 路径传进来,否则等于开了一个「任意路径」的接口。+ """+ self.assertPageContains("api('/api/reveal',{method:'POST',body:JSON.stringify({id})})")+ self.assertPageContains("api('/api/purge-missing',{method:'POST',body:JSON.stringify({id})})")+ self.assertPageContains('data-reveal="${id}"')+ self.assertPageContains('data-sync="${id}"')+ # 在线资产是 URL,没有本地文件可定位。+ self.assertPageContains("it.location==='online'?'':sourceTools(it.id)")++ def test_source_tool_icons_declare_stroke_and_no_fill(self):+ self.assertPageContains(+ ".srctools button svg{width:15px;height:15px;stroke:currentColor;fill:none")+ self.assertPageContains('<symbol id="i-folder-open"')++ def test_offline_source_is_reported_as_a_refusal_not_a_failure(self):+ # 盘没挂上时拒绝对账,措辞必须让人看懂「不是出错,是我不敢删」。+ self.assertPageContains("'source offline':'来源不在线,已拒绝对账")+def test_photo_view_is_addressable_and_survives_a_reload(self):self.assertPageContains("params.get('media')==='photos'?'photos':'videos'")self.assertPageContains("params.set('media','photos')")diff --git a/web/app.css b/web/app.cssindex 6fa949a35..f6fc909d9 100644--- a/web/app.css+++ b/web/app.css@@ -723,6 +723,18 @@ body.index-open #tiers,body.index-open #tagbar{display:none}flex-direction:column;max-height:76vh;overflow-y:auto;background:color-mix(in srgb,var(--video-glow,#15202a) 12%,var(--surface) 88%);backdrop-filter:blur(18px)}.stitle{font-size:17px;line-height:1.4;word-break:break-all;margin-bottom:8px}+/* 源文件管理:定位 + 目录对账。图标必须显式写 stroke/fill,Lucide 是描边路径,+ 缺了就被按默认 fill:black 画成黑块(详见 .photonav 那一段的同类修复)。 */+.srctools{display:flex;align-items:center;gap:6px;margin:0 0 10px;flex-wrap:wrap}+.srctools button{width:26px;height:26px;display:grid;place-items:center;flex:none;+ border:1px solid var(--line);border-radius:7px;background:transparent;color:var(--muted);+ padding:0;cursor:pointer}+.srctools button svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}+.srctools button:hover{border-color:var(--tungsten);color:var(--ink)}+.srctools button:disabled{opacity:.45;cursor:default}+.srcstate{font-size:11.5px;color:var(--muted);min-width:0;flex:1 1 100%}+.photohead .srctools{margin:0 0 0 auto}+.photohead .srcstate{flex:none}.smeta{display:flex;gap:9px;flex-wrap:wrap;color:var(--muted);margin-bottom:18px}.stags{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin:0 0 18px}.detailtag{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:var(--tag-radius);diff --git a/web/app.js b/web/app.jsindex af111dc5e..26c935f63 100644--- a/web/app.js+++ b/web/app.js@@ -1287,12 +1287,16 @@ function renderPhotoWall(kind,name,filters,data,append=false){photoWallItems=[];section.innerHTML=`<div class="photohead"><button class="photoback" type="button">${icon('chevron-left')}<span>全部图集</span></button>- <h3>${esc(data.title)} · ${(data.total||0).toLocaleString()} 张</h3></div>+ <h3>${esc(data.title)} · ${(data.total||0).toLocaleString()} 张</h3>+ ${sourceTools(data.id)}</div><div class="photowall"></div><button class="entitymore" type="button">载入更多</button>`;section.querySelector('.photoback').onclick=()=>{entityMediaView={media:'photos',set:0};routeEntityView(kind,name,entityMediaView);renderPhotoSets(kind,name,filters)};+ // 对账后整组数量都变了,重开这一组比逐格摘除简单也更不容易错。+ wireSourceTools(section.querySelector('.photohead'),+ ()=>openPhotoSet(kind,name,filters,data.id,false));}const wall=section.querySelector('.photowall');const start=photoWallItems.length;@@ -1316,6 +1320,59 @@ function renderPhotoWall(kind,name,filters,data,append=false){}}+/* ── 源文件管理 ───────────────────────────────────────────────────────────────+ 标题旁两个按钮,服务的是「跳过去自己整理网盘目录」这条来回:定位打开源文件所在+ 目录(A:/B: 是 CloudDrive 挂上来的盘符,在资源管理器里和本地目录没区别),在那边+ 删掉不要的,回来点一下同步,账本跟着对齐。+ 删除不进复核也不可恢复——手动删掉的就是不要的。真正要防的是把「盘没挂上」当成+ 「文件没了」,那个闸门在服务端:整条来源不在线时直接拒绝,一行都不动。+ 路径始终由服务端按 asset id 查,前端拿不到也不该拿到 `path`。 ── */+const SOURCE_HINTS={+ 'source offline':'来源不在线,已拒绝对账(避免把没挂上的盘当成文件被删)',+ 'source not mapped':'本机没有映射这个来源的盘符',+ 'file missing':'源文件已经不在了,点右边同步把账本对齐',+ 'unsupported platform':'当前服务端系统不支持直接定位文件',+ 'reveal failed':'打开文件管理器失败',+};+const sourceHint=message=>SOURCE_HINTS[message]||message;++async function revealSource(id,status){+ status.textContent='正在定位…';+ try{+ await api('/api/reveal',{method:'POST',body:JSON.stringify({id})});+ status.textContent='已在服务端弹出文件管理器';+ }catch(e){status.textContent=sourceHint(e.message)}+}++async function syncMissing(id,status,done){+ status.textContent='正在核对目录…';+ try{+ const r=await api('/api/purge-missing',{method:'POST',body:JSON.stringify({id})});+ if(r.ok===false){status.textContent=sourceHint(r.error);return}+ status.textContent=r.removed+ ? `已从账本移除 ${r.removed} 项(核对 ${r.checked} 项)`+ : `目录内 ${r.checked} 项都还在,无需改动`;+ if(r.removed&&done)done(r);+ }catch(e){status.textContent=sourceHint(e.message)}+}++/* 两个按钮 + 一行状态。状态用 aria-live,屏幕阅读器和肉眼看到的是同一句。 */+const sourceTools=id=>`<div class="srctools">+ <button type="button" data-reveal="${id}" title="在文件管理器里打开源文件所在目录"+ aria-label="定位源文件">${icon('folder-open')}</button>+ <button type="button" data-sync="${id}" title="核对该目录:磁盘上已删除的,从账本一并移除"+ aria-label="同步删除">${icon('refresh-cw')}</button>+ <span class="srcstate" aria-live="polite"></span></div>`;++function wireSourceTools(root,done){+ const status=root.querySelector('.srcstate');+ if(!status)return;+ const reveal=root.querySelector('[data-reveal]');+ const sync=root.querySelector('[data-sync]');+ if(reveal)reveal.onclick=()=>revealSource(Number(reveal.dataset.reveal),status);+ if(sync)sync.onclick=()=>syncMissing(Number(sync.dataset.sync),status,done);+}+/* 灯箱按需加载 Swiper:大图轮播、底部缩略图条和键盘左右键都是它自带的模块,没必要自己写一遍;但它只有看照片时才用得上,不该进首屏。 */let swiperLoader=null,activeLightbox=null;@@ -1960,6 +2017,7 @@ async function openItem(id,push=true,mixContext=null){</div>${mixContext?mixQueueHtml(mixContext,it.id):''}<div class="side"><div class="stitle">${esc(it.name)}</div>+ ${it.location==='online'?'':sourceTools(it.id)}<div class="smeta mono">${srcBadge(it.location,it.cost,'srcbig')}<span style="align-self:center">${it.width||'?'}×${it.height||'?'}</span><span style="align-self:center">${fmtSize(it.size||0)}</span>@@ -1992,6 +2050,9 @@ async function openItem(id,push=true,mixContext=null){disposeStage(true);detailReturnBarsContext=null;barsContext=restore||{type:'home',filters:state};buildBars()};$('#closeStage').onclick=closeDetail;+ // 对账删掉的可能就是当前这条;删了就没什么可停留的,直接退回列表。+ wireSourceTools($('#stage'),r=>{+ if(r.items.some(x=>x.id===it.id))closeDetail();});if($('#castMore'))$('#castMore').onclick=e=>{$('#stage').querySelectorAll('[data-castoverflow]').forEach(row=>row.hidden=false);e.currentTarget.remove()};diff --git a/web/index.html b/web/index.htmlindex a4a69958e..07ca4eb87 100644--- a/web/index.html+++ b/web/index.html@@ -30,6 +30,7 @@<!-- JAV 入口:外框与其余 Lucide 图标同为 24×24 描边方框,字面走填色。用 SVG 而不是 CSS 边框加文字,才能和其它图标共用同一套描边渲染。 --><symbol id="i-jav" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="4"/><text x="12" y="16.6" text-anchor="middle" font-size="11.5" font-weight="600" fill="currentColor" stroke="none">番</text></symbol>+ <symbol id="i-folder-open" viewBox="0 0 24 24"><path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></symbol><symbol id="i-hard-drive" viewBox="0 0 24 24"><path d="M10 16h.01"/><path d="M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><path d="M21.946 12.013H2.054"/><path d="M6 16h.01"/></symbol><symbol id="i-globe" viewBox="0 0 24 24"><path d="M21.54 15H17a2 2 0 0 0-2 2v4.54"/><path d="M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/></symbol><symbol id="i-thumbs-up" viewBox="0 0 24 24"><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/><path d="M7 10v12"/></symbol>