Repository navigation
nav 图标选择器:Homarr 式按名搜图标(Dashboard/selfh.st/Simple 三源) - #28
Merged
todosdev[bot] merged 3 commits intoNov 5, 2026
Merged
Conversation
added 3 commits
November 5, 2026 20:35
Co-Authored-By: Claude Code <noreply@anthropic.com> Checkpoint: Uj84XlMcx5lJPgP59nNW1
Co-Authored-By: Claude Code <noreply@anthropic.com> Checkpoint: 8DgvaUYGlwnIFoEOA-GaR
Co-Authored-By: Claude Code <noreply@anthropic.com> Checkpoint: YZFgK_LcISvWsd70whCGy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
icon_url。/api/icon契约与 SiteIcon 回退链。变更
scripts/generate-icon-index.mjs(新增)拉三源索引(Dashboardmetadata.json/ selfh.stindex.json/ Simpledata/simple-icons.json@16)生成精简 JSON,SVG 优先、无 SVG 用 png/webp 降级在构建期解析进url;任一源拉取/解析失败则不写文件、退出码 0(保留上一份已提交索引),另有「200 + 空 JSON」退化阈值防护。web/package.json的build改为先生成索引再构建,让 CI 与部署两条路都刷新索引。web/public/icon-index.json(新增,9969 条:dashboard 3515 / selfhst 2987 / simple 3467,raw≈1.56MB)。构建脚本每次构建会重新生成它,提交的这份同时作为「上一份成功索引」的回退快照。web/src/lib/icon-search.ts(新增)slugify/loadIconIndex(惰性加载 + 失败不缓存可重试)/searchIcons(slug/name/aliases 命中,精确 > 前缀 > 包含,先匹配分后 source 优先级,避免单源截断别源命中)。web/src/components/admin/icon-picker.tsx(新增)IconPickerField组合现有AssetUploadField+Popover/Command,输入防抖约 300ms 出候选,SVG 结果带角标;web/src/components/ui/command.tsx与input-group.tsx(新增)为 canonical shadcn 组件(未手搓等价物);crud-panels.tsx仅链接图标字段换用IconPickerField,分类/搜索引擎图标字段不动。web/test/icon-search.test.ts与icon-picker.test.tsx(新增),覆盖归一、alias 命中、跨源 value 唯一、排序、失败重试、防抖出候选、清除恢复空值等。测试
pnpm lint(29 warnings / 0 errors)、pnpm format:check、pnpm typecheck、pnpm build全绿;全量 worker 151 + web 102 用例通过。icon-index.json未变(回退生效);模拟远端返回 200 + 空 JSON:退化阈值防护生效、退出码 0、索引哈希不变。data-value唯一、键盘可分别选中;索引加载失败后重开能重试并复位陈旧错误提示。