Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 来源筛选常驻添加关注,collapse 回退,面板细节批修

longmeidao719a106096f4
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 5d0f71f5a..ee0c60f65 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -36,6 +36,7 @@
## 本批修正与验证
+- 2026-08-30 按用户回执修一批关注管理细节:来源筛选改为常驻「添加关注」面板(此前埋在查找结果里等于没有)——Geist Combobox 弹层列出全部 8 个来源、默认全选、取消的来源其结果行隐藏且不进「添加选中」,开合状态跨搜索保留;Geist Collapse 动画实测把 details 内容吞掉(点开「作者别名」无内容出现),整体回退原生开合并在 STATUS 记录原因;fsechead 上的按钮(检查全部/去看更新)与页脚按钮一样加深到 --surface;页脚改为计数居左、批量按钮靠右;status dots 只留圆点(ok/error 字样收进 title);来源行 checkbox 顶到卡边(去掉 37px 缩进);凭据 Description 换成样式化 tooltip(ⓘ 图标 + hover 弹出白底浮层,对齐 Geist Description 观感);复核作者名去掉按钮框(旧 `.reviewentity>div button` 规则误伤新名字链接,用 :not 排除),分隔线左右顶满(按卡内边距 15/18 负边距)。回收站补 empty state:空时隐藏「清空回收站」按钮并显示空态卡。follow 444 项、catalog 427 项通过;浏览器实测筛选挂载与开合、checkbox 顶左、dots 无字、tooltip、折叠展开恢复。纯前端实时生效。
- 2026-08-30 按用户回执完成一批 Geist 对齐(引用其 description/collapse/entity/combobox/loading-dots/skeleton/command-menu 规格页,取证要点补进语义快照):关注管理页脚条背景顶满(fnote 外距改由条内边距承担,负边距塌陷不再露底);凭据「存放位置与权限」改 Geist Description——常驻术语与值、全文收进 hover 提示;来源行 ok/error 改 status dots(6px 语义色圆点 + 灰字);details 折叠加 Geist Collapse 高度过渡(interpolate-size,Chrome 131+)且分隔线顶格;「查找」按钮加 busy 自转;查找结果头部去异色条并新增来源筛选(Geist Combobox 模式:触发钮 + 勾选弹层,默认全选,取消的来源其行隐藏且不进「添加选中」);添加关注输入栏与按钮同高升至 38px;结果行 checkbox 垂直居中、行 hover 底(Geist entity 模式);重复文件空态不显示操作按钮,有内容时操作以「操作」标题进异色条(与关注列表同版式);设置面板打开加 command-menu 式入场动画(淡入 + 轻缩放 + 下移);复核页作者块 entity 化——头像 76→44px、名字即链接(去掉「打开创作者」按钮)、块下下划线区隔;FC2 对比卡改上下布局(封面在上、名字与按钮在下横排);复核卡动作区加顶部下划线。follow 444 项、catalog 427 项通过;浏览器实测页脚顶满、status dots、Description、重复文件空态无按钮。纯前端实时生效。
- 2026-08-30 按用户回执修两处:高清版卡片的长文件名标题两行截断(line-clamp 2),卡片高度不再随标题行数溢出(实测同排两卡同为 135px);关注管理面板做上中下异色——头部条(微亮面 + 底发丝线)与页脚条(hover 底 + 顶发丝线,承载计数与批量操作)经负边距通到卡边、随断点适配,头部/主体/页脚三种面色。follow 444 项通过;浏览器实测标题截断、两卡等高、头部/页脚条异色顶格。纯前端实时生效。
- 2026-08-29 修设置面板组卡的对称与圆角(用户回执):负边距贴滚动条的方案带来左 21px / 右 0px 的不对称和右侧直角,废弃。改为 `scrollbar-gutter:stable both-edges` 两侧对称保留滚动条槽位,组卡恢复对称内缩 + 全 12px 圆角——实测左右间距各 31px 逐像素相等;浏览器不支持 both-edges 时回退单侧槽位,不阻塞。catalog 427 项通过。纯前端实时生效。
diff --git a/tests/test_follow_web.py b/tests/test_follow_web.py
index 2f2895a74..f6a9cb4f7 100644
--- a/tests/test_follow_web.py
+++ b/tests/test_follow_web.py
@@ -1613,7 +1613,7 @@ class FollowWebSourceTests(unittest.TestCase):
self.assertPageContains('<button class="fbtn" data-follow-bulk="ignored">全部忽略</button>')
self.assertPageLacks('class="flink" data-follow-bulk')
# 不另起一行:按钮内联在计数行里(用户回执)。
- self.assertPageContains('.fbulk{display:inline-flex;gap:8px;margin-left:10px;vertical-align:middle}')
+ self.assertPageContains('.fbulk{display:inline-flex;gap:8px;margin-left:auto}')
def test_sources_by_the_same_author_are_one_block(self):
"""同一个作者在几个站上是几条来源、一个人。
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 39b8ea609..1594fd405 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -1318,7 +1318,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("background:color-mix(in srgb,var(--drop) 7%,transparent);\n border:1px solid color-mix(in srgb,var(--drop) 30%,transparent);")
self.assertPageLacks("border-left:2px solid var(--drop)")
# 来源行状态徽章(ok 绿 tint / 失败红 tint / 未检查灰)。
- self.assertPageContains('<span class="sbadge ${badge}"><i aria-hidden="true"></i>${esc(state)}</span>')
+ self.assertPageContains('<span class="sbadge ${badge}" title="${esc(state)}"><i aria-hidden="true"></i></span>')
self.assertPageContains(".sbadge i{width:6px;height:6px;border-radius:50%;background:var(--muted);flex:none}")
self.assertPageContains(".sbadge.ok i{background:var(--success)}")
self.assertPageContains(".sbadge.error i{background:var(--drop)}")
diff --git a/web/app.css b/web/app.css
index 4ce7b354e..f9bbb2242 100644
--- a/web/app.css
+++ b/web/app.css
@@ -47,10 +47,6 @@
--overlay-5:rgba(245,250,255,.05);--border-10:rgba(245,250,255,.10);--border-15:rgba(245,250,255,.15);
--loupe:#6FD0C8; --keep:#5FB95F; --meter:#E0912F; --drop:#FF5252; --success:#5FB95F; --ambient-opacity:1;}
-/* Geist Collapse:details 展开收起有高度过渡(Chrome 131+,不支持则无动画直接开合)。 */
-:root{interpolate-size:allow-keywords}
-details::details-content{block-size:0;overflow:hidden;transition:block-size .25s ease,
- content-visibility .25s ease allow-discrete;content-visibility:hidden}
*,*::before,*::after{box-sizing:border-box}
html{color-scheme:light;scroll-padding-top:calc(var(--topH) + 8px)}
@media (prefers-color-scheme:dark){html:not([data-theme="light"]){color-scheme:dark}}
@@ -561,7 +557,7 @@ button.serieslink.entitylink:hover{color:var(--tungsten);text-decoration:none}
只是把 16:10 的封面换成圆形头像——两种卡片并排时不该看着像两套设计。 */
/* 不给底色也不居中:卡片里只有这一个主体,衬底和留白只会把它推离左边缘,
和下面的样本网格、证据文字对不齐。 */
-.reviewentity{padding-bottom:10px;border-bottom:1px solid var(--border-10);display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:center;
+.reviewentity{margin:0 -15px 12px -18px;padding:0 15px 12px 18px;border-bottom:1px solid var(--border-10);display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:center;
margin:0 0 12px;padding:0;justify-content:start}
.reviewentityface{position:relative;width:44px;height:44px;justify-self:start;border:0;padding:0;
border-radius:50%;overflow:hidden;background:var(--sunk);color:var(--muted);cursor:pointer;
@@ -572,7 +568,7 @@ button.serieslink.entitylink:hover{color:var(--tungsten);text-decoration:none}
.reviewentityname{border:0;background:none;padding:0;color:var(--ink);font:inherit;cursor:pointer;text-align:left}
.reviewentityname:hover{color:var(--tungsten);text-decoration:underline}
.reviewentity b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:8px}
-.reviewentity>div button{display:inline-flex;align-items:center;gap:6px;border:0;border-radius:7px;
+.reviewentity>div button:not(.reviewentityname){display:inline-flex;align-items:center;gap:6px;border:0;border-radius:7px;
background:var(--hover);padding:6px 9px;color:var(--ink-2);cursor:pointer}
.reviewentity>div button:hover{color:var(--tungsten)}
.reviewentity>div button svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}
@@ -1541,7 +1537,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.fsecfoot{margin:14px -16px -16px;padding:12px 16px;background:var(--hover);
border-top:1px solid var(--border-10);border-radius:0 0 7px 7px}
.fsecfoot .fnote{margin:0}
-.fsecfoot .fbtn{background:var(--surface)}
+.fsecfoot .fbtn,.fsechead .fbtn{background:var(--surface)}
/* 重复页的「操作」条独立于 .fsec 容器:自带卡面与边框,不用负边距。 */
.dupactions.fsechead{margin:0 0 14px;padding:10px 14px;background:var(--surface);
border:1px solid var(--border-10);border-radius:8px}
@@ -1553,9 +1549,17 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.fmeta{font-size:var(--fs-xs);color:var(--muted)}
.fmeta b{color:var(--ink);font-variant-numeric:tabular-nums}
.fmeta.warn{color:var(--drop)}
-.fdesc{display:grid;gap:3px;margin:12px 0 0;font-size:var(--fs-xs);cursor:help}
-.fdesc b{color:var(--ink-2)}
-.fdesc span{color:var(--muted);line-height:1.5}
+.fdesc{position:relative;display:grid;gap:3px;margin:12px 0 0;font-size:var(--fs-xs)}
+.fdesc b{color:var(--ink-2);display:inline-flex;align-items:center;gap:6px}
+.fdesc>span:first-of-type{color:var(--muted);line-height:1.5}
+.fdescinfo{display:inline-grid;place-items:center;width:14px;height:14px;color:var(--muted)}
+.fdescinfo svg{width:13px;height:13px;stroke:currentColor;fill:none;
+ stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
+.fdescpop{display:none;position:absolute;left:0;bottom:calc(100% + 8px);z-index:60;width:max-content;
+ max-width:340px;padding:10px 12px;border-radius:10px;background:#fff;color:#111;
+ font-size:var(--fs-xs);line-height:1.6;box-shadow:0 12px 40px #0007;text-align:left}
+.fdescpop code{font-family:"Cascadia Mono",Consolas,ui-monospace,"Microsoft YaHei UI","PingFang SC",monospace}
+.fdesc:hover .fdescpop,.fdesc:focus-within .fdescpop{display:block}
.fnote{margin:12px 0 0;font-size:var(--fs-sm);line-height:1.7;color:var(--muted)}
.fnote:empty{display:none}
.fnote.warn{color:var(--drop)}
@@ -1593,7 +1597,8 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.fwarn .wclose svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round}
/* 批量动作是 2292 条级别的操作,不是行内文字链接:按钮的边界让「这会改状态」
在点击前就看得见,也和本页其他 .fbtn(检查全部/去看更新)同一套语言。 */
-.fbulk{display:inline-flex;gap:8px;margin-left:10px;vertical-align:middle}
+.fbulk{display:inline-flex;gap:8px;margin-left:auto}
+.fnote.fbulkrow{display:flex;align-items:center;flex-wrap:wrap;gap:4px 10px}
/* 状态标签:四种状态四种颜色,待办和完成一眼分得开。 */
/* 凭据状态。类名不能叫 `.fstate`——观看页的卡片错误行已经占了那个名字
@@ -1662,7 +1667,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
text-overflow:ellipsis;white-space:nowrap}
.fauthorhead .fmeta{margin-left:auto;flex:none}
.fauthorhead .fmeta.warn{margin-left:0}
-.fauthor .fsource.frow{padding-left:37px;display:grid;
+.fauthor .fsource.frow{padding-left:0px;display:grid;
grid-template-columns:22px minmax(0,1fr) auto auto auto auto;gap:10px;flex-wrap:nowrap}
.fauthor .fsource.frow>b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fsource.disabled{opacity:.62}
diff --git a/web/app.js b/web/app.js
index 2b15a2af5..a314afdc0 100644
--- a/web/app.js
+++ b/web/app.js
@@ -938,7 +938,7 @@ function renderCount(){
`<span class="mono">${total.toLocaleString()} 个符合 · 显示 ${n}</span>`
+(state.state==='trash'
// 回收站是待清理队列,不是浏览列表:换一批和九种排序在这里没有意义。
- ? `<span class="sorts"><button class="batchaction danger" id="emptyTrash" title="永久删除回收站内容">清空回收站</button></span>`
+ ? (total?`<span class="sorts"><button class="batchaction danger" id="emptyTrash" title="永久删除回收站内容">清空回收站</button></span>`:'')
: `<span class="sorts">`
// 顶栏已有「换一批推荐」(#refresh),排序行不再放同一个动作;
// 版式按钮跟排序连成一条。
@@ -2277,7 +2277,7 @@ function followSourceRow(source){
rel="noreferrer noopener" title="打开原来源">${esc(source.label)}</a></b>
<span class="fmeta fprovider">${sourceIcon(source.provider)}${esc(source.provider_label)}</span>
<span class="fmeta fchecked">${esc(source.last_checked_at?localTime(source.last_checked_at):'未检查')}</span>
- <span class="sbadge ${badge}"><i aria-hidden="true"></i>${esc(state)}</span>
+ <span class="sbadge ${badge}" title="${esc(state)}"><i aria-hidden="true"></i></span>
<span class="fsourceactions">
<button class="frowicon" data-follow-check="${source.id}" title="检查更新"
${source.enabled?'':'disabled'}
@@ -2379,6 +2379,7 @@ function renderFollowManage(credentials){
<div class="fmain">
<section class="fsec">
<div class="fsechead"><h3>添加关注</h3></div>
+ <div class="fsrcfilter" id="followSrcFilter"></div>
<form class="faddform" id="followAdd">
<textarea name="lines" rows="1" required spellcheck="false"
aria-label="来源链接、名字或 id"></textarea>
@@ -2402,8 +2403,8 @@ function renderFollowManage(credentials){
${broken.length?`<p class="fnote warn">${broken.length} 个来源上次检查失败,原因见对应那一行。</p>`:''}
${sources.length?`<div class="frows fsources">${
followAuthorGroups(sources).map(followAuthorBlock).join('')}</div>
- ${counts.new?`<div class="fsecfoot"><p class="fnote fbulkrow">未看 ${counts.new} · 已看 ${counts.seen||0}
- · 已保存 ${counts.saved||0} · 已忽略 ${counts.ignored||0}
+ ${counts.new?`<div class="fsecfoot"><p class="fnote fbulkrow"><span class="fbulkcounts">未看 ${counts.new} · 已看 ${counts.seen||0}
+ · 已保存 ${counts.saved||0} · 已忽略 ${counts.ignored||0}</span>
<span class="fbulk"><button class="fbtn" data-follow-bulk="seen">全部标记已看</button>
<button class="fbtn" data-follow-bulk="ignored">全部忽略</button></span></p></div>`:''}`
:'<p class="fnote">还没有关注任何来源。</p>'}
@@ -2414,8 +2415,10 @@ function renderFollowManage(credentials){
<div class="fsechead"><h3>凭据</h3>
${needCred.length?`<span class="fmeta warn">${needCred.length} 个待配置</span>`:''}</div>
<div class="frows">${creds.map(followCredentialRow).join('')}</div>
- <p class="fdesc" title="存在运行 Peach 的那台机器上,不是浏览器所在机器;不进 Git、URL、日志或 ledger。NTFS 的访问控制走 ACL,chmod 在那里没有效果;POSIX 上建成 0600。">
- <b>存放位置与权限</b><span>Windows 上不收紧文件权限</span></p>
+ <p class="fdesc"><b>存放位置与权限
+ <i class="fdescinfo" aria-hidden="true">${icon('info')}</i></b>
+ <span>Windows 上不收紧文件权限</span>
+ <span class="fdescpop" role="tooltip">存在<b>运行 Peach 的那台机器</b>上,不是浏览器所在机器;不进 Git、URL、日志或 ledger。NTFS 的访问控制走 ACL,<code>chmod</code> 在那里没有效果;POSIX 上建成 0600。</span></p>
</section>
</aside></div>`;
wireFollowManage();
@@ -2477,6 +2480,7 @@ function wireFollowItems(){
function wireFollowManage(){
const root=$('#stats'),form=root.querySelector('#followAdd');
+ renderFollowSrcFilter(root.querySelector('#followSrcFilter'));
const box=form&&form.querySelector('textarea');
/* 常见情况是粘一条,多行是例外——所以静止时就一行高,和按钮齐平;
真粘了多行才往下长。原来固定三行,按钮只有它 1/3 高,看着就是没对齐。 */
@@ -2636,6 +2640,38 @@ function wireFollowManage(){
/* 查找结果先摆出来由人勾选,不自动登记:发现要联网,结果也可能不止一个,
替用户决定「就是这个」是错的。已经关注的项灰掉但仍显示,免得人以为没查到。 */
+/* 来源筛选的常驻控件:挂在「添加关注」面板里,列出全部已关注来源,
+ 默认全选;取消勾选的来源,其查找结果行隐藏、也不进「添加选中」。 */
+let fsrcMenuOpen=false;
+function renderFollowSrcFilter(mount){
+ if(!mount)return;
+ const providers=[...new Set((followData?.sources||[])
+ .map(source=>source.provider_label).filter(Boolean))];
+ providers.forEach(provider=>{if(!fsrcProviders.has(provider))fsrcProviders.add(provider)});
+ if(!providers.length){mount.innerHTML='';return}
+ const label=()=>{const n=providers.filter(p=>!fsrcUnchecked.has(p)).length;
+ return n===providers.length?'来源:全部':`来源:${n}/${providers.length}`};
+ mount.innerHTML=`<button type="button" class="fbtn" data-srcfilter-toggle aria-expanded="${fsrcMenuOpen}">
+ ${icon('list-filter')}<span data-srcfilter-label>${esc(label())}</span>${icon('chevron-down')}</button>
+ <div class="fsrcmenu" data-srcfilter-menu${fsrcMenuOpen?'':' hidden'}>${providers.map(provider=>
+ `<label><input type="checkbox" data-srcfilter="${esc(provider)}"${fsrcUnchecked.has(provider)?'':' checked'}>
+ <span>${esc(provider)}</span></label>`).join('')}</div>`;
+ const toggle=mount.querySelector('[data-srcfilter-toggle]');
+ const menu=mount.querySelector('[data-srcfilter-menu]');
+ toggle.onclick=e=>{e.stopPropagation();
+ fsrcMenuOpen=menu.hidden;menu.hidden=!fsrcMenuOpen;
+ toggle.setAttribute('aria-expanded',String(fsrcMenuOpen))};
+ menu.querySelectorAll('[data-srcfilter]').forEach(input=>input.onchange=()=>{
+ input.checked?fsrcUnchecked.delete(input.dataset.srcfilter)
+ :fsrcUnchecked.add(input.dataset.srcfilter);
+ mount.querySelector('[data-srcfilter-label]').textContent=label();
+ document.querySelectorAll('.fpickitem').forEach(item=>{
+ item.hidden=fsrcUnchecked.has(item.dataset.provider||'')})});
+ document.onclick=event=>{
+ if(!fsrcMenuOpen)return;
+ if(mount.contains(event.target))return;
+ fsrcMenuOpen=false;menu.hidden=true;toggle.setAttribute('aria-expanded','false')};
+}
function renderFollowPicks(results){
const box=$('#followPicks');
if(!box)return;
@@ -2679,28 +2715,9 @@ function renderFollowPicks(results){
:'<div class="fpickactions"><button data-pick-cancel>关闭</button></div>'}</div>`;
box.scrollIntoView({block:'nearest',behavior:'smooth'});
box.querySelector('[data-pick-cancel]').onclick=()=>{box.innerHTML=''};
- const applySrcFilter=()=>box.querySelectorAll('.fpickitem').forEach(item=>{
+ const applySrcFilter=()=>document.querySelectorAll('.fpickitem').forEach(item=>{
item.hidden=fsrcUnchecked.has(item.dataset.provider||'')});
applySrcFilter();
- const filterLabel=()=>{const n=providers.filter(p=>!fsrcUnchecked.has(p)).length;
- const slot=box.querySelector('[data-srcfilter-label]');
- if(slot)slot.textContent=n===providers.length?'来源:全部':`来源:${n}/${providers.length}`};
- filterLabel();
- box.querySelectorAll('[data-srcfilter]').forEach(input=>input.onchange=()=>{
- input.checked?fsrcUnchecked.delete(input.dataset.srcfilter)
- :fsrcUnchecked.add(input.dataset.srcfilter);
- filterLabel();applySrcFilter()});
- const filterToggle=box.querySelector('[data-srcfilter-toggle]');
- const filterMenu=box.querySelector('[data-srcfilter-menu]');
- if(filterToggle&&filterMenu){
- filterToggle.onclick=e=>{e.stopPropagation();
- const open=filterMenu.hidden;filterMenu.hidden=!open;
- filterToggle.setAttribute('aria-expanded',String(open))};
- document.addEventListener('click',event=>{
- if(!filterMenu.hidden&&!filterMenu.contains(event.target)
- &&!filterToggle.contains(event.target)){filterMenu.hidden=true;
- filterToggle.setAttribute('aria-expanded','false')}},{once:false});
- }
const addButton=box.querySelector('[data-pick-add]');
if(addButton)addButton.onclick=async()=>{
const picked=[...box.querySelectorAll('[data-pick]:checked')]
@@ -3756,7 +3773,10 @@ async function load(reset){
buildManageBar();
const html=batchWithMix(d.items,isCatalogPath(decodeURIComponent(location.pathname))&&state.state!=='trash');
if(reset)releaseHoverPreviews($('#grid'));
- if(reset)$('#grid').innerHTML=html; else $('#grid').insertAdjacentHTML('beforeend',html);
+ if(reset&&state.state==='trash'&&!d.items.length)
+ $('#grid').innerHTML=`<div class="trashempty">${emptyState('trash-2','回收站是空的','删掉的内容会先到这里;确认不再需要后再清空。')}</div>`;
+ else if(reset)$('#grid').innerHTML=html;
+ else $('#grid').insertAdjacentHTML('beforeend',html);
renderCount();
$('#loadSentinel').hidden=reset?d.items.length>=total:!d.has_more;
wireCards($('#grid'));