Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/locales/de-DE/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/locales/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/locales/ja-JP/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "スクリプトリストを非表示"
Expand Down
4 changes: 3 additions & 1 deletion src/locales/ru-RU/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Скрыть список скриптов"
Expand Down
4 changes: 3 additions & 1 deletion src/locales/vi-VN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "隐藏脚本列表"
Expand Down
4 changes: 3 additions & 1 deletion src/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "隱藏腳本列表"
Expand Down
2 changes: 2 additions & 0 deletions src/pages/options/routes/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ function Setting() {
>
<Select.Option value="scriptcat">{t("favicon_service_scriptcat")}</Select.Option>
<Select.Option value="google">{t("favicon_service_google")}</Select.Option>
<Select.Option value="duckduckgo">{t("favicon_service_duckduckgo")}</Select.Option>
<Select.Option value="icon-horse">{t("favicon_service_icon-horse")}</Select.Option>
<Select.Option value="local">{t("favicon_service_local")}</Select.Option>
</Select>
</div>
Expand Down
57 changes: 56 additions & 1 deletion src/pages/store/favicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,71 @@ export async function fetchIconByDomain(domain: string): Promise<string[]> {
}

/**
* 根据服务类型获取favicon URL列表
* 根据服务类型获取 favicon URL 列表
*
* 各服务说明(包含尺寸、限制、收费、国内可用性等):
*/
export async function fetchIconByService(domain: string, service: FaviconService): Promise<string[]> {
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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading