Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(web): 恢复标签与实体资料页渲染

Codex039be3972574
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 537e7d329..3e10f863a 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -133,7 +133,7 @@ React 渲染的规格页、用户截图这类给不出可重抓字节的实测
## 运行与部署
-CloudDrive 配置与运维步骤见 `docs/OPERATIONS.md`。
+CloudDrive 配置与本地免登录测试步骤见 `docs/OPERATIONS.md`。
- 源码部署由项目 venv 持有服务,刷新入口为 `scripts/restart_windows_tray.py`。独立测试包自带运行环境,数据在用户目录;配置更改由托盘消费标记并重启子服务。
- 「同步开发进度」(GitHub)和「同步 Ledger」(SMB 共享)是两条独立通道,任一方不可达都不该拖住另一方;服务只观察角色不自动复制。
diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md
index 4e71e6885..6f40b0d24 100644
--- a/docs/OPERATIONS.md
+++ b/docs/OPERATIONS.md
@@ -6,6 +6,11 @@
## 首次运行与设置文件
+本地测试服务使用独立测试数据根,以 `peach serve --host 127.0.0.1 --port 18977 --no-mdns --no-auth`
+启动;浏览器打开 `http://127.0.0.1:18977`。`--no-auth` 只影响这次进程,不读取或改写口令文件;
+生产主机名仍指向托盘管理的认证服务。浏览器工具对私有地址的操作授权与 Peach 登录是两套机制,
+`--no-auth` 不控制工具授权。实测两次启动均可不带认证读取 `/app.js`,测试口令保持不变。
+
### CloudDrive 配置
1. 在 CloudDrive 中登录网盘并建立挂载点,打开「启动时自动挂载」。步骤见
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 229cd34e7..145e05610 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -133,6 +133,16 @@ class StylesheetPartitionTests(unittest.TestCase):
class WebUiSourceTests(unittest.TestCase):
+ def test_index_and_entity_visibility_targets_exist_in_the_page(self):
+ html = (Path(__file__).resolve().parents[1] / "web/index.html").read_text(encoding="utf-8")
+ for start, end in (("async function openIndex(", " const title="),
+ ("async function openEntity(", " /* 大位")):
+ body = self.app_js.split(start, 1)[1]
+ body = body.split(end, 1)[0]
+ for target in re.findall(r"\$\('#([^']+)'\)\.hidden\s*=", body):
+ with self.subTest(target=target):
+ self.assertIn(f'id="{target}"', html)
+
@classmethod
def setUpClass(cls):
# 页面拆成 index.html + web/css 下的样式分区 + app.js + web/js 下的 ES module。这些断言
diff --git a/web/app.js b/web/app.js
index 93be89ad1..73061039e 100644
--- a/web/app.js
+++ b/web/app.js
@@ -5458,7 +5458,7 @@ async function openIndex(kind,q,push=true,refine=false){
const d=await api(indexApi(0));
if(requestSeq!==indexRequestSeq||location.pathname!=='/'+kind)return;
$('#index').hidden=false;buildEdge(); $('#grid').innerHTML=''; $('#count').textContent='';
- $('#loadSentinel').hidden=true; $('#shortsSec').hidden=true;
+ $('#loadSentinel').hidden=true;
const title=INDEX_TITLES[kind]||'标签';
const tagItems=[...d.items];
const tagGroups=items=>{
@@ -6104,7 +6104,7 @@ async function openEntity(kind,name,push=true){
(state.jav==='1'||(items.items||[]).some(item=>item.is_jav));
document.body.classList.add('entity-open');
$('#index').hidden=false;$('#grid').innerHTML='';$('#count').textContent='';
- $('#loadSentinel').hidden=true;$('#shortsSec').hidden=true;
+ $('#loadSentinel').hidden=true;
/* 大位这条链每一环都先问过再出图:公司取自己的标识(厂牌是 `/logo`,事务所是官网
圆标),人是实体图→代表作头像,一环都取不到就一个 `<img>` 都不出,首字母垫底直接
露出来。四个标志(`has_logo`/`has_image`/`has_avatar`/`mark_link_id`)都由