Peach: Local-first video metadata scraper and media manager.
feat(web): 社媒标记取各家品牌色,常见七家一律走图标库
longmeidao2c079ddd6c01
diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.mdindex 7014a72f2..23b5eeece 100644--- a/docs/PRODUCT_BACKLOG.md+++ b/docs/PRODUCT_BACKLOG.md@@ -73,7 +73,7 @@合计:**31 项开放需求**,其中 7 项已有骨架,24 项尚未实现。已完成的需求不在这里留痕,去 Git 历史查。-## 待执行的操作(39 项)+## 待执行的操作(40 项)需要另行授权、外部条件或人工判断才能做的具体操作与复核批次,比上面的需求细一层;做完就删,不在这里留痕。待办只放这一处:`docs/STATUS.md` 每次会话开头都要读,队列不该常驻在那种入口文件里。@@ -131,3 +131,4 @@抓不到半透明水印(`NUBILES.NET`、`MATTIEDOLL.DEVIANTART.COM` 那几张),漏的往 `--marks` 的 CSV里补 `file,x,y,w,h`。另有 14 张检出超过 4 处被判为画面文字放过,它们是第 34 项那批封面误装,去水印不适用,要的是换源。+40. `/link-mark` 的「成品图标原样用」通道有 21 与 37 号同一个毛病,只是资产不同:站点给的 apple-touch-icon 是照方角设计的,四边一圈高光裁成圆之后沿圆周露白。`site_icons.py` 对 ≥96 px 的设计图只做等比缩放,那圈高光是人家设计的一部分、抠不掉。涉及 8 个主机共 149 条链接:t-powers.co.jp 59、blog.livedoor.jp 49、bambi.ne.jp 16、mines-pro.jp 15、life-promotion.com 5、mgstage.com 3、moodyz.com 1、adult.contents.fc2.com 1。可走的路子是把 `images.refit_plate` 那套摆位判据接到这条通道上(37 号定下来的形状同样适用),或者对这一类直接退回字形合成。常见社媒已经改走内联品牌标记,不在此列。\ No newline at end of filediff --git a/docs/STATUS.md b/docs/STATUS.mdindex e989b1787..c0f604ffc 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -11,7 +11,7 @@- 设置与反馈已部署;自动更新设置未部署。- 女优头像 545 张,脸宽中位数 320px,37 张带水印待复核;被顶掉的整套留在 `avatars-superseded/`,判据见 `SOURCING.md`。-- 小图、资料骨架、官网图标、X 原色与自动播放开关已实现;请求共用 Chrome UA。厂牌标识 198 张随仓库分发(ADR-0026)。+- 小图、资料骨架、官网图标与自动播放开关已实现;请求共用 Chrome UA。资料页的社媒标记覆盖 Phosphor 有字形的七家(X、Instagram、Threads、TikTok、YouTube、Facebook、Linktree),各取自家场色;其余主机走 `/link-mark`。厂牌标识 198 张随仓库分发(ADR-0026)。- Eightman 与 SO MODEL AGENT 已合为 8662,成员与关联作品保留,旧名仍可解析。- Windows 是 ledger writer,入口 `dist\Peach\Peach.exe`;代码与数据在内置盘,外置盘只提供 `R:\media`。diff --git a/scripts/vendor_web_dependencies.mjs b/scripts/vendor_web_dependencies.mjsindex ada73fab0..acca1ef51 100644--- a/scripts/vendor_web_dependencies.mjs+++ b/scripts/vendor_web_dependencies.mjs@@ -65,7 +65,7 @@ copyPackageFiles({["swiper-bundle.min.js", "swiper-bundle.min.js"],["swiper-bundle.min.css", "swiper-bundle.min.css"],],- note: "Peach 自托管固定版本,不依赖 CDN。只有照片灯箱按需加载 Thumbs、Keyboard 与 Zoom;瀑布流不经过 Swiper。",+ note: "Peach 自托管固定版本,不依赖 CDN。只有照片灯箱按需加载 Thumbs、Keyboard 与 Zoom;图片墙不经过 Swiper。",});const lucideIcons = new Map([@@ -134,10 +134,7 @@ const lucideIcons = new Map([// 零件不带那个前缀,也就不进这张名单。const handDrawnIcons = new Set(["shuffle", // 两条带 pathLength 的动画路径由 Peach 维护。- "alert", "pics", "jav", "theater-enter", "theater-exit", "brand-x",- // 字形来自 Phosphor regular 的 instagram-logo 与 threads-logo(MIT),各套进与 brand-x- // 同一只墨色圆盘:三枚并排时圆一样大、字形一样占直径的一半。- "brand-instagram", "brand-threads",+ "alert", "pics", "jav", "theater-enter", "theater-exit",// 「换一批」:Lucide shuffle 的线条拆成 strand-a/strand-b 两条 path 供忙态逐条画出,// 上游一刷新就会把两条并回五条,所以由手工维护。"shuffle",@@ -175,6 +172,54 @@ for (const [symbol, { icon, viewBox }] of phosphorIcons) {index = index.replace(pattern, `<symbol id="i-${symbol}" ${attrs}>${inner}</symbol>`);}+// 社媒品牌标记:各家自己的场色圆盘,字形留白。+//+// 一枚牌子的形状不是我们能设计的东西,所以不自己画;同一套图标库出的七枚,笔画粗细和+// 圆角风格本来就是一致的,各站点自己的 favicon 拼不出这种一致。颜色同理:X 是黑底白字、+// Instagram 是那道粉紫,认出是哪一家靠的正是这个,跟着界面主题变反而认不出。场色和白+// 字形都是人家标识的一部分,不是界面 token,所以写死在这里、不吃 currentColor。+// 深色主题下黑盘不悬空:它画在 `.entitylinks a` 那圈药丸里,药丸自带 1px 边和+// `--overlay-5` 底,盘与页面之间始终隔着一条边界,白字形本身也一直看得见。+//+// 字形按 24×.5/256 缩到圆心,占直径的一半,所以圆的边沿到字形之间总有一圈呼吸空间,+// 靠的是缩放而不是外面那层 `overflow:hidden`:社媒标记是拿来认牌子的,裁掉一角就不是+// 那个牌子了。缩放写在一层 `<g>` 上而不是逐条 path 上——上游哪天把一个 logo 拆成两条+// 路径或补一个 `<circle>`,包在外面这一层照样把它们一起缩进圆里。+//+// Instagram 的场是渐变不是单色,写成 symbol 内部一条 `linearGradient`。放在 symbol 里+// 而不是雪碧图顶层:`<use>` 克隆整棵子树,引用在它自己那份影子树里就解析得到。+//+// 覆盖范围是「图标库里有的常见社媒」。库里没有的(lit.link、pub.linx.live、livedoor、+// ameblo 这类)继续走 `/link-mark`,那边按站点自己的图标合成。+const GRADIENT_FIELD = "gradient";+const brandDiscs = new Map([+ ["brand-x", ["x-logo", "#000000"]],+ ["brand-instagram", ["instagram-logo", GRADIENT_FIELD]],+ ["brand-threads", ["threads-logo", "#000000"]],+ ["brand-tiktok", ["tiktok-logo", "#000000"]],+ ["brand-youtube", ["youtube-logo", "#FF0000"]],+ ["brand-facebook", ["facebook-logo", "#0866FF"]],+ ["brand-linktree", ["linktree-logo", "#43E660"]],+]);+const GLYPH_TRANSFORM = "translate(12 12) scale(.046875) translate(-128 -128)";+// Instagram 的场从左下走到右上,三停取自它自己那枚 glyph 的用色。+const GRADIENT_STOPS = [["0", "#FFDD55"], [".45", "#FF543E"], ["1", "#C837AB"]];+for (const [symbol, [icon, field]] of brandDiscs) {+ const inner = svgInner(text("node_modules", "@phosphor-icons/core", "assets", "regular", `${icon}.svg`));+ const graded = field === GRADIENT_FIELD;+ const defs = graded+ ? `<linearGradient id="${symbol}-field" x1="2" y1="22" x2="22" y2="2" gradientUnits="userSpaceOnUse">`+ + GRADIENT_STOPS.map(([at, color]) => `<stop offset="${at}" stop-color="${color}"/>`).join("")+ + "</linearGradient>"+ : "";+ const disc = defs+ + `<circle cx="12" cy="12" r="12" stroke="none" fill="${graded ? `url(#${symbol}-field)` : field}"/>`+ + `<g fill="#fff" stroke="none" transform="${GLYPH_TRANSFORM}">${inner}</g>`;+ const pattern = new RegExp(`<symbol id="i-${symbol}" viewBox="0 0 24 24">[\\s\\S]*?<\\/symbol>`);+ if (!pattern.test(index)) throw new Error(`缺少品牌标记 symbol:${symbol}`);+ index = index.replace(pattern, `<symbol id="i-${symbol}" viewBox="0 0 24 24">${disc}</symbol>`);+}+const healthInner = svgInner(text("node_modules", "healthicons", "public", "icons", "svg", "outline-24px", "contraceptives", "sperm.svg"));const SPERM_VIEWBOX = "1.5 1.2 21.2 21.2";index = index.replace(@@ -227,9 +272,11 @@ stage("web/vendor/phosphor-ORIGIN.md",`- npm 包:\`@phosphor-icons/core@${versions["@phosphor-icons/core"]}\`\n` +`- npm lock integrity:\`${integrity("@phosphor-icons/core")}\`\n` +`- 许可证:MIT;原文见 \`phosphor-LICENSE.txt\`\n` +- `- 消费者:\`web/index.html\` 内联的 ${phosphorIcons.size} 个 regular 权重 symbol\n\n` ++ `- 消费者:\`web/index.html\` 内联的 ${phosphorIcons.size} 个 regular 权重 symbol,`+ + `外加 ${brandDiscs.size} 枚社媒品牌标记(${[...brandDiscs.values()].map(([icon]) => icon).join("、")})\n\n` +"只在描边画法说不清那件事时才用这一套:`text-aa` 是字母表,`playlist` 是播放列表。\n" +- "填充声明写在 symbol 上,压住全局的 `stroke:currentColor;fill:none`。\n");+ "填充声明写在 symbol 上,压住全局的 `stroke:currentColor;fill:none`。\n" ++ "品牌标记另走一条路:字形留白、压在各家自己那块场色的圆盘上,缩放写在外面一层 `<g>` 上。\n");stage("web/vendor/healthicons-LICENSE.txt", lfText("node_modules", "healthicons", "LICENSE"));stage("web/vendor/healthicons-ORIGIN.md",`# Health Icons ${versions.healthicons}\n\n` +@@ -242,7 +289,7 @@ stage("web/vendor/healthicons-ORIGIN.md",// 换 Lucide 版本时不跟着刷新,也没人看得出它是自绘的还是忘了纳管。const spriteSymbols = [...index.matchAll(/id="i-([a-z0-9-]+)"/g)].map(m => m[1]);const owned = new Set([...lucideIcons.keys(), ...phosphorIcons.keys(),- ...handDrawnIcons, "sperm"]);+ ...brandDiscs.keys(), ...handDrawnIcons, "sperm"]);const orphans = spriteSymbols.filter(name => !name.startsWith("player-") && !owned.has(name));if (orphans.length) {diff --git a/tests/test_dependency_policy.py b/tests/test_dependency_policy.pyindex 53e27b580..a4faef192 100644--- a/tests/test_dependency_policy.py+++ b/tests/test_dependency_policy.py@@ -115,8 +115,13 @@ class DependencyPolicyTests(unittest.TestCase):# Map 的第二项是上游名字,只取键;否则 sort-desc 这类上游名会混进来。return set(re.findall(r'\["([a-z0-9-]+)"', body(block)))+ # 品牌标记的第二项是「上游名字加场色」的数组,键在每行行首那对方括号里。+ brand_keys = set(re.findall(r'^\s*\["([a-z0-9-]+)", \[',+ body("const brandDiscs = new Map(["), re.M))+ self.assertIn("brand-x", brand_keys)owned = (map_keys("const lucideIcons = new Map([")| map_keys("const phosphorIcons = new Map([")+ | brand_keys| set(re.findall(r'"([a-z0-9-]+)"',body("const handDrawnIcons = new Set([")))| {"sperm"})diff --git a/tests/test_web_js.py b/tests/test_web_js.pyindex f69cfdd64..cd5d2d030 100644--- a/tests/test_web_js.py+++ b/tests/test_web_js.py@@ -321,19 +321,25 @@ class WebJsBehaviourTests(unittest.TestCase):self.assertNotIn("url=", url, "外链图标端点不得接受前端给的地址")def test_brand_marks_cover_the_host_and_its_subdomains_only(self):- # x.com 一家就占了账本里 793 条外链中的 378 条,只给它一个内联标记就覆盖将近一半,- # 还省一次跨站请求。其余继续走 favicon,不为个位数的链接各配图标。+ # 名单按图标库的覆盖面定,不按链接条数:Phosphor 有字形的常见社媒一家一枚配齐,+ # 库里没有的(livedoor、ameblo、lit.link 这类)才走 `/link-mark` 按站点图标合成。self.assertJsResults([("core.js", "brandIcon", ["https://x.com/remu"], "brand-x"),("core.js", "brandIcon", ["https://www.twitter.com/remu"], "brand-x"),("core.js", "brandIcon", ["https://mobile.x.com/remu"], "brand-x"),- # Instagram 的 favicon 同样取不到,给它自己的标记。("core.js", "brandIcon", ["https://www.instagram.com/arina_hashimoto1215"], "brand-instagram"),- # Threads 给得出图,给的是 iOS 应用图标那种带高光的圆角方图,裁成圆露白边。("core.js", "brandIcon", ["https://www.threads.com/@remu"], "brand-threads"),("core.js", "brandIcon", ["https://www.threads.net/@remu"], "brand-threads"),+ ("core.js", "brandIcon", ["https://www.tiktok.com/@remu"], "brand-tiktok"),+ ("core.js", "brandIcon", ["https://www.youtube.com/@remu"], "brand-youtube"),+ ("core.js", "brandIcon", ["https://youtu.be/abc"], "brand-youtube"),+ ("core.js", "brandIcon", ["https://www.facebook.com/remu"], "brand-facebook"),+ ("core.js", "brandIcon", ["https://linktr.ee/remu"], "brand-linktree"),# 只认后缀边界:`notx.com` 不是 `x.com` 的子域。("core.js", "brandIcon", ["https://notx.com/remu"], ""),+ # 图标库里没有这几家,它们继续走 `/link-mark`。+ ("core.js", "brandIcon", ["https://blog.livedoor.jp/remu"], ""),+ ("core.js", "brandIcon", ["https://lit.link/remu"], ""),("core.js", "brandIcon", ["https://example.com/a"], ""),# 坏地址返回空串而不是抛异常——资料页的链接来自刮削,什么都可能有。("core.js", "brandIcon", ["不是网址"], ""),diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 0a677047f..178eea6fa 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -2021,29 +2021,41 @@ class WebUiSourceTests(unittest.TestCase):".taste-history-guide-content a svg{", ".confighelp a svg{"):self.assertNotIn(stale, css, f"{stale} 已由 .externalmark 接管")- 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(#brand-x-knockout)"/>')- self.assertPageContains(- 'transform="translate(12 12) scale(.5) translate(-12 -12)"')- # Instagram 与 Threads 同一只圆盘:Phosphor 的 256 视口字形按 24×.5/256 缩进去。- for symbol in ("brand-instagram", "brand-threads"):+ def test_each_social_mark_wears_its_own_brand_colour(self):+ """七枚社媒标记是各家自己的场色圆盘加白字形,不吃 currentColor。++ 认出是哪一家靠的正是颜色:X 黑底白字、Instagram 那道粉紫、YouTube 正红。场色+ 和白字形都是人家标识的一部分,不是界面 token,跟着主题变就认不出了。深色主题+ 下黑盘也不悬空——它画在 `.entitylinks a` 那圈药丸里,药丸自带边和底。+ 字形按 24×.5/256 缩在圆内,靠的是缩放而不是外圈的 `overflow:hidden`:社媒标记+ 是拿来认牌子的,裁掉一角就不是那个牌子了。网站 favicon 不在此列,那些是方图。+ """+ fields = {+ "brand-x": '"#000000"', "brand-threads": '"#000000"', "brand-tiktok": '"#000000"',+ "brand-youtube": '"#FF0000"', "brand-facebook": '"#0866FF"',+ "brand-linktree": '"#43E660"',+ "brand-instagram": '"url(#brand-instagram-field)"',+ }+ for symbol, field in fields.items():self.assertPageContains(f'<symbol id="i-{symbol}" viewBox="0 0 24 24">')- self.assertPageContains(f'mask="url(#{symbol}-knockout)"/>')- self.assertPageContains(- 'transform="translate(12 12) scale(.046875) translate(-128 -128)"')- self.assertPageContains("[['instagram.com'],'brand-instagram']")- self.assertPageContains("[['threads.com','threads.net'],'brand-threads']")- self.assertPageLacks('fill="#000" stroke="none"', "品牌标记不写死板子的颜色")+ self.assertPageContains(+ f'<circle cx="12" cy="12" r="12" stroke="none" fill={field}/>'+ '<g fill="#fff" stroke="none" transform="translate(12 12) '+ 'scale(.046875) translate(-128 -128)">')+ # Instagram 的场是渐变不是单色,那条 linearGradient 就住在它自己的 symbol 里。+ self.assertPageContains(+ '<linearGradient id="brand-instagram-field" x1="2" y1="22" x2="22" y2="2"'+ ' gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#FFDD55"/>'+ '<stop offset=".45" stop-color="#FF543E"/>'+ '<stop offset="1" stop-color="#C837AB"/></linearGradient>')+ for hosts in ("[['instagram.com'],'brand-instagram']",+ "[['threads.com','threads.net'],'brand-threads']",+ "[['tiktok.com'],'brand-tiktok']",+ "[['youtube.com','youtu.be'],'brand-youtube']",+ "[['facebook.com','fb.com'],'brand-facebook']",+ "[['linktr.ee','linktree.com'],'brand-linktree']"):+ self.assertPageContains(hosts)+ self.assertPageLacks("knockout", "字形是白色实体,不是从圆盘里挖掉的洞")self.assertPageContains('.entitylinkicon.brand svg{width:100%;height:100%;stroke:none;filter:none}')diff --git a/web/index.html b/web/index.htmlindex ea1deb846..3e82a25e6 100644--- a/web/index.html+++ b/web/index.html@@ -166,9 +166,13 @@遮罩的 id 不带 `i-` 前缀:那个前缀专属雪碧图里可被 `<use>` 引用的图标,`test_every_sprite_symbol_has_a_declared_owner` 按它清点每一枚的归属,借来命名一个内部遮罩会被当成一枚没人认领的图标。 -->- <symbol id="i-brand-x" viewBox="0 0 24 24"><mask id="brand-x-knockout"><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(#brand-x-knockout)"/></symbol>- <symbol id="i-brand-instagram" viewBox="0 0 24 24"><mask id="brand-instagram-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.046875) translate(-128 -128)" d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160ZM176,24H80A56.06,56.06,0,0,0,24,80v96a56.06,56.06,0,0,0,56,56h96a56.06,56.06,0,0,0,56-56V80A56.06,56.06,0,0,0,176,24Zm40,152a40,40,0,0,1-40,40H80a40,40,0,0,1-40-40V80A40,40,0,0,1,80,40h96a40,40,0,0,1,40,40ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-instagram-knockout)"/></symbol>- <symbol id="i-brand-threads" viewBox="0 0 24 24"><mask id="brand-threads-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.046875) translate(-128 -128)" d="M186.42,123.65a63.81,63.81,0,0,0-11.13-6.72c-4-29.89-24-39.31-33.1-42.07-19.78-6-42.51,1.19-52.85,16.7a8,8,0,0,0,13.32,8.88c6.37-9.56,22-14.16,34.89-10.27,9.95,3,16.82,10.3,20.15,21a81.05,81.05,0,0,0-15.29-1.43c-13.92,0-26.95,3.59-36.67,10.1C94.3,127.57,88,139,88,152c0,20.58,15.86,35.52,37.71,35.52a48,48,0,0,0,34.35-14.81c6.44-6.7,14-18.36,15.61-37.1.38.26.74.53,1.1.8C186.88,144.05,192,154.68,192,168c0,19.36-20.34,48-64,48-26.73,0-45.48-8.65-57.34-26.44C60.93,175,56,154.26,56,128s4.93-47,14.66-61.56C82.52,48.65,101.27,40,128,40c32.93,0,54,13.25,64.53,40.52a8,8,0,1,0,14.93-5.75C194.68,41.56,167.2,24,128,24,96,24,72.19,35.29,57.34,57.56,45.83,74.83,40,98.52,40,128s5.83,53.17,17.34,70.44C72.19,220.71,96,232,128,232c30.07,0,48.9-11.48,59.4-21.1C200.3,199.08,208,183,208,168,208,149.66,200.54,134.32,186.42,123.65Zm-37.89,38a31.94,31.94,0,0,1-22.82,9.9c-10.81,0-21.71-6-21.71-19.52,0-12.63,12-26.21,38.41-26.21A63.88,63.88,0,0,1,160,128.24C160,142.32,156,153.86,148.53,161.62Z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-threads-knockout)"/></symbol>+ <symbol id="i-brand-x" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" stroke="none" fill="#000000"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M214.75,211.71l-62.6-98.38,61.77-67.95a8,8,0,0,0-11.84-10.76L143.24,99.34,102.75,35.71A8,8,0,0,0,96,32H48a8,8,0,0,0-6.75,12.3l62.6,98.37-61.77,68a8,8,0,1,0,11.84,10.76l58.84-64.72,40.49,63.63A8,8,0,0,0,160,224h48a8,8,0,0,0,6.75-12.29ZM164.39,208,62.57,48h29L193.43,208Z"/></g></symbol>+ <symbol id="i-brand-instagram" viewBox="0 0 24 24"><linearGradient id="brand-instagram-field" x1="2" y1="22" x2="22" y2="2" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#FFDD55"/><stop offset=".45" stop-color="#FF543E"/><stop offset="1" stop-color="#C837AB"/></linearGradient><circle cx="12" cy="12" r="12" stroke="none" fill="url(#brand-instagram-field)"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160ZM176,24H80A56.06,56.06,0,0,0,24,80v96a56.06,56.06,0,0,0,56,56h96a56.06,56.06,0,0,0,56-56V80A56.06,56.06,0,0,0,176,24Zm40,152a40,40,0,0,1-40,40H80a40,40,0,0,1-40-40V80A40,40,0,0,1,80,40h96a40,40,0,0,1,40,40ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"/></g></symbol>+ <symbol id="i-brand-threads" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" stroke="none" fill="#000000"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M186.42,123.65a63.81,63.81,0,0,0-11.13-6.72c-4-29.89-24-39.31-33.1-42.07-19.78-6-42.51,1.19-52.85,16.7a8,8,0,0,0,13.32,8.88c6.37-9.56,22-14.16,34.89-10.27,9.95,3,16.82,10.3,20.15,21a81.05,81.05,0,0,0-15.29-1.43c-13.92,0-26.95,3.59-36.67,10.1C94.3,127.57,88,139,88,152c0,20.58,15.86,35.52,37.71,35.52a48,48,0,0,0,34.35-14.81c6.44-6.7,14-18.36,15.61-37.1.38.26.74.53,1.1.8C186.88,144.05,192,154.68,192,168c0,19.36-20.34,48-64,48-26.73,0-45.48-8.65-57.34-26.44C60.93,175,56,154.26,56,128s4.93-47,14.66-61.56C82.52,48.65,101.27,40,128,40c32.93,0,54,13.25,64.53,40.52a8,8,0,1,0,14.93-5.75C194.68,41.56,167.2,24,128,24,96,24,72.19,35.29,57.34,57.56,45.83,74.83,40,98.52,40,128s5.83,53.17,17.34,70.44C72.19,220.71,96,232,128,232c30.07,0,48.9-11.48,59.4-21.1C200.3,199.08,208,183,208,168,208,149.66,200.54,134.32,186.42,123.65Zm-37.89,38a31.94,31.94,0,0,1-22.82,9.9c-10.81,0-21.71-6-21.71-19.52,0-12.63,12-26.21,38.41-26.21A63.88,63.88,0,0,1,160,128.24C160,142.32,156,153.86,148.53,161.62Z"/></g></symbol>+ <symbol id="i-brand-tiktok" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" stroke="none" fill="#000000"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M224,72a48.05,48.05,0,0,1-48-48,8,8,0,0,0-8-8H128a8,8,0,0,0-8,8V156a20,20,0,1,1-28.57-18.08A8,8,0,0,0,96,130.69V88a8,8,0,0,0-9.4-7.88C50.91,86.48,24,119.1,24,156a76,76,0,0,0,152,0V116.29A103.25,103.25,0,0,0,224,128a8,8,0,0,0,8-8V80A8,8,0,0,0,224,72Zm-8,39.64a87.19,87.19,0,0,1-43.33-16.15A8,8,0,0,0,160,102v54a60,60,0,0,1-120,0c0-25.9,16.64-49.13,40-57.6v27.67A36,36,0,1,0,136,156V32h24.5A64.14,64.14,0,0,0,216,87.5Z"/></g></symbol>+ <symbol id="i-brand-youtube" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" stroke="none" fill="#FF0000"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M164.44,121.34l-48-32A8,8,0,0,0,104,96v64a8,8,0,0,0,12.44,6.66l48-32a8,8,0,0,0,0-13.32ZM120,145.05V111l25.58,17ZM234.33,69.52a24,24,0,0,0-14.49-16.4C185.56,39.88,131,40,128,40s-57.56-.12-91.84,13.12a24,24,0,0,0-14.49,16.4C19.08,79.5,16,97.74,16,128s3.08,48.5,5.67,58.48a24,24,0,0,0,14.49,16.41C69,215.56,120.4,216,127.34,216h1.32c6.94,0,58.37-.44,91.18-13.11a24,24,0,0,0,14.49-16.41c2.59-10,5.67-28.22,5.67-58.48S236.92,79.5,234.33,69.52Zm-15.49,113a8,8,0,0,1-4.77,5.49c-31.65,12.22-85.48,12-86,12H128c-.54,0-54.33.2-86-12a8,8,0,0,1-4.77-5.49C34.8,173.39,32,156.57,32,128s2.8-45.39,5.16-54.47A8,8,0,0,1,41.93,68c30.52-11.79,81.66-12,85.85-12h.27c.54,0,54.38-.18,86,12a8,8,0,0,1,4.77,5.49C221.2,82.61,224,99.43,224,128S221.2,173.39,218.84,182.47Z"/></g></symbol>+ <symbol id="i-brand-facebook" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" stroke="none" fill="#0866FF"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm8,191.63V152h24a8,8,0,0,0,0-16H136V112a16,16,0,0,1,16-16h16a8,8,0,0,0,0-16H152a32,32,0,0,0-32,32v24H96a8,8,0,0,0,0,16h24v63.63a88,88,0,1,1,16,0Z"/></g></symbol>+ <symbol id="i-brand-linktree" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" stroke="none" fill="#43E660"/><g fill="#fff" stroke="none" transform="translate(12 12) scale(.046875) translate(-128 -128)"><path d="M136,160v72a8,8,0,0,1-16,0V160a8,8,0,0,1,16,0Zm72-64H147.31l42.35-42.34a8,8,0,0,0-11.32-11.32L136,84.69V24a8,8,0,0,0-16,0V84.69L77.66,42.34A8,8,0,0,0,66.34,53.66L108.69,96H48a8,8,0,0,0,0,16h60.69L66.34,154.34a8,8,0,0,0,11.32,11.32L128,115.31l50.34,50.35a8,8,0,0,0,11.32-11.32L147.31,112H208a8,8,0,0,0,0-16Z"/></g></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>diff --git a/web/js/core.js b/web/js/core.jsindex 65fed2f2d..3e2f59f89 100644--- a/web/js/core.js+++ b/web/js/core.js@@ -90,18 +90,20 @@ const linkHost=url=>{try{return new URL(url).hostname.replace(/^www\./,'').toUpp传的是链接 id 而不是地址。跟 `/follow-stream` 同一条规矩:服务端只取账本里已有的地址,绝不去取前端递过来的任意 URL——那等于开一个任意地址抓取的口子。 */const linkMarkUrl=link=>`/link-mark?id=${encodeURIComponent(link.link_id ?? '')}`;-/* 有品牌标记的主机连 favicon 都不取。+/* 图标库里有的常见社媒走内联品牌标记,连 favicon 都不取。- favicon 是别人服务器上的一张小位图:X 直接挡掉爬取(资料页那个空白白圆就是它),- 取到的也多是 16×16,放进 32 px 的圆里必然糊。内联 SVG 没有这两个问题,还省一次- 跨站请求。x.com 一家就占了账本里 793 条外链中的 378 条;Instagram 的 favicon 同样被挡,- 资料页上只剩一只地球,这两个是按量进来的。- Threads 是另一种理由:它给得出图,给的是 iOS 应用图标那种圆角方图,四边一圈高光是- 照着方角画的,裁成圆之后沿着圆周露出一道白。这种图 `/link-mark` 只能原样用——那圈- 高光是人家设计的一部分,抠不掉。- 其余继续走 favicon:字形图标合成出来的品牌色圆底本来就好看,不为个位数的链接各配一枚。 */+ favicon 是别人服务器上的一张小位图:X 和 Instagram 直接挡掉爬取,资料页上只剩一只+ 地球;取得到的也多是 16×16,放进 32 px 的圆里必然糊。站点自己给的大图又是另一种坏+ 法——Threads、TikTok 给的是 iOS 应用图标那种圆角方图,四边一圈高光照着方角画,裁成圆+ 之后沿圆周露出一道白,而那圈高光是人家设计的一部分,`/link-mark` 抠不掉。内联 SVG+ 两样都没有,还省一次跨站请求,场色是品牌自己的那块、不跟着主题走。+ 名单按图标库的覆盖面定,不按链接条数:Phosphor 有这七家的字形,一家一枚配齐;库里+ 没有的(livedoor、ameblo、lit.link、pub.linx.live 这类)继续走 `/link-mark`,那边按+ 站点自己的图标合成品牌色圆底。 */const BRAND_ICONS=[[['x.com','twitter.com'],'brand-x'],[['instagram.com'],'brand-instagram'],- [['threads.com','threads.net'],'brand-threads']];+ [['threads.com','threads.net'],'brand-threads'],[['tiktok.com'],'brand-tiktok'],+ [['youtube.com','youtu.be'],'brand-youtube'],[['facebook.com','fb.com'],'brand-facebook'],+ [['linktr.ee','linktree.com'],'brand-linktree']];const brandIcon=url=>{try{const host=new URL(url).hostname.replace(/^www\./,'').toLowerCase();return BRAND_ICONS.find(([hosts])=>hosts.some(d=>host===d||host.endsWith('.'+d)))?.[1]||'';diff --git a/web/vendor/lucide-ORIGIN.md b/web/vendor/lucide-ORIGIN.mdindex 28d207d5c..5421226c3 100644--- a/web/vendor/lucide-ORIGIN.md+++ b/web/vendor/lucide-ORIGIN.md@@ -5,5 +5,5 @@- 许可证:ISC;原文见 `lucide-LICENSE.txt`- 消费者:`web/index.html` 内联的 115 个 symbol-雪碧图里另有 9 枚自绘 symbol(shuffle、alert、pics、jav、theater-enter、theater-exit、brand-x、brand-instagram、brand-threads)与 16 枚 player-* 前缀的播放器图标,都没有上游可对。+雪碧图里另有 6 枚自绘 symbol(shuffle、alert、pics、jav、theater-enter、theater-exit)与 16 枚 player-* 前缀的播放器图标,都没有上游可对。RSS 与拖动点保留填充修正,避免小圆点在全局描边样式下消失。diff --git a/web/vendor/phosphor-ORIGIN.md b/web/vendor/phosphor-ORIGIN.mdindex c43346740..7504e3fb3 100644--- a/web/vendor/phosphor-ORIGIN.md+++ b/web/vendor/phosphor-ORIGIN.md@@ -3,7 +3,8 @@- npm 包:`@phosphor-icons/[email protected]`- npm lock integrity:`sha512-v4ARvrip4qBCImOE5rmPUylOEK4iiED9ZyKjcvzuezqMaiRASCHKcRIuvvxL/twvLpkfnEODCOJp5dM4eZilxQ==`- 许可证:MIT;原文见 `phosphor-LICENSE.txt`-- 消费者:`web/index.html` 内联的 2 个 regular 权重 symbol+- 消费者:`web/index.html` 内联的 2 个 regular 权重 symbol,外加 7 枚社媒品牌标记(x-logo、instagram-logo、threads-logo、tiktok-logo、youtube-logo、facebook-logo、linktree-logo)只在描边画法说不清那件事时才用这一套:`text-aa` 是字母表,`playlist` 是播放列表。填充声明写在 symbol 上,压住全局的 `stroke:currentColor;fill:none`。+品牌标记另走一条路:字形留白、压在各家自己那块场色的圆盘上,缩放写在外面一层 `<g>` 上。