diff --git a/src/locales/de-DE/translation.json b/src/locales/de-DE/translation.json index 2140ba9b8..eec855cac 100644 --- a/src/locales/de-DE/translation.json +++ b/src/locales/de-DE/translation.json @@ -598,8 +598,10 @@ "favicon_service": "Favicon-Dienst", "favicon_service_desc": "Dienst zum Abrufen von Website-Symbolen auswählen", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "Lokal abrufen", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "Lokal abrufen", "editor": { "show_script_list": "Skriptliste anzeigen", "hide_script_list": "Skriptliste ausblenden" diff --git a/src/locales/en-US/translation.json b/src/locales/en-US/translation.json index c4546e631..adfc25758 100644 --- a/src/locales/en-US/translation.json +++ b/src/locales/en-US/translation.json @@ -598,8 +598,10 @@ "favicon_service": "Favicon Service", "favicon_service_desc": "Choose the service for fetching website icons", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "Local Fetch", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "Local Fetch", "editor": { "show_script_list": "Show Script List", "hide_script_list": "Hide Script List" diff --git a/src/locales/ja-JP/translation.json b/src/locales/ja-JP/translation.json index 15da6c833..f02ab5c34 100644 --- a/src/locales/ja-JP/translation.json +++ b/src/locales/ja-JP/translation.json @@ -598,8 +598,10 @@ "favicon_service": "Favicon サービス", "favicon_service_desc": "ウェブサイトアイコンの取得サービスを選択", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "ローカル取得", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "ローカル取得", "editor": { "show_script_list": "スクリプトリストを表示", "hide_script_list": "スクリプトリストを非表示" diff --git a/src/locales/ru-RU/translation.json b/src/locales/ru-RU/translation.json index dde675983..1607c3c57 100644 --- a/src/locales/ru-RU/translation.json +++ b/src/locales/ru-RU/translation.json @@ -598,8 +598,10 @@ "favicon_service": "Сервис Favicon", "favicon_service_desc": "Выберите сервис для получения значков сайтов", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "Локальное получение", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "Локальное получение", "editor": { "show_script_list": "Показать список скриптов", "hide_script_list": "Скрыть список скриптов" diff --git a/src/locales/vi-VN/translation.json b/src/locales/vi-VN/translation.json index 82ba4fa8d..bca7992c6 100644 --- a/src/locales/vi-VN/translation.json +++ b/src/locales/vi-VN/translation.json @@ -598,8 +598,10 @@ "favicon_service": "Dịch vụ Favicon", "favicon_service_desc": "Chọn dịch vụ để lấy biểu tượng trang web", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "Lấy cục bộ", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "Lấy cục bộ", "editor": { "show_script_list": "Hiển thị danh sách script", "hide_script_list": "Ẩn danh sách script" diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json index 1dc717a82..be595b6cd 100644 --- a/src/locales/zh-CN/translation.json +++ b/src/locales/zh-CN/translation.json @@ -598,8 +598,10 @@ "favicon_service": "图标服务", "favicon_service_desc": "选择获取网站图标的服务", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "本地获取", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "本地获取", "editor": { "show_script_list": "显示脚本列表", "hide_script_list": "隐藏脚本列表" diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json index 4480a1c12..9b4a48477 100644 --- a/src/locales/zh-TW/translation.json +++ b/src/locales/zh-TW/translation.json @@ -598,8 +598,10 @@ "favicon_service": "圖示服務", "favicon_service_desc": "選擇取得網站圖示的服務", "favicon_service_scriptcat": "ScriptCat", - "favicon_service_local": "本地取得", "favicon_service_google": "Google", + "favicon_service_duckduckgo": "DuckDuckGo", + "favicon_service_icon-horse": "Icon Horse", + "favicon_service_local": "本地取得", "editor": { "show_script_list": "顯示腳本列表", "hide_script_list": "隱藏腳本列表" diff --git a/src/pages/options/routes/Setting.tsx b/src/pages/options/routes/Setting.tsx index 0ac87c935..e2ec472dc 100644 --- a/src/pages/options/routes/Setting.tsx +++ b/src/pages/options/routes/Setting.tsx @@ -338,6 +338,8 @@ function Setting() { > {t("favicon_service_scriptcat")} {t("favicon_service_google")} + {t("favicon_service_duckduckgo")} + {t("favicon_service_icon-horse")} {t("favicon_service_local")} diff --git a/src/pages/store/favicons.ts b/src/pages/store/favicons.ts index feb2da4df..21c86e8f3 100644 --- a/src/pages/store/favicons.ts +++ b/src/pages/store/favicons.ts @@ -195,16 +195,71 @@ export async function fetchIconByDomain(domain: string): Promise { } /** - * 根据服务类型获取favicon URL列表 + * 根据服务类型获取 favicon URL 列表 + * + * 各服务说明(包含尺寸、限制、收费、国内可用性等): */ export async function fetchIconByService(domain: string, service: FaviconService): Promise { switch (service) { case "scriptcat": + /** + * ScriptCat 图标服务 + * - 尺寸:支持 sz 参数(如 16 / 32 / 64 / 128) + * - 限制:暂无公开限流说明,小规模使用稳定 + * - 收费:免费 + * - 中国访问:✅ 国内可正常访问(国内服务) + * - 缓存:可长期缓存(返回稳定) + * - 特点:适合国内项目,速度快 + */ return [`https://ext.scriptcat.org/api/v1/open/favicons?domain=${encodeURIComponent(domain)}&sz=64`]; + case "google": + /** + * Google S2 Favicon 服务 + * - 尺寸:支持 sz=16~256(常用 16/32/64) + * - 限制:无官方文档,存在隐性限流 + * - 收费:免费 + * - 中国访问:⚠️ 基本不可用 + * - 缓存:强烈建议缓存(避免请求失败) + * - 特点:质量高,命中率高 + */ return [`https://www.google.com/s2/favicons?domain=${encodeURIComponent(domain)}&sz=64`]; + + case "duckduckgo": + /** + * DuckDuckGo 图标服务 + * - 尺寸:固定(通常 64x64 或 ico 原始尺寸) + * - 限制:无官方说明 + * - 收费:免费 + * - 中国访问:⚠️ 不稳定 / 偶尔失败 + * - 缓存:建议缓存 + * - 特点:简单直接,返回 ico + */ + return [`https://icons.duckduckgo.com/ip3/${encodeURI(domain)}.ico`]; + + case "icon-horse": + /** + * Icon Horse + * - 尺寸:自动适配(返回较高清 ico) + * - 限制:未公开限流策略 + * - 收费:免费(轻量使用) + * - 中国访问:⚠️ 较慢或不稳定 + * - 缓存:建议缓存 + * - 特点:质量较好,支持 fallback + */ + return [`https://icon.horse/icon/${encodeURI(domain)}`]; + case "local": default: + /** + * 本地解析 favicon + * - 尺寸:取决于网站(可能多尺寸) + * - 限制:需要自行实现抓取逻辑 + * - 收费:无(本地逻辑) + * - 中国访问:✅ 完全可控 + * - 缓存:强烈建议缓存 + * - 特点:最可靠但实现成本高 + */ return await fetchIconByDomain(domain); } } diff --git a/src/pkg/config/config.ts b/src/pkg/config/config.ts index b569c7284..c7a48576e 100644 --- a/src/pkg/config/config.ts +++ b/src/pkg/config/config.ts @@ -20,7 +20,7 @@ export type CloudSyncConfig = { params: { [key: string]: any }; }; -export type FaviconService = "scriptcat" | "local" | "google"; +export type FaviconService = "scriptcat" | "google" | "duckduckgo" | "icon-horse" | "local"; export type CATFileStorage = { filesystem: FileSystemType;