feat: update favicon retrieval to use a centralized service URL for consistency across the application

This commit is contained in:
Usman Baig
2026-02-22 21:02:11 +01:00
parent b88a31c612
commit 39eac4100e
5 changed files with 14 additions and 4 deletions

View File

@@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- **Organization context switch.** Switching away from a deleted organization now stores the session correctly instead of using an insecure fallback.
- **Removed debug logs.** Auth and organization-switching details no longer leak into the browser console in production. Error logs are now also suppressed in production and only appear during development.
- **Dark mode uptime chart.** The response time chart on the uptime page now correctly follows your dark mode preference instead of always showing a white tooltip background.
- **Onboarding form limits.** The welcome page now enforces the same character limits as the rest of the app.
## [0.10.0-alpha] - 2026-02-21

View File

@@ -1,4 +1,5 @@
import type { Metadata } from 'next'
import { FAVICON_SERVICE_URL } from '@/lib/utils/icons'
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8082'
@@ -46,7 +47,7 @@ export async function generateMetadata({ params }: SharePageParams): Promise<Met
siteName: 'Pulse by Ciphera',
type: 'website',
images: [{
url: `https://www.google.com/s2/favicons?domain=${domain}&sz=128`,
url: `${FAVICON_SERVICE_URL}?domain=${domain}&sz=128`,
width: 128,
height: 128,
alt: `${domain} favicon`,

View File

@@ -17,6 +17,7 @@ import PerformanceStats from '@/components/dashboard/PerformanceStats'
import { Select, DatePicker as DatePickerModal, Captcha, DownloadIcon, ZapIcon } from '@ciphera-net/ui'
import { DashboardSkeleton, useMinimumLoading } from '@/components/skeletons'
import ExportModal from '@/components/dashboard/ExportModal'
import { FAVICON_SERVICE_URL } from '@/lib/utils/icons'
// Helper to get date ranges
const getDateRange = (days: number) => {
@@ -286,7 +287,7 @@ export default function PublicDashboardPage() {
</div>
<h1 className="text-2xl font-bold text-neutral-900 dark:text-white flex items-center gap-3">
<Image
src={`https://www.google.com/s2/favicons?domain=${site.domain}&sz=64`}
src={`${FAVICON_SERVICE_URL}?domain=${site.domain}&sz=64`}
alt={site.name}
width={32}
height={32}

View File

@@ -7,6 +7,7 @@ import type { Stats } from '@/lib/api/stats'
import { formatNumber } from '@ciphera-net/ui'
import { BarChartIcon, SettingsIcon, BookOpenIcon, ExternalLinkIcon, Button } from '@ciphera-net/ui'
import { useAuth } from '@/lib/auth/context'
import { FAVICON_SERVICE_URL } from '@/lib/utils/icons'
export type SiteStatsMap = Record<string, { stats: Stats }>
@@ -36,7 +37,7 @@ function SiteCard({ site, stats, statsLoading, onDelete, canDelete }: SiteCardPr
<div className="flex items-center gap-4">
<div className="h-12 w-12 overflow-hidden rounded-lg border border-neutral-100 bg-neutral-50 p-1 dark:border-neutral-800 dark:bg-neutral-800">
<Image
src={`https://www.google.com/s2/favicons?domain=${site.domain}&sz=64`}
src={`${FAVICON_SERVICE_URL}?domain=${site.domain}&sz=64`}
alt={site.name}
width={40}
height={40}

View File

@@ -1,4 +1,10 @@
import React from 'react'
/**
* Google's public favicon service base URL.
* Append `?domain=<host>&sz=<px>` to get a favicon.
*/
export const FAVICON_SERVICE_URL = 'https://www.google.com/s2/favicons'
import {
FaChrome,
FaFirefox,
@@ -197,7 +203,7 @@ export function getReferrerFavicon(referrer: string): string | null {
try {
const url = new URL(referrer.startsWith('http') ? referrer : `https://${referrer}`)
if (REFERRER_USE_X_ICON.has(url.hostname.toLowerCase())) return null
return `https://www.google.com/s2/favicons?domain=${url.hostname}&sz=32`
return `${FAVICON_SERVICE_URL}?domain=${url.hostname}&sz=32`
} catch {
return null
}