Peach: Local-first video metadata scraper and media manager.
fix: 只读端能用「查找」,管理页按做事顺序重排并补上凭据配置说明
Peach local maintenanceed3e138d68f4
diff --git a/docs/STATUS.md b/docs/STATUS.mdindex e11567209..75d6f062a 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -58,6 +58,9 @@(链接在、目标不在),2026-08-26 之前这会让整次 `follow check` 连同已抓到的候选一起失败。现已降级:候选照常入库,证据标成「未取得」并把原因报到 CLI 与界面上。实测对着真实断链跑 rule34video,24 条候选全部入库。+- 追更的「查找」在只读端一度返回 409:`/api/follow/resolve` 只联网发现、不碰账本,+ 却因为是 POST 被写入端闸门一并拦掉。已按 `READ_ONLY_POST_ROUTES` 白名单放行;+ 真正会写的 `check`/`save`/`status`/`source` 仍受闸门管辖。- PID 只是观测值,不是配置;每次停止或重启前必须重新核对命令行、父子关系和端口归属。- macOS 独立运行环境:代码 `~/Desktop/lmd.gg/peach/peach-app`、数据 `~/Desktop/lmd.gg/peach/peach-data`、worktree `~/Desktop/lmd.gg/peach/peach-worktrees`。Python 3.14.7 + 独立 venv,FFmpeg 走 PATH。- Mac 的 `peach-data` 实际形状与文档的通用分层有出入,排查前先看清:真实目录名是diff --git a/src/peach/api.py b/src/peach/api.pyindex ccbc2dd23..137c1b8a6 100644--- a/src/peach/api.py+++ b/src/peach/api.py@@ -772,8 +772,11 @@ def create_app(body: dict[str, Any] = Body(default_factory=dict),_args: dict[str, str] = Depends(require_auth),):- if sync is not None and sync.read_only:+ route_path = f"/api/{route}"+ if (sync is not None and sync.read_only+ and route_path not in web_contract.READ_ONLY_POST_ROUTES):# 非写入端或冲突状态都只读;继续写只会产生无法自动合并的分叉。+ # 但只读的 POST 要放行:它们用 POST 只是因为要带请求体,并不碰账本。# `detail` 是诊断信息,`message` 是给用户的可读解释与恢复方式。return JSONResponse({@@ -784,7 +787,7 @@ def create_app(status_code=409,)try:- return web_contract.dispatch_api_post(contract, f"/api/{route}", body)+ return web_contract.dispatch_api_post(contract, route_path, body)except KeyError:return JSONResponse({"error": "not found"}, status_code=404)except (TypeError, ValueError) as exc:diff --git a/src/peach/web_contract.py b/src/peach/web_contract.pyindex 55cc3dcfe..ae6524b06 100644--- a/src/peach/web_contract.py+++ b/src/peach/web_contract.py@@ -2582,6 +2582,11 @@ POST_HANDLERS = {}+#: 这些 POST 不写 ledger,只是因为要带请求体才用 POST。写入端闸门不该拦它们——+#: 追更的「查找」在只读端被拦成 409 是实测踩到的:发现只联网、不碰账本。+READ_ONLY_POST_ROUTES = frozenset({"/api/follow/resolve"})++def dispatch_api_get(contract: WebContract, path, args):"""Dispatch the stable JSON read contract used by the current web client."""try:diff --git a/src/peach/web_follow.py b/src/peach/web_follow.pyindex ceb98a380..06ae6326f 100644--- a/src/peach/web_follow.py+++ b/src/peach/web_follow.py@@ -5,6 +5,7 @@"""from __future__ import annotations+import jsonfrom datetime import datetime, timezonefrom .follow import FollowSourceError@@ -305,8 +306,54 @@ def _existing_sources(contract):return _store(contract, connection).sources()+#: 每个来源要不要凭据、要哪些字段、去哪里拿。写在这里而不是模板里,因为知道+#: 「rule34.xxx 缺 key 就抓不到」的是连接器边界,不是界面。+CREDENTIAL_GUIDE: dict[str, dict] = {+ "kemono": {"requirement": "none"},+ "coomer": {"requirement": "none"},+ "pawchive": {"requirement": "none"},+ "rule34video": {"requirement": "none"},+ "rule34xxx": {+ "requirement": "required",+ "fields": ["user_id", "api_key"],+ "why": "网页版挂了 Cloudflare 验证码,Peach 不绕验证码,只能走官方 API。",+ "where": "https://rule34.xxx/index.php?page=account&s=options",+ "howto": "登录后在账号设置页生成 API key,把 user_id 和 api_key 写进凭据文件。",+ },+ "f95zone": {+ "requirement": "optional",+ "fields": ["cookie"],+ "why": "发现更新不需要登录;只有取附件和 masked 下载链接才需要会话。",+ "where": "https://f95zone.to/",+ "howto": "登录后从浏览器复制整条 Cookie 请求头,写进凭据文件的 cookie 字段。",+ },+ "simpcity": {+ "requirement": "blocked",+ "why": "站点由 DDoS-Guard 的浏览器质询保护,放行绑客户端 IP 且最短 20 分钟过期,"+ "撑不起定时追更。Peach 不绕机器人验证。",+ },+}++def q_follow_credentials(contract, _args) -> dict:- """只报告凭据是否存在与字段名,绝不返回凭据值。"""+ """报告凭据状态和怎么配。只给字段名与文件路径,绝不返回凭据值。"""store = CredentialStore(contract.follow_secrets_root)- return {"ok": True, "root": str(store.root),- "providers": [store.describe(provider) for provider in sorted(CONNECTORS)]}+ providers = []+ for provider in sorted(CONNECTORS):+ described = store.describe(provider)+ guide = CREDENTIAL_GUIDE.get(provider, {"requirement": "none"})+ fields = guide.get("fields", [])+ providers.append({+ **described,+ "provider_label": PROVIDER_LABELS.get(provider, provider),+ "requirement": guide["requirement"],+ "needs": fields,+ "missing": [name for name in fields if name not in described["fields"]],+ "why": guide.get("why", ""),+ "where": guide.get("where", ""),+ "howto": guide.get("howto", ""),+ "path": str(store.path_for(provider)),+ "example": (json.dumps({name: "…" for name in fields}, ensure_ascii=False)+ if fields else ""),+ })+ return {"ok": True, "root": str(store.root), "providers": providers}diff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex a217e2ae2..38fa8de61 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -193,6 +193,28 @@ class FollowContractTests(unittest.TestCase):self.assertEqual(self._get()["sources"][0]["last_status"], "error")self.assertIn("503", self._get()["sources"][0]["last_error"])+ def test_credentials_say_what_each_source_actually_needs(self):+ payload = self._get("/api/follow/credentials")+ by_provider = {row["provider"]: row for row in payload["providers"]}+ self.assertEqual(by_provider["kemono"]["requirement"], "none")+ self.assertEqual(by_provider["rule34xxx"]["requirement"], "required")+ self.assertEqual(by_provider["rule34xxx"]["needs"], ["user_id", "api_key"])+ self.assertEqual(by_provider["rule34xxx"]["missing"], ["user_id", "api_key"])+ self.assertEqual(by_provider["f95zone"]["requirement"], "optional")+ self.assertEqual(by_provider["simpcity"]["requirement"], "blocked")+ self.assertIn("DDoS-Guard", by_provider["simpcity"]["why"])+ self.assertTrue(by_provider["rule34xxx"]["path"].endswith("rule34xxx.json"))++ def test_a_configured_credential_reports_nothing_missing(self):+ secrets = self.root / "secrets" / "follow"+ secrets.mkdir(parents=True)+ (secrets / "rule34xxx.json").write_text(+ '{"user_id": "42", "api_key": "sekret"}', encoding="utf-8")+ row = next(r for r in self._get("/api/follow/credentials")["providers"]+ if r["provider"] == "rule34xxx")+ self.assertEqual(row["missing"], [])+ self.assertNotIn("sekret", json.dumps(row))+def test_credentials_endpoint_reports_fields_but_never_values(self):secrets = self.root / "secrets" / "follow"secrets.mkdir(parents=True)@@ -357,6 +379,31 @@ class FollowWebSourceTests(unittest.TestCase):def test_the_first_name_lookup_warns_about_the_index_download(self):self.assertPageContains("首次按名字查要下载创作者索引,可能几十秒")+ def test_the_paste_box_cannot_be_dragged_shut(self):+ self.assertPageContains(".faddform textarea{min-height:82px")++ def test_the_manage_page_is_ordered_by_what_you_do_first(self):+ # 只看管理页那一段:`<h3>内容` 在别的页面上也出现过,全页搜索会命中错的那个。+ page = self.page+ body = page[page.index("function renderFollowManage("):+ page.index("function wireFollowItems(")]+ order = [body.index(f'<h3>{heading}')+ for heading in ("添加来源", "来源 ", "内容", "凭据")]+ self.assertEqual(order, sorted(order), "管理页分区顺序应为 加来源 → 来源 → 内容 → 凭据")++ def test_credential_rows_say_whether_they_are_needed_at_all(self):+ # 「未配置」本身不是信息:要说清需不需要、需要什么、去哪儿拿。+ self.assertPageContains("required:['必须配置'")+ self.assertPageContains("none:['不需要凭据'")+ self.assertPageContains("blocked:['站点不可接入'")+ self.assertPageContains("row.path")+ self.assertPageContains("row.example")++ def test_only_a_missing_required_credential_demands_attention(self):+ # 可选的、不需要的、站点接不进来的都收起来;永远展开就是永久噪音。+ self.assertPageContains("row.requirement==='required'&&!configured")+ self.assertPageContains("${needsAttention?' open':''}")+def test_the_watch_page_does_not_carry_source_management(self):# 输入框、移除、凭据都只属于管理页;看的那页保持干净。page = self.pagediff --git a/tests/test_rm_web.py b/tests/test_rm_web.pyindex d41db865a..f49cceea5 100644--- a/tests/test_rm_web.py+++ b/tests/test_rm_web.py@@ -386,6 +386,11 @@ class WebDataTests(unittest.TestCase):with self.assertRaises(rm_web.ContractRouteNotFound):rm_web.dispatch_api_get(self.contract, "/api/typo", {})+ def test_read_only_post_routes_are_declared_and_all_exist(self):+ # 只读 POST 要绕开写入端闸门;名字写错就会静默失去豁免。+ self.assertTrue(rm_web.READ_ONLY_POST_ROUTES)+ self.assertTrue(rm_web.READ_ONLY_POST_ROUTES <= set(rm_web.POST_HANDLERS))+def test_write_transaction_rolls_back_and_closes_on_failure(self):opened = []real_connect = self.contract.database.connectdiff --git a/web/app.css b/web/app.cssindex 0879b6dc5..a2b0aa83c 100644--- a/web/app.css+++ b/web/app.css@@ -1147,36 +1147,107 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.follow .reviewtabs{flex-wrap:wrap;overflow-x:visible}.follow .reviewtabs .fcheck{margin-left:0;flex:1 1 100%;justify-content:center}}-/* ── 追更管理页 ── */-.fhead{display:flex;gap:18px;align-items:flex-start;flex-wrap:wrap;margin-bottom:16px}-.fhead h2{margin:0 0 4px;font-size:20px}-.fhead>div{flex:1 1 320px;min-width:0}-.fhead p{margin:0;color:var(--muted);font-size:12px;line-height:1.6;max-width:62ch}-.faddform{display:flex;gap:8px;flex-wrap:wrap;align-items:center;flex:1 1 340px}-.faddform input{flex:1 1 260px;min-width:0;border:1px solid var(--border-15);border-radius:9px;background:var(--overlay-5);color:var(--ink);padding:9px 12px;font-size:13px}-.faddform input:focus-visible{outline:2px solid var(--tungsten);outline-offset:1px;border-color:var(--tungsten)}-.faddform button{border:1px solid var(--tungsten);border-radius:9px;background:var(--tungsten);color:#fff;font-weight:600;padding:9px 18px;font-size:13px;cursor:pointer;white-space:nowrap}-.faddform button:disabled{opacity:.6;cursor:default}-.faddform [data-follow-add-state]{flex:1 1 100%;font-size:11.5px;color:var(--drop);min-height:1em}-.fsource .fremove{color:var(--drop)}+/* ── 追更管理页 ──+ 卡片式分区,顺序按「做事的先后」:加来源 → 看来源 → 处理内容 → 凭据。+ 圆角同心:卡片 14px / 内部控件 9px(padding 5px 时 9+5=14)。 */+.followmanage{padding:4px 0 44px;display:grid;gap:14px;max-width:1080px}+.fcard{border-radius:14px;background:var(--surface);padding:5px;+ box-shadow:0 0 0 1px var(--border-10),0 1px 2px rgba(0,0,0,.04),0 4px 12px rgba(0,0,0,.04)}+.fcard>*{margin-left:11px;margin-right:11px}+.fcardhead{display:flex;align-items:center;gap:12px;flex-wrap:wrap;+ padding:9px 0 10px;margin-bottom:0}+.fcardhead h3{margin:0;font-size:14px;font-weight:600;flex:1 1 auto}+.fcardhead .n{color:var(--muted);font-size:11.5px;font-weight:400;margin-left:4px}+.fcardhead .fcredroot{font-size:11px;color:var(--muted);overflow-wrap:anywhere}+.fhint{margin:9px 0 11px;font-size:11.5px;line-height:1.65;color:var(--muted);max-width:64ch}+.fprimary,.fghost{display:inline-flex;align-items:center;gap:6px;border-radius:9px;+ padding:6px 13px;font-size:12.5px;cursor:pointer;white-space:nowrap;+ transition:background-color .12s ease,border-color .12s ease,color .12s ease,scale .1s ease}+.fprimary{background:var(--tungsten);border:1px solid var(--tungsten);color:#fff;font-weight:600}+.fprimary:hover:not(:disabled){background:color-mix(in srgb,var(--tungsten) 86%,#000)}+.fghost{background:transparent;border:1px solid var(--border-15);color:var(--ink-2)}+.fghost:hover:not(:disabled){border-color:var(--tungsten);color:var(--ink)}+.fprimary:active:not(:disabled),.fghost:active:not(:disabled){scale:.96}+.fprimary svg,.fghost svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2}+.fprimary:disabled,.fghost:disabled{opacity:.55;cursor:default}++/* 输入区:左侧输入,右侧动作。textarea 有下限高度,拉不成一条缝。 */+.faddform{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px;align-items:start}+.faddform textarea{min-height:82px;max-height:340px;border:1px solid var(--border-15);+ border-radius:9px;background:var(--overlay-5);color:var(--ink);padding:9px 12px;+ font-size:13px;font-family:inherit;line-height:1.6;resize:vertical;+ transition:border-color .12s ease}+.faddform textarea::placeholder{color:var(--muted)}+.faddform textarea:focus-visible{outline:2px solid var(--tungsten);outline-offset:1px;+ border-color:var(--tungsten)}+.faddside{display:grid;gap:6px;justify-items:stretch;min-width:104px}+.faddside button{border-radius:9px;border:1px solid var(--tungsten);background:var(--tungsten);+ color:#fff;font-weight:600;padding:9px 18px;font-size:13px;cursor:pointer;+ transition:background-color .12s ease,scale .1s ease}+.faddside button:hover:not(:disabled){background:color-mix(in srgb,var(--tungsten) 86%,#000)}+.faddside button:active:not(:disabled){scale:.96}+.faddside button:disabled{opacity:.6;cursor:default}+.faddside [data-follow-add-state]{font-size:11px;line-height:1.5;color:var(--muted)}++/* 来源行 */+.fsources{list-style:none;margin:0 0 11px;padding:0;display:grid;gap:5px}+.fsource{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;gap:10px;+ align-items:center;padding:8px 11px;border-radius:9px;background:var(--overlay-5);+ font-size:12.5px}+.fsource b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}+.fsource .mono{color:var(--muted);font-size:11px;white-space:nowrap}+.fsource .fstatus{font-size:11px;color:var(--muted);min-width:62px;text-align:right}+.fsource.bad{background:color-mix(in srgb,var(--drop) 8%,transparent);+ box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--drop) 30%,transparent)}+.fsource.bad .fstatus{color:var(--drop)}+.fsource i{grid-column:1/-1;font-style:normal;color:var(--drop);font-size:11px;line-height:1.55}+.fsource button{border:1px solid var(--border-15);border-radius:7px;background:transparent;+ color:var(--ink-2);padding:4px 11px;font-size:11.5px;cursor:pointer;white-space:nowrap;+ transition:border-color .12s ease,color .12s ease,scale .1s ease}+.fsource button:hover{border-color:var(--tungsten);color:var(--ink)}+.fsource button:active{scale:.96}.fsource .fremove:hover{border-color:var(--drop);color:var(--drop)}-.fwarn{margin:0 0 12px;padding:9px 12px;border:1px solid var(--drop);border-radius:9px;color:var(--drop);font-size:12px}-.flink{border:0;background:none;padding:0;color:var(--tungsten);font:inherit;cursor:pointer;text-decoration:underline}-.fcontent,.fcreds{margin-top:22px}-.fcontent h3,.fcreds h3{margin:0 0 8px;font-size:15px}-.fcontent>p.mono{margin:0 0 10px;color:var(--muted);font-size:12px}-.fbulk{display:flex;gap:8px;flex-wrap:wrap}-.fbulk button{border:1px solid var(--border-15);border-radius:8px;background:transparent;color:var(--ink-2);padding:6px 13px;font-size:12px;cursor:pointer}+.fwarn{margin:0 0 9px;font-size:11.5px;color:var(--drop)}+.flink{border:0;background:none;padding:0;color:var(--tungsten);font:inherit;cursor:pointer;+ text-decoration:underline}++/* 内容计数 */+.fcounts{display:flex;gap:20px;flex-wrap:wrap;margin:0 0 11px;font-size:12px;color:var(--muted)}+.fcounts b{display:block;font-size:19px;color:var(--ink);font-weight:600;+ font-variant-numeric:tabular-nums;line-height:1.25}+.fbulk{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:11px}+.fbulk button{border:1px solid var(--border-15);border-radius:9px;background:transparent;+ color:var(--ink-2);padding:6px 13px;font-size:12px;cursor:pointer;+ transition:border-color .12s ease,color .12s ease,scale .1s ease}.fbulk button:hover:not(:disabled){border-color:var(--tungsten);color:var(--ink)}-.fcreds ul{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:5px}-.fcred{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:6px 12px;border:1px solid var(--line-soft);border-radius:9px;font-size:12px}-.fcred b{min-width:100px}-.fcred .mono{color:var(--muted);font-size:11.5px}-.fcred.bad{border-color:var(--drop)}-.fcred i{font-style:normal;color:var(--drop);font-size:11.5px}-.fcreds p{margin:4px 0 0;color:var(--muted);font-size:11.5px}-@media (max-width:640px){.faddform{flex:1 1 100%}.faddform input{flex:1 1 100%}- .faddform button{flex:1 1 100%}}+.fbulk button:active:not(:disabled){scale:.96}+.fbulk button:disabled{opacity:.45;cursor:default}++/* 凭据:不需要的收起来只占一行,需要的才展开给路径和格式 */+.fcreds{display:grid;gap:5px;margin-bottom:11px}+.fcred{border-radius:9px;background:var(--overlay-5);padding:0 11px}+.fcred summary{display:flex;align-items:center;gap:10px;padding:8px 0;cursor:pointer;+ font-size:12.5px;list-style:none}+.fcred summary::-webkit-details-marker{display:none}+.fcred summary b{flex:1 1 auto;min-width:0}+.fcredstate{font-size:11px;color:var(--muted)}+.fcred.req .fcredstate{color:var(--drop)}+.fcred.opt .fcredstate{color:var(--meter)}+.fcred.ok .fcredstate{color:var(--keep)}+.fcredmissing{font-size:11px;color:var(--drop)}+.fcred p{margin:0 0 6px;font-size:11.5px;line-height:1.65;color:var(--muted)}+.fcred a{color:var(--tungsten);overflow-wrap:anywhere}+.fcredpath{overflow-wrap:anywhere;color:var(--ink-2)!important}+.fcredsample{margin:0 0 9px;padding:7px 10px;border-radius:7px;background:var(--overlay-5);+ font-size:11.5px;color:var(--ink-2);overflow-x:auto}+.fcredwarn{color:var(--drop)!important}++@media (max-width:720px){+ .faddform{grid-template-columns:minmax(0,1fr)}+ .faddside{min-width:0}+ .fsource{grid-template-columns:minmax(0,1fr) auto}+ .fsource .mono:nth-of-type(2){display:none}+}/* ── 查找结果的勾选清单 ── */.faddform textarea{flex:1 1 300px;min-width:0;border:1px solid var(--border-15);border-radius:9px;background:var(--overlay-5);color:var(--ink);padding:9px 12px;font-size:13px;font-family:inherit;line-height:1.55;resize:vertical}diff --git a/web/app.js b/web/app.jsindex 0d51c4c88..3e1c03611 100644--- a/web/app.js+++ b/web/app.js@@ -1316,46 +1316,78 @@ function followSourceRow(source){${source.last_error?`<i>${esc(source.last_error)}</i>`:''}</li>`;}+const CRED_STATE={required:['必须配置','req'],optional:['可选','opt'],+ none:['不需要凭据','none'],blocked:['站点不可接入','blocked']};+function followCredentialRow(row){- const state=row.present?'已配置':'未配置';- return `<li class="fcred${row.world_readable?' bad':''}"><b>${esc(row.provider)}</b>- <span>${state}</span><span class="mono">${esc((row.fields||[]).join(', ')||'—')}</span>- ${row.world_readable?'<i>文件权限过宽</i>':''}</li>`;+ const [label,kind]=CRED_STATE[row.requirement]||CRED_STATE.none;+ /* 「未配置」本身不是信息——要说清楚这个来源到底需不需要、需要什么、去哪儿拿。+ 不需要凭据的来源只占一行,不展开;需要的才给出文件路径和格式。 */+ /* 只有「必须配置而且没配」才自动展开——那是唯一需要你现在动手的情况。+ 可选的、不需要的、站点根本接不进来的,都收起来,点开才看细节。 */+ const configured=row.present&&!row.missing.length;+ const needsAttention=row.requirement==='required'&&!configured;+ const detail=row.requirement==='none'||row.requirement==='blocked'+ ? (row.why?`<p>${esc(row.why)}</p>`:'')+ : `<p>${esc(row.why)}</p><p>${esc(row.howto)}</p>+ ${row.where?`<p><a href="${esc(row.where)}" target="_blank" rel="noreferrer noopener">${esc(row.where)}</a></p>`:''}+ <p class="mono fcredpath">${esc(row.path)}</p>+ <pre class="fcredsample">${esc(row.example)}</pre>+ ${row.world_readable?'<p class="fcredwarn">文件权限过宽,建议 chmod 600</p>':''}`;+ return `<details class="fcred ${esc(kind)}${configured?' ok':''}"${needsAttention?' open':''}>+ <summary><b>${esc(row.provider_label)}</b>+ <span class="fcredstate">${esc(configured&&row.requirement!=='none'?'已配置':label)}</span>+ ${row.missing.length?`<span class="fcredmissing">缺 ${esc(row.missing.join('、'))}</span>`:''}+ </summary>${detail}</details>`;}function renderFollowManage(credentials){const sources=followData.sources||[],counts=followData.counts||{};+ const broken=sources.filter(s=>s.last_status==='error'||s.last_status==='unauthorized');+ /* 顺序按「做事的先后」排:先加来源,再看这些来源怎么样,再处理它们抓回来的内容,+ 凭据放最后——它是出问题时才需要翻的东西,不是每次都要看的。 */$('#stats').innerHTML=`<div class="follow followmanage">- <header class="fhead"><div>- <p>每行粘一条。链接直接认得;只给名字或 id 也行——会去 kemono.cr、coomer.st、- pawchive.pw、rule34video.com、rule34.xxx 和 f95zone.to 各查一遍,查到什么摆出来由你勾选。- <b>第一次按名字查要下载创作者索引,可能要几十秒</b>;之后一天内都直接用缓存。</p></div>+ <section class="fcard">+ <div class="fcardhead"><h3>添加来源</h3>+ <button class="fghost" data-follow-view>${icon('globe')}去看更新</button></div><form class="faddform" id="followAdd">- <textarea name="lines" rows="3" required spellcheck="false" aria-label="来源链接或名字"- placeholder="每行一条。链接直接认,名字或 id 会去各来源查一遍: https://kemono.cr/fanbox/user/30917150 LazyProcrastinator 50685"></textarea>- <button type="submit">查找</button>- <span data-follow-add-state aria-live="polite"></span>- </form></header>+ <textarea name="lines" rows="3" required spellcheck="false"+ aria-label="来源链接、名字或 id"+ placeholder="每行一条,链接和名字可以混着粘"></textarea>+ <div class="faddside">+ <button type="submit">查找</button>+ <span data-follow-add-state aria-live="polite"></span>+ </div>+ </form>+ <p class="fhint">链接直接认得;只给名字或 id 会去六个来源各查一遍,查到什么由你勾选。+ 首次按名字查要下载创作者索引,可能几十秒。</p>+ </section><div id="followPicks"></div>- <ul class="fsources">${sources.map(followSourceRow).join('')||- '<li class="empty">还没有登记追更来源。把链接粘进上面的输入框。</li>'}</ul>- <div class="reviewtabs">- <button class="fcheck" data-follow-check="">${icon('refresh-cw')}检查全部更新</button>- <button data-follow-view>${icon('globe')}去看更新</button></div>- <section class="fcontent"><h3>内容</h3>- <p class="mono">未看 ${counts.new||0} · 已看 ${counts.seen||0} ·- 已保存 ${counts.saved||0} · 已忽略 ${counts.ignored||0}</p>+ <section class="fcard">+ <div class="fcardhead"><h3>来源 <span class="n mono">${sources.length}</span></h3>+ <button class="fprimary" data-follow-check="">${icon('refresh-cw')}检查全部更新</button></div>+ ${broken.length?`<p class="fwarn">${broken.length} 个来源上次检查失败,原因见下方那一行。</p>`:''}+ <ul class="fsources">${sources.map(followSourceRow).join('')||+ '<li class="empty">还没有来源。把链接或名字粘进上面的输入框。</li>'}</ul>+ </section>+ <section class="fcard">+ <div class="fcardhead"><h3>内容</h3></div>+ <p class="fcounts"><span><b>${counts.new||0}</b> 未看</span><span><b>${counts.seen||0}</b> 已看</span>+ <span><b>${counts.saved||0}</b> 已保存</span><span><b>${counts.ignored||0}</b> 已忽略</span></p><div class="fbulk">- <button data-follow-bulk="seen">把「未看」全部标记为已看</button>- <button data-follow-bulk="ignored">把「未看」全部忽略</button></div></section>- <section class="fcreds"><h3>凭据</h3>- <ul>${(credentials.providers||[]).map(followCredentialRow).join('')}</ul>- <p class="mono">目录:${esc(credentials.root||'')}</p>- <p>凭据只留在本机,不进 Git、URL、日志或 ledger。这里只显示字段名,不显示值。</p>+ <button data-follow-bulk="seen"${counts.new?'':' disabled'}>把「未看」全部标记为已看</button>+ <button data-follow-bulk="ignored"${counts.new?'':' disabled'}>把「未看」全部忽略</button></div>+ </section>+ <section class="fcard">+ <div class="fcardhead"><h3>凭据</h3>+ <span class="mono fcredroot">${esc(credentials.root||'')}</span></div>+ <div class="fcreds">${(credentials.providers||[]).map(followCredentialRow).join('')}</div>+ <p class="fhint">凭据只留在本机,不进 Git、URL、日志或 ledger。这里只显示字段名,不显示值。</p></section></div>`;wireFollowManage();}+async function openFollowManage(push=true){releaseHoverPreviews();disposeStage(false);document.body.classList.remove('entity-open','index-open');