fix favicon
This commit is contained in:
@@ -36,14 +36,14 @@ async function renderServices(did: string, handle: string): Promise<string> {
|
||||
}
|
||||
|
||||
// Group by service domain
|
||||
const serviceMap = new Map<string, { name: string; favicon: string; count: number }>()
|
||||
const serviceMap = new Map<string, { name: string; favicon: string; faviconFallback: string; count: number }>()
|
||||
|
||||
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<string> {
|
||||
return `
|
||||
<li class="service-list-item">
|
||||
<a href="/at/${handle}/${domain}" class="service-list-link">
|
||||
<img src="${info.favicon}" class="service-list-favicon" alt="" onerror="this.style.display='none'">
|
||||
<img src="${info.favicon}" class="service-list-favicon" alt="" onerror="this.src='${info.faviconFallback}'; this.onerror=null;">
|
||||
<span class="service-list-name">${info.name}</span>
|
||||
<span class="service-list-count">${info.count}</span>
|
||||
</a>
|
||||
|
||||
@@ -9,14 +9,14 @@ export async function renderServices(handle: string): Promise<string> {
|
||||
}
|
||||
|
||||
// Group by service
|
||||
const serviceMap = new Map<string, { name: string; favicon: string; collections: string[] }>()
|
||||
const serviceMap = new Map<string, { name: string; favicon: string; faviconFallback: string; collections: string[] }>()
|
||||
|
||||
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<string> {
|
||||
|
||||
return `
|
||||
<a href="${url}" class="service-item" title="${info.collections.join(', ')}">
|
||||
<img src="${info.favicon}" class="service-favicon" alt="" onerror="this.style.display='none'">
|
||||
<img src="${info.favicon}" class="service-favicon" alt="" onerror="this.src='${info.faviconFallback}'; this.onerror=null;">
|
||||
<span class="service-name">${info.name}</span>
|
||||
</a>
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user