Peach: Local-first video metadata scraper and media manager.
fix catalog and follow metadata presentation
longmeidao91eabb45e775
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex cc998f7d3..c1e4ef8ec 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -159,7 +159,7 @@ Gofile token 是另一份本机可选凭据,只进 Gofile 请求头,不进 U- FastAPI 与前端保持单体部署,在线来源和 AI 只通过显式适配器进入;AI runtime 与推理 API 的协议边界见 ADR-0003。- 当前页面、路由、交互与性能实现只写 `docs/STATUS.md`,由 API 和 `tests/test_web_ui.py` 守住;本文件不再复制易过期的版本号、像素值和控件清单。- `/taste` 只读合并 Peach 行为与本机私有浏览历史,且明确以浏览器记录为主要画像、Peach 内部为辅助证据;两者分别排序,不把“不合口味”自动归因或降权到 Tag。查询词里的负号项整体排除,下划线是组合词边界的一部分,不得把 `-ai_generated` 拆成正向 `generated`;游戏作品名等内容词按实际语义归类。模糊时长旧 Tag 只作兼容识别,禁止进入口味、索引、详情和筛选状态。时间窗使用当前资产的 `last_played` 和浏览访问时间;画像、补标签缺口和排名都只是候选。原始 URL/标题不进入页面或 ledger;上传原件保存在 `sources/taste-history/imports`,移除数据源只清理规范化分析库,不删除原件。浏览器数据库解析固定复用 `browserexport==0.4.4`,运行中浏览器仍先由 Peach 的 SQLite backup API 取得一致快照。macOS 与 Windows 的本机发现能力不等于跨主机同步;跨机数据必须显式导出、传输并按来源去重合并。-- 追更连接器、凭据、变体和跨站归组以 ADR-0019 为准。Rule34.xxx 来源身份大小写不敏感;作者显示名与头像优先经固定主机校验的官方页面,归档站只回退。+- 追更连接器、凭据、变体和跨站归组以 ADR-0019 为准。Rule34.xxx 来源身份大小写不敏感;作者显示名与头像优先经固定主机校验的官方页面,归档站只回退。关注页顶部标签筛选与卡片只使用来源明确标记为 `general` 的内容标签;详情页与在线标签索引保留全部来源标签,并按 Rule34 的 `general` / `artist` / `character` / `copyright` / `metadata` 分类着色。未知类型不猜成 `general`;在线索引点入后允许按对应来源类型筛选。- 自动追更固定使用 APScheduler 3.11.3,只在 ledger writer 启动。频率保存在 `peach-data/state/follow-schedule.json`,默认每小时且启动后等待一个完整间隔;不要改成启动即抓。任务必须保持 `coalesce=True`、`max_instances=1`,并与手动检查共用 `WebContract.follow_check_lock`,reader 只显示不可用状态。- 账本路径兼容和抽帧失败处理统一见 `.claude/skills/peach-cross-platform/SKILL.md` 与 `.claude/skills/peach-batch-jobs/SKILL.md`。diff --git a/scripts/detect_cover_faces.py b/scripts/detect_cover_faces.pyindex 3afe26f7d..600c9b311 100644--- a/scripts/detect_cover_faces.py+++ b/scripts/detect_cover_faces.py@@ -29,7 +29,8 @@ import cv2from peach.config import COVER_DIR#: 长封套的宽高比下限。低于它按竖版正封处理(整张就是正封,没有剧照区)。-SLEEVE_RATIO = 1.2+SLEEVE_RATIO_MIN = 1.2+SLEEVE_RATIO_MAX = 1.65#: 长封套上正封的起始横向位置。左边是剧照拼贴,检出必然是假阳性。FRONT_START = 0.468#: 纵向取景的合理区间。超出这个范围的检出多半不是主体人物。@@ -53,7 +54,7 @@ def detect(path: Path, cascade) -> dict | None:for x, y, w, h in faces:cx, cy = (x + w / 2) / width, (y + h / 2) / height# 长封套左半边是剧照拼贴,那里的「人脸」不是正封主体。- if ratio >= SLEEVE_RATIO and cx < FRONT_START:+ if SLEEVE_RATIO_MIN <= ratio < SLEEVE_RATIO_MAX and cx < FRONT_START:continueif not (MIN_Y <= cy <= MAX_Y):continuediff --git a/scripts/scrape_codes.py b/scripts/scrape_codes.pyindex e764bf11b..358449d02 100644--- a/scripts/scrape_codes.py+++ b/scripts/scrape_codes.py@@ -225,6 +225,10 @@ def build_parser() -> argparse.ArgumentParser:"--codes-file", type=Path,help="只处理文件中列出的番号;每行一个,空行和 # 注释忽略",)+ parser.add_argument(+ "--english-title-only", action="store_true",+ help="只处理已有非空英文标题、但没有日文标题的番号",+ )parser.add_argument("--limit", type=int, default=0)parser.add_argument("--delay", type=float, default=1.2)parser.add_argument("--min-free", type=float, default=40.0,@@ -271,6 +275,30 @@ def _select_requested_codes(return [available[query] for query in requested]+_JAPANESE_TEXT_RE = re.compile(r"[\u3040-\u30ff\u3400-\u9fff]")+_LATIN_TEXT_RE = re.compile(r"[A-Za-z]")+++def _select_english_title_codes(connection, codes: list[tuple[str, float, int]]) -> list[tuple[str, float, int]]:+ """Select codes whose recorded titles are Latin-only and have no Japanese alternative."""+ titles: dict[str, list[str]] = {}+ for code, catalog_title, original_title in connection.execute(+ "SELECT code,catalog_title,original_title FROM asset "+ "WHERE medium='video' AND code IS NOT NULL AND trim(code)<>''"+ ):+ key = normalise_code_key(str(code))+ titles.setdefault(key, []).extend(+ str(value).strip() for value in (catalog_title, original_title) if str(value or "").strip()+ )+ selected = []+ for row in codes:+ values = titles.get(normalise_code_key(row[0]), [])+ if (values and any(_LATIN_TEXT_RE.search(value) for value in values)+ and not any(_JAPANESE_TEXT_RE.search(value) for value in values)):+ selected.append(row)+ return selected++def _health_output(output: Path) -> Path:name = output.name.replace("metadata-field-candidates-", "metadata-source-health-", 1)if name == output.name:@@ -342,6 +370,8 @@ def main(argv: list[str] | None = None, *, provider: JavinizerGoProvider | Nonecodes = _select_requested_codes(codes, args.codes_file)except (OSError, UnicodeError, ValueError) as error:parser.error(str(error))+ if args.english_title_only:+ codes = _select_english_title_codes(connection, codes)if args.limit:codes = codes[:max(args.limit, 0)]log(f"字段候选批次:profile {policy.profile},番号 {len(codes)},来源 {','.join(sources)};只读查询,不写 ledger")@@ -442,6 +472,8 @@ def main(argv: list[str] | None = None, *, provider: JavinizerGoProvider | Noneif args.delay > 0 and not reused:time.sleep(args.delay + random.uniform(0, min(0.4, args.delay / 3)))for field, candidates in by_field.items():+ if args.english_title_only and field != "title":+ continuecandidates = sort_candidates(field, candidates, policy)candidate_writer.writerow({"item_key": f"{query}:{field}", "code": code, "query": query,diff --git a/src/peach/web_follow.py b/src/peach/web_follow.pyindex 51581fa24..fd6492501 100644--- a/src/peach/web_follow.py+++ b/src/peach/web_follow.py@@ -687,6 +687,31 @@ def _follow_facets(store, items, by_source, alias_map) -> dict:}+def _follow_tag_index(store, items) -> list[dict]:+ """按发布组汇总全部已分类来源标签,供在线标签索引使用。"""+ rows: dict[str, dict] = {}+ type_rank = {"general": 0, "metadata": 1, "copyright": 2,+ "character": 3, "artist": 4}+ for group in store.group(items):+ grouped: dict[str, tuple[str, str]] = {}+ for item in (group.primary, *group.variants, *group.duplicates):+ for tag in _item_all_tags(item):+ tag_type = _recorded_tag_type(item, tag)+ if not tag_type:+ continue+ key = tag.casefold()+ previous = grouped.get(key)+ if (previous is None+ or type_rank[tag_type] > type_rank[previous[1]]):+ grouped[key] = (tag, tag_type)+ for key, (tag, tag_type) in grouped.items():+ row = rows.setdefault(key, {"k": tag, "n": 0, "cat": tag_type})+ row["n"] += 1+ if type_rank[tag_type] > type_rank[row["cat"]]:+ row["cat"] = tag_type+ return sorted(rows.values(), key=lambda row: (-row["n"], row["k"]))++def q_follow_tags(contract, args) -> dict:"""在线标签词表,供标签页和左侧抽屉列出关注页那一套标签。@@ -698,6 +723,10 @@ def q_follow_tags(contract, args) -> dict:和「载入更多」都是现成的,换个地址就能用,不必为在线标签再写一套。"""query = str(args.get("q") or "").strip().casefold()+ include_types = str(args.get("types") or "") == "all"+ wanted_type = str(args.get("type") or "").casefold()+ if wanted_type not in {"general", "artist", "character", "copyright", "metadata"}:+ wanted_type = ""try:limit = max(1, min(int(args.get("limit") or 180), 2000))except (TypeError, ValueError):@@ -715,11 +744,19 @@ def q_follow_tags(contract, args) -> dict:items = tuple(item for item in store.items(limit=_ALL_ITEMS)if item.source_id in enabled and not _excluded_item(item))facets = _follow_facets(store, items, by_source, alias_map)- rows = [{"k": tag, "n": count} for tag, count in facets["tags"]- if not query or query in tag.casefold()]+ rows = (_follow_tag_index(store, items) if include_types else+ [{"k": tag, "n": count, "cat": "general"}+ for tag, count in facets["tags"]])+ categories: dict[str, int] = {}+ for row in rows:+ categories[row["cat"]] = categories.get(row["cat"], 0) + 1+ rows = [row for row in rows+ if (not wanted_type or row["cat"] == wanted_type)+ and (not query or query in row["k"].casefold())]return {"kind": "tags", "scope": "online","items": rows[offset:offset + limit],- "has_more": offset + limit < len(rows)}+ "has_more": offset + limit < len(rows),+ "categories": categories}def q_follow(contract, args) -> dict:@@ -768,7 +805,9 @@ def q_follow(contract, args) -> dict:if provider and (row is None or str(row["provider"] or "") != provider):return Falseif wanted_tags:- tags = set(_item_tags(item))+ # 在线标签索引包含 artist/character/copyright/metadata;点进去也必须+ # 能筛到对应更新,而不是只允许卡片上那份 general 投影。+ tags = set(_item_all_tags(item))if not all(tag in tags for tag in wanted_tags):return Falsereturn Truediff --git a/src/peach/web_review.py b/src/peach/web_review.pyindex e4c9035af..bc0f9e3b3 100644--- a/src/peach/web_review.py+++ b/src/peach/web_review.py@@ -63,7 +63,9 @@ CANDIDATE_PREFIX = {"video_endcards": "video-endcard-candidate-",}ADDITIONAL_CANDIDATE_FILES = {- "metadata_fields": ("fc2-metadata-field-candidates.csv",),+ # 分区文件先于通用批次读取;同一个 item_key 出现时,窄范围的刷新证据应覆盖+ # 通用批次里的旧候选,而不是被 seen 去重静默吞掉。+ "metadata_fields": ("japanese-title-candidates.csv", "fc2-metadata-field-candidates.csv"),}# 每类候选的稳定主键列。缺这一列的行直接跳过并计数,绝不退化成行号——# 行号会在 CSV 重排后把历史决定悄悄挪到别的条目上。@@ -128,10 +130,10 @@ def read_candidates(category: str, root: Path | None = None) -> tuple[list[dict]"""读取最新一批候选,返回(有稳定主键的行, 文件名, 被跳过的行数)。"""path = latest_candidate_file(category, root)base = root or GENERATED_DIR- paths = ([path] if path is not None and path.is_file() else []) + [+ paths = [base / name for name in ADDITIONAL_CANDIDATE_FILES.get(category, ())if (base / name).is_file() and (path is None or base / name != path)- ]+ ] + ([path] if path is not None and path.is_file() else [])if not paths:return [], None, 0key_column = CANDIDATE_KEY[category]diff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex d59789cc9..7e26a032f 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -663,6 +663,27 @@ class FollowContractTests(unittest.TestCase):self.assertEqual([row["k"] for row in last["items"]], ["pov"])self.assertFalse(last["has_more"])+ def test_online_tag_index_exposes_recorded_rule34_types_and_filters_them(self):+ candidate = FollowCandidate(+ provider="rule34xxx", external_id="typed", title="Typed",+ url="https://rule34.xxx/index.php?page=post&s=view&id=1",+ extra={"tags": ["pose", "artist_name", "hero", "series_name", "animated"],+ "tag_types": {"pose": "general", "artist_name": "artist",+ "hero": "character", "series_name": "copyright",+ "animated": "metadata"}},+ )+ self._seed(candidates=(candidate,), provider="rule34xxx", ref="typed")+ page = self._get("/api/follow/tags", types="all")+ self.assertEqual({row["k"]: row["cat"] for row in page["items"]}, {+ "pose": "general", "artist_name": "artist", "hero": "character",+ "series_name": "copyright", "animated": "metadata",+ })+ artists = self._get("/api/follow/tags", types="all", type="artist")+ self.assertEqual([(row["k"], row["cat"]) for row in artists["items"]],+ [("artist_name", "artist")])+ self.assertEqual(sum(self._get(tag="artist_name")["counts"].values()), 1,+ "在线索引里的非 general 标签点入后必须能筛到原条目")+def test_counts_are_whole_library_while_groups_are_one_page(self):"""计数是全库口径,列表只有一页——界面并排显示这两个数时看起来像自相矛盾。@@ -1714,7 +1735,7 @@ class FollowWebSourceTests(unittest.TestCase):self.assertPageContains("const randomizedAuthors=followRandomOrder([...authors],row=>row[0])")self.assertPageContains("const topTagRows=followRandomOrder([...tagCounts],row=>row[0]).slice(0,20)")self.assertPageContains("if(push)followDiscoverySeed=Math.floor(Math.random()*0xffffffff)")- self.assertPageContains("topTagRows.push([tag,tagCounts.get(tag)])")+ self.assertPageContains("topTagRows.push([tag,tagCounts.get(tag)||allCount])")def test_follow_tags_are_multi_select_and_use_rule34_property_colours(self):self.assertPageContains("let followAuthor='',followProvider='',followTags=new Set()")@@ -1823,6 +1844,7 @@ class FollowWebSourceTests(unittest.TestCase):"按行插入,避免把卡片那一行截断")# 列表还没渲染出来时(直达详情链接)仍回退到列表前self.assertPageContains("followList.before($('#stage'))")+ self.assertPageContains("followList?.classList.contains('followphotowall')")self.assertPageContains(".followlist>.stage{grid-column:1/-1;width:100%;min-width:0}")self.assertPageContains("scrollItemDetailIntoView();","滚到舞台本身而不是页面头部")@@ -1883,8 +1905,11 @@ class FollowWebSourceTests(unittest.TestCase):self.assertNotIn("约 ${text}", body)self.assertIn("return text", body)- def test_release_variant_rows_show_when_not_a_meaningless_kind(self):- self.assertPageContains("if(!label&&group.is_release)label=localTime(item.published_at).slice(5,10)")+ def test_release_time_is_not_reused_as_a_variant_label(self):+ self.assertPageContains("if(!label&&group.is_release)label=item.variant_label||item.variant_kind||''")+ body = self.page[self.page.index("function followCollectionCopy("):+ self.page.index("function followQueueHtml(")]+ self.assertNotIn("localTime(item.published_at)", body)def test_release_rows_show_the_reply_body_not_the_thread_title(self):self.assertPageContains("const body=group.is_release")@@ -2202,8 +2227,9 @@ class FollowWebSourceTests(unittest.TestCase):)self.assertPageContains("followMediaView==='images'?' followphotowall':''")self.assertPageContains(".followlist.followphotowall{display:block;column-count:5")- self.assertPageContains(".followlist.followphotowall>.stage{column-span:all}",- "图片瀑布流里的详情必须跨栏,否则媒体列会被侧栏挤成 0px")+ self.assertPageLacks(".followlist.followphotowall>.stage{column-span:all}")+ self.assertPageContains("followList?.classList.contains('followphotowall')",+ "图片详情必须脱离多栏,否则顶部图片会在很下面展开")self.assertPageContains(".followitem.imagecard .followvisual .pic>img{position:relative")def test_external_file_pages_do_not_default_to_video_and_paging_actions_share_one_row(self):diff --git a/tests/test_scripts.py b/tests/test_scripts.pyindex a949ff006..5f0d82b0c 100644--- a/tests/test_scripts.py+++ b/tests/test_scripts.py@@ -43,6 +43,27 @@ class OperationalScriptTests(unittest.TestCase):self.assertIsNone(self.clean_names._logf)self.assertIsNone(self.scrape_codes._logf)+ def test_cover_face_detector_only_treats_dvd_proportions_as_sleeves(self):+ source = (ROOT / "scripts" / "detect_cover_faces.py").read_text(encoding="utf-8")+ self.assertIn("SLEEVE_RATIO_MIN = 1.2", source)+ self.assertIn("SLEEVE_RATIO_MAX = 1.65", source)+ self.assertIn("SLEEVE_RATIO_MIN <= ratio < SLEEVE_RATIO_MAX", source)++ def test_english_title_batch_excludes_codes_that_already_have_japanese(self):+ connection = sqlite3.connect(":memory:")+ connection.execute("CREATE TABLE asset(medium TEXT,code TEXT,catalog_title TEXT,original_title TEXT)")+ connection.executemany("INSERT INTO asset VALUES('video',?,?,?)", [+ ("AAA-001", "English title", None),+ ("BBB-002", "English title", "日本語タイトル"),+ ("CCC-003", None, None),+ ])+ codes = [("AAA-001", 1.0, 1), ("BBB-002", 1.0, 1), ("CCC-003", 1.0, 1)]+ self.assertEqual(self.scrape_codes._select_english_title_codes(connection, codes),+ [("AAA-001", 1.0, 1)])+ connection.close()+ source = (ROOT / "scripts" / "scrape_codes.py").read_text(encoding="utf-8")+ self.assertIn('if args.english_title_only and field != "title":', source)+def test_official_jav_tags_only_enter_the_reviewed_taxonomy(self):category_map = self.scrape_codes.CATEGORY_MAPself.assertEqual(category_map["Deep Throat"], "深喉")diff --git a/tests/test_web_review.py b/tests/test_web_review.pyindex 316b052b1..5200ec38d 100644--- a/tests/test_web_review.py+++ b/tests/test_web_review.py@@ -172,6 +172,26 @@ class ReviewQueueTests(unittest.TestCase):self.assertIn("fc2-metadata-field-candidates.csv", source)self.assertEqual(skipped, 0)+ def test_japanese_title_partition_overrides_the_same_key_from_the_general_batch(self):+ fields = ["item_key", "code", "query", "field", "current_value",+ "candidates_json", "source_count", "source_profile", "policy_version",+ "status", "size_gb", "videos", "fetched_at"]+ common = {"code": "ABP-222", "query": "ABP-222", "field": "title",+ "current_value": "English", "source_count": "1", "source_profile": "test",+ "policy_version": "test", "status": "candidate", "size_gb": "1",+ "videos": "1", "fetched_at": "now"}+ self._csv("metadata-field-candidates-20260822.csv", fields, [{+ **common, "item_key": "ABP-222:title", "candidates_json": '[{"value":"English"}]',+ }])+ self._csv("japanese-title-candidates.csv", fields, [{+ **common, "item_key": "ABP-222:title", "candidates_json": '[{"value":"日本語"}]',+ }])+ rows, source, skipped = rm_review.read_candidates("metadata_fields", self.candidates)+ self.assertEqual(len(rows), 1)+ self.assertIn("日本語", rows[0]["candidates_json"])+ self.assertIn("japanese-title-candidates.csv", source)+ self.assertEqual(skipped, 0)+def _release_row(self, key, code, source="r18dev", current="", n=1):return {"item_key": key, "field": "release_date", "current": current,"candidates": ["2015-02-20"][:n], "code": code, "source": source}diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex a69424ae7..38177e148 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -403,6 +403,8 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("const COVER_FRONT_RATIO=0.7;")self.assertPageContains("(jav&&layout==='big'?COVER_FRONT_RATIO:16/9)")self.assertPageContains('.poster.cover.front[data-frame="sleeve"]{object-position:100%')+ self.assertPageContains("r>1.2&&r<1.65?'sleeve':'front'",+ "16:9 官方剧照不能当成双页封套裁到最右侧")# 判据是 `jav` 不是 `useCover`:缺封面的卡片也要拉长,用 16:9 预览图上下留黑边,# 否则一行里高矮混排会把网格撕成锯齿状。self.assertPageLacks("useCover&&layout==='big'")@@ -1514,11 +1516,14 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("const coStarred=performers.length>1&&!primaryCreator")self.assertPageContains("return (it.is_jav&&performer?performer:it.creator)||performer")- def test_jav_detail_prefers_official_title_and_labels_official_tags(self):- self.assertPageContains("it?.catalog_title||it?.original_title")- self.assertPageContains("t.official?' official':''")- self.assertPageContains("<small>官方</small>")- self.assertPageContains(".detailtag.official{")+ def test_jav_detail_prefers_japanese_title_and_keeps_official_tags_visually_neutral(self):+ self.assertPageContains("const javPreferredTitle=it=>")+ self.assertPageContains("titles.find(hasJapaneseText)||titles[0]||''")+ self.assertPageContains('wrap.innerHTML=visible.map(t=>`<span class="detailtag">')+ self.assertPageLacks("<small>官方</small>")+ self.assertPageLacks(".detailtag.official{")+ self.assertPageContains("const byDisplay=new Map()")+ self.assertPageContains("foldName(t.k)===key&&foldName(previous.k)!==key")def test_drawer_filters_follow_entity_and_detail_context(self):# 实体页 facets 必须按当前实体取数;详情页则按单个作品取数,不能继续复用首页全库。@@ -1861,9 +1866,9 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("['story','故事剧情']")self.assertPageContains("['position','性交体位']")self.assertPageContains("['general','其他内容']")- self.assertPageLacks("['copyright','作品']")+ self.assertPageContains("['copyright','作品']")self.assertPageLacks("['artist','人物']")- self.assertPageLacks("['character','角色']")+ self.assertPageContains("['character','角色']")self.assertPageContains("key==='all'||Number(d.categories?.[key]||0)>0")self.assertPageContains("'1080P':'1080p'")self.assertPageContains("'60fps':'60FPS'")@@ -2282,11 +2287,18 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("if(tagIndexScope==='online')tagIndexMode='alphabet';","切到在线应当直接给出字母表,那才是它的形态")self.assertPageContains("const onlineTags=kind==='tags'&&tagIndexScope==='online';")- self.assertPageContains("'/api/follow/tags?limit='+indexLimit+'&offset='+offset")- # 类别划分和多选面板都是本地标签的语义,在线那套没有对应物。- self.assertPageContains("const filters=kind==='tags'&&!onlineTags?")+ self.assertPageContains("'/api/follow/tags?types=all&limit='+indexLimit+'&offset='+offset")+ self.assertPageContains("const ONLINE_TAG_CATEGORIES=")+ self.assertPageContains("onlineTags?'r34-'+(x.cat||'unknown')")+ self.assertPageContains("const categoryOptions=onlineTags?ONLINE_TAG_CATEGORIES:TAG_CATEGORIES")+ # 多选面板是本地目录语义;分类栏两套词表都显示。self.assertPageContains("if(kind==='tags'&&!onlineTags){")- self.assertPageContains(".tg.online,.alphatag.online{--tag-color:#5AC8D8")+ self.assertPageContains(".alphatag.r34-artist")+ self.assertPageContains(".alphatag.r34-character")+ self.assertPageContains(".alphatag.r34-copyright")+ self.assertPageContains(".alphatag.r34-metadata")+ self.assertPageContains("indexheading")+ self.assertPageContains("${icon('database')}本地")def test_an_online_tag_opens_the_follow_page_not_a_catalog_filter(self):"""在线标签标注的是还没入库的在线更新,拿去筛目录必然一条不中。"""@@ -2401,8 +2413,8 @@ class WebUiSourceTests(unittest.TestCase):def test_detail_source_icon_starts_at_the_content_edge(self):self.assertPageContains(".detailtitle>.srcbig{place-items:start;width:17px;margin-top:2px}")- def test_official_tag_marker_uses_regular_weight(self):- self.assertPageContains(".detailtag .tagfilter small{margin-left:5px;color:var(--accent);font-size:var(--fs-xs);font-weight:400}")+ def test_official_tags_do_not_have_a_visible_marker(self):+ self.assertPageLacks(".detailtag .tagfilter small{")def test_editions_collapse_into_one_card_with_a_version_badge(self):"""同番号的几个版次合成一张卡,角标写清有几个版本。"""self.assertPageContains("function collapseEditionGroups(items){")@@ -2635,7 +2647,7 @@ class WebUiSourceTests(unittest.TestCase):"button.innerHTML=`${spinnerHtml('正在定位')}${label?`<span>${esc(label)}</span>`:''}`")self.assertPageContains("if(activeLightbox?.detail?.isOpen()){activeLightbox.detail.dismiss(true);return}")self.assertPageContains("if(returnFocus&&document.contains(toggle))toggle.focus()")- self.assertPageContains("queueMicrotask(()=>reveal.focus())")+ self.assertPageContains("queueMicrotask(()=>{const target=reveal.hidden?title:reveal;target.focus()})")self.assertPageContains("const dismissOutside=target=>{if(panel.hidden||toggle.contains(target)||panel.contains(target))return false")self.assertPageContains("if(detail.dismissOutside(e.target))return")self.assertPageContains(".photodetail[hidden]{display:none}")diff --git a/web/app.css b/web/app.cssindex ba9515317..fe8c53c0c 100644--- a/web/app.css+++ b/web/app.css@@ -288,6 +288,7 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{body.entity-open .index{overflow-x:visible}.index .ihead{display:flex;align-items:center;gap:12px;margin-bottom:14px}.index .ihead h2{margin:0}+.indexheading{display:inline-flex;align-items:center;gap:9px}.indexheading svg{width:25px;height:25px;stroke:currentColor;fill:none;stroke-width:1.8}.index .ihead .isearch{margin-left:auto}.index .isearch{flex:1;max-width:320px;background:var(--sunk);border:1px solid var(--line);border-radius:18px;padding:6px 14px}@@ -305,7 +306,8 @@ body.entity-open .index{overflow-x:visible}.icell .n{font-size:var(--fs-xs);color:var(--muted)}.tagwall{display:flex;flex-wrap:wrap;gap:7px}.tagmodes{display:flex;gap:4px;padding:3px;border:1px solid var(--line-soft);border-radius:10px;background:var(--surface)}-.tagmodes button{border:0;border-radius:7px;background:transparent;color:var(--muted);padding:6px 10px;cursor:pointer}+.tagmodes button{border:0;border-radius:7px;background:transparent;color:var(--muted);padding:6px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:6px}+.tagmodes button svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:1.8}.tagmodes button[aria-pressed="true"]{background:var(--hover);color:var(--ink)}.tagfilters{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 18px}.tagfilters button{height:34px;padding:0 13px;border-radius:var(--pill-radius);border:1px solid var(--line-soft);@@ -324,7 +326,12 @@ body.entity-open .index{overflow-x:visible}.tagselection button:disabled{opacity:.45;cursor:not-allowed}.tagfilters .all::before{background:linear-gradient(135deg,#55A7FF,#D783FF)}.index-tags .tg,.alphatag{--tag-color:#7A91A8}-.index-tags /* 在线标签是另一个种类,不是另一个类别:它标注的是还没入库的在线更新,点了去关注页而不是筛目录。类别配色留给本地那套,在线单独一个色。两个自定义属性都设:.alphatag 读 --tag-color,.tg 的边框和底色读 --r34-tag。 */.tg.online,.alphatag.online{--tag-color:#5AC8D8;--r34-tag:#5AC8D8}+.index-tags .tg.r34-general,.alphatag.r34-general,.tagfilters .general{--tag-color:#55A7FF;--r34-tag:#55A7FF}+.index-tags .tg.r34-artist,.alphatag.r34-artist,.tagfilters .artist{--tag-color:#E36C6C;--r34-tag:#E36C6C}+.index-tags .tg.r34-character,.alphatag.r34-character,.tagfilters .character{--tag-color:#68C76F;--r34-tag:#68C76F}+.index-tags .tg.r34-copyright,.alphatag.r34-copyright,.tagfilters .copyright{--tag-color:#D675D6;--r34-tag:#D675D6}+.index-tags .tg.r34-metadata,.alphatag.r34-metadata,.tagfilters .metadata{--tag-color:#F5A24A;--r34-tag:#F5A24A}+.index-tags .tg.r34-unknown,.alphatag.r34-unknown{--tag-color:var(--muted);--r34-tag:var(--muted)}/* 抽屉里的关注标签沿用同一个青色,让「这是在线那套词表」在两处一致。 */.chip.online{border-color:color-mix(in srgb,#5AC8D8 42%,transparent);background:color-mix(in srgb,#5AC8D8 10%,transparent)}.tg.general,.alphatag.general,.tagfilters .general{--tag-color:#55A7FF}.index-tags .tg.artist,.alphatag.artist,.tagfilters .artist{--tag-color:#F1A454}@@ -1296,8 +1303,6 @@ body.index-open #tiers,body.index-open #tagbar{display:none}background:color-mix(in srgb,var(--surface) 82%,var(--ground));overflow:hidden;min-height:30px}.detailtag button{border:0;background:transparent;color:var(--ink-2);cursor:pointer;height:28px}.detailtag .tagfilter{padding:3px 5px 3px 11px}.detailtag .tagremove{width:28px;padding:0;display:grid;place-items:center;color:var(--muted)}-.detailtag .tagfilter small{margin-left:5px;color:var(--accent);font-size:var(--fs-xs);font-weight:400}-.detailtag.official{border-color:color-mix(in srgb,var(--accent) 42%,var(--line));background:color-mix(in srgb,var(--accent) 7%,transparent)}.detailtag .tagremove:hover{color:var(--drop);background:color-mix(in srgb,var(--drop) 12%,transparent)}.detailtag svg,.tagplus svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}.tagplus{width:30px;height:30px;border:1px dashed var(--line);border-radius:50%;display:grid;place-items:center;@@ -1824,9 +1829,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.fauthorhead .ficon{margin-right:2px}.followlist{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile),1fr));gap:16px 8px}.followlist.followphotowall{display:block;column-count:5;column-gap:10px}-/* 图片瀑布流使用多栏布局;详情舞台如果仍占普通栏位,350px 侧栏会把媒体列挤成- 0px。跨越全部栏位既保留就近展开顺序,也让图片和信息栏拿到列表完整宽度。 */-.followlist.followphotowall>.stage{column-span:all}+/* 图片详情放在瀑布流之前,不再作为多栏子项参与列填充。 */@media (max-width:1400px){.followlist.followphotowall{column-count:4}}@media (max-width:1000px){.followlist.followphotowall{column-count:3}}.followitem{min-width:0}.followitem.collection{padding-top:7px}diff --git a/web/app.js b/web/app.jsindex a49cdd42d..2e558f49d 100644--- a/web/app.js+++ b/web/app.js@@ -49,6 +49,11 @@ const javFileDisplayName=(it,value=it?.name)=>{const name=String(value||'').trim();return it?.is_jav?name.replace(JAV_MEDIA_SUFFIX,''):name;};+const hasJapaneseText=value=>/[\u3040-\u30ff\u3400-\u9fff]/.test(String(value||''));+const javPreferredTitle=it=>{+ const titles=[it?.catalog_title,it?.original_title].map(value=>String(value||'').trim()).filter(Boolean);+ return titles.find(hasJapaneseText)||titles[0]||'';+};function javTitleParts(it,value=it?.name){const name=javFileDisplayName(it,value),code=String(it?.code||'').trim().toUpperCase();if(!it?.is_jav||!code)return {code:'',title:name};@@ -58,7 +63,7 @@ function javTitleParts(it,value=it?.name){||(upper.startsWith(displayCode)&&/^[\s._\-[\]]/.test(name.slice(displayCode.length)));const prefixLength=upper.startsWith(displayCode)?displayCode.length:code.length;const filenameTitle=(hasPrefix?name.slice(prefixLength):name).replace(/^[\s._-]+/,'').trim();- const officialTitle=String(it?.catalog_title||it?.original_title||'').trim();+ const officialTitle=javPreferredTitle(it);// API 显式返回空 display_title 也是有意义的“清洁后无标题”,不能再回退到脏文件名。const cleanFallback=Object.prototype.hasOwnProperty.call(it||{},'display_title')?String(it.display_title||'').trim():filenameTitle;@@ -1020,7 +1025,9 @@ function facePos(f){/* 官方封套有两种形态,实测过:整张封套约 1.48(左侧是剧照拼贴,右侧才是正封),竖版正封约 0.70(本身就是正封,没有左半边可裁)。所以取景不能写死「取右边」,得等图片加载后按它自己的宽高比分流——服务端没存这个比例,也不该为此再存一份。 */-const COVER_FRAME=`onload="const r=this.naturalWidth/this.naturalHeight;this.dataset.frame=r>1.2?'sleeve':'front'"`;+/* 常见双页 DVD 封套约 1.45:1;16:9 的横版官方剧照不是封套,不能把它也推到+ 最右半边。上限给扫描留余量,但明确排除 259LUXU-1573 这类 1.78:1 剧照。 */+const COVER_FRAME=`onload="const r=this.naturalWidth/this.naturalHeight;this.dataset.frame=r>1.2&&r<1.65?'sleeve':'front'"`;/* 整张封套里右侧正封占的宽高比。裁切靠的是容器比例而不是 CSS 裁剪:`object-fit:cover`只在容器比图片更「竖」时才会横向裁,容器一旦宽过 1.48 就变成纵向裁、整张封套原样铺满——这正是「大图」以前只是撑满画布、没取到右侧的原因。 */@@ -2584,7 +2591,8 @@ function followResourceLinks(item){行首则说明它与主条目的关系。 */function followCollectionCopy(group,item,mark=''){let label=mark;- if(!label&&group.is_release)label=localTime(item.published_at).slice(5,10)||'动态';+ // 发布时间已经由 followWhen 单独显示,不能再伪装成版本/类型标签。+ if(!label&&group.is_release)label=item.variant_label||item.variant_kind||'';if(!label)label=item.variant_kind==='wip'?'WIP':(item.variant_label||item.variant_kind||'视频');const body=group.is_release?(item.summary||(item.has_media?'(仅附件)':'(无正文)')):item.title;@@ -2697,7 +2705,12 @@ async function openFollowDetail(id,push=true,mediaIndex=null,preserveReturn=fals行的判定用 offsetTop——同一行的卡片顶边相同。 */const followList=$('#stats').querySelector('.followlist');const clicked=followList&&followList.querySelector(`[data-follow-item="${item.id}"]`);- if(clicked){+ if(followList?.classList.contains('followphotowall')){+ /* CSS 多栏按 DOM 顺序先填满一整列,再填下一列;视觉上位于顶部的第 5 张图,+ DOM 中可能已经排在几十张之后。详情若插回多栏,必然出现在页面很下面。+ 图片详情因此统一放在瀑布流之前,保持当前视口可预测。 */+ followList.before($('#stage'));+ }else if(clicked){const cards=[...followList.children];const row=clicked.offsetTop;// 同一行里最后一张卡片:它之后就是插入点。@@ -3014,15 +3027,17 @@ function renderFollow(){name:followAuthorName(list),sources:list,}]));const randomizedAuthors=followRandomOrder([...authors],row=>row[0]);+ const allCount=Object.values(counts).reduce((total,count)=>total+(+count||0),0);const topTagRows=followRandomOrder([...tagCounts],row=>row[0]).slice(0,20);followTags.forEach(tag=>{- if(tagCounts.has(tag)&&!topTagRows.some(([key])=>key===tag))- topTagRows.push([tag,tagCounts.get(tag)]);+ if(!topTagRows.some(([key])=>key===tag))+ topTagRows.push([tag,tagCounts.get(tag)||allCount]);});const topTags=topTagRows.map(([tag,n])=>[tag,tagLabel(tag),n]);if(followAuthor&&!authors.has(followAuthor))followAuthor='';if(followProvider&&!providers.has(followProvider))followProvider='';- followTags=new Set([...followTags].filter(tag=>tagCounts.has(tag)));+ // artist/character/copyright/metadata 不进入 general facets,但从在线标签索引点入后+ // 仍是有效筛选,不能因为顶部筛选条的口径更窄就把它从 URL 和界面删掉。// 作者、来源和标签都已在服务端筛过,这里不再筛第二遍——两份同义的判定必然漂移。const mediaCounts={videos:0,images:0};groups.forEach(group=>followMediaKinds(group).forEach(kind=>@@ -3032,7 +3047,6 @@ function renderFollow(){const providerPills=[...providers].map(([key,label])=>`<button class="pill sourcepill" data-follow-provider="${esc(key)}" aria-pressed="${key===followProvider}"title="${esc(label)}" aria-label="来源:${esc(label)}">${sourceIcon(key)}</button>`).join('');- const allCount=Object.values(counts).reduce((total,count)=>total+(+count||0),0);$('#stats').innerHTML=`<div class="follow"><div class="followhead"><h2 class="disp pagetitle">关注</h2><button class="fbtn primary fcheck" data-follow-manage>${icon('settings')}管理关注</button></div>@@ -3935,6 +3949,8 @@ let tagIndexMode='alphabet',tagIndexCategory='all',tagIndexScope='local',indexReconst TAG_CATEGORIES=[['all','全部'],['meta','影片属性'],['relationship','人物关系'],['role','角色设定'],['appearance','外貌身材'],['scene','情境场所'],['story','故事剧情'],['position','性交体位'],['general','其他内容']];+const ONLINE_TAG_CATEGORIES=[['all','全部'],['general','通用'],['artist','作者'],+ ['character','角色'],['copyright','作品'],['metadata','元数据']];const TAG_DISPLAY_NAMES={'1080P':'1080p','60fps':'60FPS','AI去码':'AI解码','淫语ASMR':'ASMR','JK制服':'JK','OL制服':'OL','眼镜':'眼镜娘','情趣内衣':'性感内衣','口罩遮脸':'口罩','强制剧情':'强制','足系':'美腿','足交':'脚交','骑乘':'骑乘位',@@ -3965,7 +3981,7 @@ async function openIndex(kind,q,push=true){if(kind==='tags'){indexQuery.set('view',tagIndexMode);if(onlineTags)indexQuery.set('scope','online');- if(!onlineTags&&tagIndexCategory!=='all')indexQuery.set('category',tagIndexCategory)}+ if(tagIndexCategory!=='all')indexQuery.set('category',tagIndexCategory)}if(push)route('/'+kind+(indexQuery.size?'?'+indexQuery:''),!!q);showHomeSurfaces();// 必须在 showHomeSurfaces 之后加:它会清掉这两个类并恢复顶部横条,@@ -3976,7 +3992,9 @@ async function openIndex(kind,q,push=true){/* 在线标签走关注页那套统计,形状与 /api/index 一致,所以分页、搜索和「载入更多」这三处现成的机制换个地址就能用。 */const indexApi=offset=>onlineTags- ?'/api/follow/tags?limit='+indexLimit+'&offset='+offset+(q?'&q='+encodeURIComponent(q):'')+ ?'/api/follow/tags?types=all&limit='+indexLimit+'&offset='+offset++ (tagIndexCategory!=='all'?'&type='+encodeURIComponent(tagIndexCategory):'')++ (q?'&q='+encodeURIComponent(q):''):'/api/index?kind='+kind+'&limit='+indexLimit+'&offset='+offset+(q?'&q='+encodeURIComponent(q):'')+(kind==='tags'&&tagIndexCategory!=='all'?'&category='+encodeURIComponent(tagIndexCategory):'');@@ -3993,31 +4011,33 @@ async function openIndex(kind,q,push=true){(groups[key]||(groups[key]=[])).push(x)});return Object.entries(groups).sort(([a],[b])=>a.localeCompare(b,'zh-CN')).map(([letter,items])=>`<section class="alphagroup"><h3>${letter}</h3><div class="alphalist">${items.map(x=>- `<button class="alphatag ${onlineTags?'online':(x.cat||'general')}" data-k="${esc(x.k)}" aria-pressed="${selectedIndexTags.has(x.k)}"><span>${esc(tagLabel(x.k))}</span><span class="n">${x.n.toLocaleString()}</span></button>`).join('')}</div></section>`).join('')};+ `<button class="alphatag ${onlineTags?'r34-'+(x.cat||'unknown'):(x.cat||'general')}" data-k="${esc(x.k)}" aria-pressed="${selectedIndexTags.has(x.k)}"><span>${esc(tagLabel(x.k))}</span><span class="n">${x.n.toLocaleString()}</span></button>`).join('')}</div></section>`).join('')};const peopleHtml=items=>items.map(x=>`<button class="icell" data-k="${esc(x.k)}" data-kind="${entityKind}"><span class="ring">${avatarInner(x.k,kind==='performers'&&x.entity_id?{id:x.entity_id}:null, x.rep)}</span><span class="nm">${esc(x.k)}</span><span class="n">${x.n.toLocaleString()}</span></button>`).join('');- const tagHtml=items=>tagIndexMode==='alphabet'?`<div class="alphabet">${tagGroups(items)}</div>`:`<div class="tagwall index-tags">`+items.map(x=>`<button class="tg ${onlineTags?'online':(x.cat||'general')}" data-k="${esc(x.k)}" aria-pressed="${selectedIndexTags.has(x.k)}"+ const tagHtml=items=>tagIndexMode==='alphabet'?`<div class="alphabet">${tagGroups(items)}</div>`:`<div class="tagwall index-tags">`+items.map(x=>`<button class="tg ${onlineTags?'r34-'+(x.cat||'unknown'):(x.cat||'general')}" data-k="${esc(x.k)}" aria-pressed="${selectedIndexTags.has(x.k)}"style="padding:5px 12px;font-size:13px">${esc(tagLabel(x.k))}<span style="opacity:.6;font-size:11px">${x.n.toLocaleString()}</span></button>`).join('')+`</div>`;const body=people?`<div class="igrid">${peopleHtml(d.items)}</div>`:tagHtml(tagItems);- const visibleTagCategories=TAG_CATEGORIES.filter(([key])=>key==='all'||Number(d.categories?.[key]||0)>0);- /* 类别划分(影片属性、人物关系……)是本地标签的语义,在线那套 booru 标签没有- 对应划分;多选面板拼的是目录筛选,对在线标签也不成立。两者都只在本地范围出现。 */- const filters=kind==='tags'&&!onlineTags?`<div class="tagfilters" aria-label="标签类型">${visibleTagCategories.map(([key,label])=>+ const categoryOptions=onlineTags?ONLINE_TAG_CATEGORIES:TAG_CATEGORIES;+ const visibleTagCategories=categoryOptions.filter(([key])=>key==='all'||Number(d.categories?.[key]||0)>0);+ const categoryFilters=kind==='tags'?`<div class="tagfilters" aria-label="标签类型">${visibleTagCategories.map(([key,label])=>`<button class="${key}" data-tag-category="${key}" aria-pressed="${tagIndexCategory===key}">${label}</button>`).join('')}</div>+ `:'';+ /* 多选面板拼的是目录筛选,只在本地范围出现;在线分类来自上游 booru tag_type。 */+ const filters=categoryFilters+(kind==='tags'&&!onlineTags?`<div class="tagselection" data-tag-selection hidden><label><input type="checkbox" data-tag-match-any ${tagIndexMatch==='any'?'checked':''}><span><b>广泛匹配</b><small>开启后匹配任一所选标签;关闭后必须同时包含全部标签。</small></span></label><span class="mono" data-tag-selected>已选 0 个标签</span><button type="button" data-tag-clear>清空</button><button type="button" class="primary" data-tag-apply disabled>显示结果</button>- </div>`:'';+ </div>`:'');$('#index').innerHTML=`<div class="ihead">- <h2 class="disp">${title}</h2>+ <h2 class="disp indexheading">${kind==='tags'?icon('tags'):''}${title}</h2><span class="mono" id="indexCount" style="color:var(--muted)">${tagItems.length}${d.has_more?'+':''} 项</span>- ${kind==='tags'?`<div class="tagmodes"><button data-tag-scope="local" aria-pressed="${!onlineTags}">本地</button><button data-tag-scope="online" aria-pressed="${onlineTags}">在线</button></div>- <div class="tagmodes"><button data-tag-view="cloud" aria-pressed="${tagIndexMode==='cloud'}">标签云</button><button data-tag-view="alphabet" aria-pressed="${tagIndexMode==='alphabet'}">字母表</button></div>`:''}+ ${kind==='tags'?`<div class="tagmodes"><button data-tag-scope="local" aria-pressed="${!onlineTags}">${icon('database')}本地</button><button data-tag-scope="online" aria-pressed="${onlineTags}">${icon('globe')}在线</button></div>+ <div class="tagmodes"><button data-tag-view="cloud" aria-pressed="${tagIndexMode==='cloud'}">${icon('tags')}标签云</button><button data-tag-view="alphabet" aria-pressed="${tagIndexMode==='alphabet'}">${icon('list-filter')}字母表</button></div>`:''}<div class="isearch"><input id="iq" placeholder="过滤…" value="${esc(q||'')}"></div></div>${filters}<div id="indexBody">${body}</div><button class="indexmore" id="indexMore" type="button" ${d.has_more?'':'hidden'}>载入更多</button>`;let it2; $('#iq').oninput=e=>{clearTimeout(it2);it2=setTimeout(()=>openIndex(kind,e.target.value.trim(),true),300)};@@ -4026,6 +4046,7 @@ async function openIndex(kind,q,push=true){tagIndexScope=b.dataset.tagScope;// 在线标签全是英文,字母表才是它的形态;切过去时顺手换上,不必用户再点一次。if(tagIndexScope==='online')tagIndexMode='alphabet';+ tagIndexCategory='all';selectedIndexTags.clear();openIndex('tags',$('#iq').value.trim(),true)});$('#index').querySelectorAll('[data-tag-view]').forEach(b=>b.onclick=()=>{@@ -5439,8 +5460,13 @@ async function openItem(id,push=true,queueContext=null,anchor=null){});const renderDetailTags=()=>{const wrap=$('#detailTags');if(!wrap)return;- const visible=(it.tags||[]).filter(t=>!DURATION_TAGS.has(t.k)).slice(0,40);- wrap.innerHTML=visible.map(t=>`<span class="detailtag${t.official?' official':''}"><button class="tagfilter" data-tag="${esc(t.k)}">${esc(tagLabel(t.k))}${t.official?'<small>官方</small>':''}</button><button class="tagremove" data-remove-tag="${esc(t.k)}" title="从此视频隐藏该标签" aria-label="删除标签 ${esc(tagLabel(t.k))}">${icon('x')}</button></span>`).join('')++ const byDisplay=new Map();+ (it.tags||[]).filter(t=>!DURATION_TAGS.has(t.k)).forEach(t=>{+ const key=foldName(tagLabel(t.k)),previous=byDisplay.get(key);+ // `足系` 与 `美腿` 的可见名相同;优先保留本身就是规范显示名的那条。+ if(!previous||foldName(t.k)===key&&foldName(previous.k)!==key)byDisplay.set(key,t)});+ const visible=[...byDisplay.values()].slice(0,40);+ wrap.innerHTML=visible.map(t=>`<span class="detailtag"><button class="tagfilter" data-tag="${esc(t.k)}">${esc(tagLabel(t.k))}</button><button class="tagremove" data-remove-tag="${esc(t.k)}" title="从此视频隐藏该标签" aria-label="删除标签 ${esc(tagLabel(t.k))}">${icon('x')}</button></span>`).join('')+`<button class="tagplus" id="tagPlus" title="添加标签" aria-label="添加标签" aria-expanded="false">${icon('plus')}</button><div class="tagpicker" id="tagPicker" role="dialog" aria-label="添加标签" hidden><label class="tagpicksearch">${icon('search')}<input id="tagPickSearch" maxlength="80" placeholder="搜索或输入新标签" autocomplete="off"></label>@@ -6143,7 +6169,8 @@ async function restoreRoute(){tagIndexScope=params.get('scope')==='online'?'online':'local';tagIndexMode=params.get('view')==='cloud'?'cloud':'alphabet';const category=params.get('category')||'all';- tagIndexCategory=TAG_CATEGORIES.some(([key])=>key===category)?category:'all'}+ const categories=tagIndexScope==='online'?ONLINE_TAG_CATEGORIES:TAG_CATEGORIES;+ tagIndexCategory=categories.some(([key])=>key===category)?category:'all'}await openIndex(path.slice(1),params.get('q')||'',false);return}if(path==='/stats'){await openStats(false);return}if(path==='/taste'){await openTaste(false);return}