Peach: Local-first video metadata scraper and media manager.
fix(web): 社媒标记收成满圆的墨色标,公司官网那一格只给域名
longmeidaoebe332756123
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 2c54d5c21..433d4b36e 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -1539,8 +1539,12 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('<span class="sr-only">${esc(x.label)}</span></a>')self.assertPageContains('.entitylinks a.iconlink{padding:4px;gap:0;border-radius:50%}')- def test_a_studio_official_link_shows_its_url_and_globe(self):- self.assertPageContains("if(kind==='studio')")+ def test_a_company_official_link_shows_its_url_and_globe(self):+ # 厂牌页和事务所页的头像都是这家公司自己的圆标,标题都是它的名字:官网那一格+ # 再摆一遍圆标和名字,同一件事就说了三遍。人物页的头像是人,事务所的圆标和+ # 名字在那里才是新信息,所以只有公司这两类收成域名。+ self.assertPageContains("const company=kind==='studio'||kind==='agency';")+ self.assertPageContains(" if(company)\n")self.assertPageContains('<a class="urllink" href="${esc(x.url)}"')self.assertPageContains("${esc(linkHost(x.url)||x.label)}")self.assertPageContains(".entitylinks a.urllink{padding:4px 12px 4px 4px")@@ -1552,7 +1556,6 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('mountDetailPlayer(it,vv,appSettings.detailAutoplay)')self.assertPageContains('mountDetailPlayer(item,followVideo,appSettings.detailAutoplay,{')self.assertPageContains('id="detailAutoplaySetting"')- self.assertPageContains('fill="#000" stroke="none"/><path fill="#fff"')def test_entity_links_have_no_external_arrow(self):# `target="_blank"` 已经是外链,箭头只是重复;一排链接里它还会挤掉本就不多的@@ -1560,10 +1563,23 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageLacks('entitylinkarrow', "外链箭头应当已删除")self.assertPageLacks('↗', "外链箭头字符应当已删除")- def test_x_links_preserve_the_black_plate_and_white_mark(self):- self.assertPageContains('<symbol id="i-brand-x"')- # 填充字形不吃通用的 stroke:currentColor;fill:none。- self.assertPageContains('.entitylinkicon.brand svg{width:20px;height:20px;stroke:none;filter:none}')+ def test_the_x_mark_is_a_full_disc_that_takes_the_current_ink(self):+ """圆盘吃 currentColor,字形从圆里挖掉,两个主题下分量一样重。++ 固定色的板子在其中一档上必然失手:同一块黑在浅色页面上压过周围,在深色页面+ 上糊进底色,只剩一个悬空的字形。圆盘取墨色就没有这一档差别。+ 字形按 .5 缩在圆内,靠的是缩放而不是外圈的 `overflow:hidden`——社媒标记是+ 拿来认牌子的,裁掉一角就不是那个牌子了。网站 favicon 不在此列,那些是方图。+ """+ self.assertPageContains('<symbol id="i-brand-x" viewBox="0 0 24 24">')+ self.assertPageContains(+ '<circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" '+ 'mask="url(#i-brand-x-cut)"/>')+ self.assertPageContains(+ 'transform="translate(12 12) scale(.5) translate(-12 -12)"')+ self.assertPageLacks('fill="#000" stroke="none"', "品牌标记不写死板子的颜色")+ self.assertPageContains(+ '.entitylinkicon.brand svg{width:100%;height:100%;stroke:none;filter:none}')def test_the_link_icon_disc_carries_no_plate_of_its_own(self):"""内联品牌标记直接画在药丸上。垫一层 `--sunk` 会让它比周围暗一档,看着像@@ -6409,8 +6425,7 @@ class WebUiSourceTests(unittest.TestCase):("pics", "-1.6 -1.6 19.2 19.2"),("text-aa", "-7.3 32.8 262.5 182.9"),("playlist", "10.4 10.5 259.2 259.2"),- ("sperm", "1.5 1.2 21.2 21.2"),- ("brand-x", "-0.9 -0.9 25.9 25.9")):+ ("sperm", "1.5 1.2 21.2 21.2")):self.assertPageContains(f'<symbol id="i-{symbol}" viewBox="{box}"')# 框由生成脚本负责重放:`npm run vendor:web` 每次都写出同一份。generator = (Path(__file__).resolve().parents[1]diff --git a/web/app.js b/web/app.jsindex 3abfc1422..7c2c855e7 100644--- a/web/app.js+++ b/web/app.js@@ -6342,8 +6342,10 @@ async function openEntity(kind,name,push=true){// 纯图标的链接自己不带可读文字,得把标签留给辅助技术。return `<a class="iconlink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}">${mark}<span class="sr-only">${esc(x.label)}</span></a>`;}- // 官网用地球图标标明链接类型。- if(kind==='studio')+ /* 公司页的头像就是这家公司的标识、标题就是它的名字,官网链接再摆一遍同一个+ 圆标、同一个名字,等于把一件事说三遍。这一格因此只给域名,前面的地球说明+ 这是条外链。人物页反过来:头像是这个人,事务所的圆标和名字在那里是新东西。 */+ if(company)return `<a class="urllink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}</span><span class="entitylinklabel">${esc(linkHost(x.url)||x.label)}</span></a>`;return `<a href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}<img class="entityfavicon" src="${esc(linkMarkUrl(x))}" alt="" loading="lazy" referrerpolicy="no-referrer" data-drop="self"></span><span class="entitylinklabel">${esc(x.label)}</span></a>`;}).join('');diff --git a/web/css/07-entity.css b/web/css/07-entity.cssindex f827a07be..b66cb2ae3 100644--- a/web/css/07-entity.css+++ b/web/css/07-entity.css@@ -50,8 +50,9 @@但白底会让「取到了一张空图」看起来和「圆盘坏了」一模一样——X 的 favicon 正是这种。现在 X 走内联品牌标记不再发请求,其余主机也不再垫白底。 */.entitylinkicon img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--sunk)}-/* 品牌标记是填充字形,不吃上面那套描边。 */-.entitylinkicon.brand svg{width:20px;height:20px;stroke:none;filter:none}+/* 品牌标记是填充字形,不吃上面那套描边;它自己画满整个圆盘,所以外面那圈+ `overflow:hidden` 落不到它身上——圆内切在方框里,一个角都碰不到。 */+.entitylinkicon.brand svg{width:100%;height:100%;stroke:none;filter:none}/* 纯图标的社媒链接:收成圆形,没有文字就不给文字留位置。 */.entitylinks a.iconlink{padding:4px;gap:0;border-radius:50%}/* 官网域名前显示地球图标,与带名称的链接共用间距。 */diff --git a/web/index.html b/web/index.htmlindex 6988a48de..17a96d5fe 100644--- a/web/index.html+++ b/web/index.html@@ -113,11 +113,16 @@<symbol id="i-clock" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="M12 6v6l4 2" /></symbol><symbol id="i-calendar" viewBox="0 0 24 24"><path d="M8 2v3" /><path d="M16 2v3" /><rect x="3" y="3" width="18" height="18" rx="2" /><path d="M3 9h18" /></symbol><symbol id="i-external-link" viewBox="0 0 24 24"><path d="M15 3h6v6" /><path d="M10 14 21 3" /><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /></symbol>- <!-- 品牌标记。这些不是 Lucide 描边图标,而是填充字形,所以自带 fill/stroke,- 不吃通用的 `stroke:currentColor;fill:none`。+ <!-- 品牌标记。不是 Lucide 描边图标,所以自带 fill、盖掉通用的+ `stroke:currentColor;fill:none`。+ 整枚是一个满圆,字形从圆里挖掉,圆吃 currentColor:浅色主题下是墨底透字、+ 深色下是白底墨字,两档的分量一样重。固定色的板子做不到这一点——同一块黑+ 在一档上压过周围、在另一档上糊进页面底。+ 挖出来的字形按 .5 缩在圆内,边角不碰圆周:社媒标记是拿来认牌子的,+ 缺一角就不是那个牌子。别的主机走 favicon,那些是方图,裁成圆无妨。只做 X 一个:416 条社媒链接里 372 条(89%)是 x.com/twitter.com,而 X 恰好- 会挡掉 favicon 请求——资料页上那个空白白圆就是它。其余主机继续走 favicon。 -->- <symbol id="i-brand-x" viewBox="-0.9 -0.9 25.9 25.9"><rect x="-0.9" y="-0.9" width="25.9" height="25.9" fill="#000" stroke="none"/><path fill="#fff" stroke="none" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></symbol>+ 会挡掉 favicon 请求。 -->+ <symbol id="i-brand-x" viewBox="0 0 24 24"><mask id="i-brand-x-cut"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.5) translate(-12 -12)" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#i-brand-x-cut)"/></symbol><symbol id="i-bookmark-plus" viewBox="0 0 24 24"><path d="M12 7v6" /><path d="M15 10H9" /><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol><symbol id="i-bookmark" viewBox="0 0 24 24"><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol><symbol id="i-gallery-vertical-end" viewBox="0 0 24 24"><path d="M7 2h10" /><path d="M5 6h14" /><rect width="18" height="12" x="3" y="10" rx="2" /></symbol>