From 253372001481c71e710eb8c8167a9bc80b080c09 Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 16 Jan 2026 11:15:25 +0900 Subject: [PATCH] fix favicon --- .gitignore | 1 + src/components/atbrowser.ts | 6 +++--- src/components/services.ts | 6 +++--- src/lib/api.ts | 8 +++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 0062c02..1952264 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist node_modules package-lock.json repos +claude.md diff --git a/src/components/atbrowser.ts b/src/components/atbrowser.ts index 3b1a58e..7a27eeb 100644 --- a/src/components/atbrowser.ts +++ b/src/components/atbrowser.ts @@ -36,14 +36,14 @@ async function renderServices(did: string, handle: string): Promise { } // Group by service domain - const serviceMap = new Map() + const serviceMap = new Map() for (const col of collections) { const info = getServiceInfo(col) if (info) { const key = info.domain if (!serviceMap.has(key)) { - serviceMap.set(key, { name: info.name, favicon: info.favicon, count: 0 }) + serviceMap.set(key, { name: info.name, favicon: info.favicon, faviconFallback: info.faviconFallback, count: 0 }) } serviceMap.get(key)!.count++ } @@ -53,7 +53,7 @@ async function renderServices(did: string, handle: string): Promise { return `
  • - + ${info.name} ${info.count} diff --git a/src/components/services.ts b/src/components/services.ts index 3cb3c8d..9226864 100644 --- a/src/components/services.ts +++ b/src/components/services.ts @@ -9,14 +9,14 @@ export async function renderServices(handle: string): Promise { } // Group by service - const serviceMap = new Map() + const serviceMap = new Map() for (const col of collections) { const info = getServiceInfo(col) if (info) { const key = info.domain if (!serviceMap.has(key)) { - serviceMap.set(key, { name: info.name, favicon: info.favicon, collections: [] }) + serviceMap.set(key, { name: info.name, favicon: info.favicon, faviconFallback: info.faviconFallback, collections: [] }) } serviceMap.get(key)!.collections.push(col) } @@ -27,7 +27,7 @@ export async function renderServices(handle: string): Promise { return ` - + ${info.name} ` diff --git a/src/lib/api.ts b/src/lib/api.ts index 8eaf895..3a4a4bd 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -307,14 +307,15 @@ export async function searchPostsForUrl(url: string): Promise { return allPosts } -export function getServiceInfo(collection: string): { name: string; domain: string; favicon: string } | null { +export function getServiceInfo(collection: string): { name: string; domain: string; favicon: string; faviconFallback: string } | null { // Try to find matching service prefix for (const [prefix, info] of Object.entries(SERVICE_MAP)) { if (collection.startsWith(prefix)) { return { name: info.domain, domain: info.domain, - favicon: info.icon || `https://www.google.com/s2/favicons?domain=${info.domain}&sz=32` + favicon: `/favicons/${info.domain}.png`, + faviconFallback: info.icon || `https://www.google.com/s2/favicons?domain=${info.domain}&sz=32` } } } @@ -326,7 +327,8 @@ export function getServiceInfo(collection: string): { name: string; domain: stri return { name: domain, domain: domain, - favicon: `https://www.google.com/s2/favicons?domain=${domain}&sz=32` + favicon: `/favicons/${domain}.png`, + faviconFallback: `https://www.google.com/s2/favicons?domain=${domain}&sz=32` } }