switch from logo.clearbit.com to logo.dev

This commit is contained in:
2025-04-02 22:40:46 +02:00
parent 96a3497aea
commit 9758f4bf45
5 changed files with 50 additions and 10 deletions
+6 -1
View File
@@ -6,6 +6,9 @@ import LinkFavicon from "./LinkFavicon";
export default async function CustomPageComponent(params: { customPage: CustomPage }) {
const customPage = params.customPage;
const token = process.env.LOGO_DEV_TOKEN;
const disableAttribution = process.env.DISABLE_ATTRIBUTION;
const linkBlocks = await prisma.linkBlock.findMany({
where: {
customPageUuid: customPage.uuid
@@ -50,7 +53,9 @@ export default async function CustomPageComponent(params: { customPage: CustomPa
className="text-slate-700 mt-10 fade-animated"
style={{ animationDelay: `${1.5 + linkBlocks.length * 0.1}s`, opacity: 0 }}
>
<a className="underline" target="blank" href="https://github.com/traberph/short">traberph/short</a> by me running on <a className="underline" href="https://k3s.io/" target="blank">K3s</a>
{disableAttribution ? null : <p className="text-center">powered by <a className="underline" target="blank" href="https://github.com/traberph/short">traberph/short</a></p>}
{token ? <p className="text-center">Logos provided by <a className="underline" href="https://logo.dev" alt="Logo API">Logo.dev</a></p> : ""}
</div>
</div>
);
+10 -1
View File
@@ -3,10 +3,19 @@ import Image from "next/image";
export default function LinkFavicon({ url }: { url: string }) {
const hostname = new URL(url).hostname;
const token = process.env.LOGO_DEV_TOKEN;
if (!token) {
const text = hostname.split(".")[0].charAt(0).toUpperCase();
return (
<span className="rounded-full w-8 h-8 flex items-center justify-center bg-gray-100 text-gray-600">
{text}
</span>
)
}
return (
<Image
src={`https://logo.clearbit.com/${hostname}?`}
src={`https://img.logo.dev/${hostname}?token=${token}`}
width={100}
height={100}
alt=" "