Skip to content

Commit

Permalink
switch to google favicon api
Browse files Browse the repository at this point in the history
  • Loading branch information
georg-stone committed Oct 14, 2024
1 parent a589330 commit 4aa4865
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/app/discover/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import { Button } from "@/components/ui/button";
import { ModeToggle } from "@/components/ui/dark-toggle";
import { ChevronLeft } from "lucide-react";
import { Home } from "lucide-react";
import { SettingsIcon } from "lucide-react";
import Link from "next/link";

let data = {
tech: [
Expand Down
2 changes: 1 addition & 1 deletion src/app/onboarding/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function App() {
id={index}
/>
<label htmlFor={index} className="select-none">
{feed.title} <Link href={feed.visitURL}>(visit)</Link>
{feed.title} <a href={feed.visitURL}>(visit)</a>
</label>
</div>
))}
Expand Down
23 changes: 14 additions & 9 deletions src/app/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ export default function Home() {
: "";

let feedIcon = xmlDoc.querySelector("link")
? `https://logo.clearbit.com/${encodeURIComponent(
xmlDoc.querySelector("link")?.getAttribute("href")?.split("/")[2]
)}`
: `https://logo.clearbit.com/${encodeURIComponent(
xmlDoc.url.split("/")[2]
)}`;
? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(
xmlDoc.querySelector("link")?.getAttribute("href")?.split("/")[2] ||
url.split("/")[2]
)}&sz=32`
: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(
url.split("/")[2]
)}&sz=32`;
feed.title = feedTitle;
feed.feedURL = url;
feed.icon = feedIcon;
Expand Down Expand Up @@ -107,7 +108,9 @@ export default function Home() {
?.getAttribute("url") ||
(placeholder.querySelector("img")
? placeholder.querySelector("img").src
: `https://logo.clearbit.com/${new URL(link).hostname}`);
: `https://www.google.com/s2/favicons?domain=${
new URL(link).hostname
}&sz=128`);
} else {
placeholder.innerHTML =
description ||
Expand All @@ -120,7 +123,9 @@ export default function Home() {
item
.getElementsByTagName("media:thumbnail")[0]
?.getAttribute("url") ||
`https://logo.clearbit.com/${new URL(link).hostname}`;
`https://www.google.com/s2/favicons?domain=${
new URL(link).hostname
}&sz=128`;
}

let pubDate = item.querySelector("pubDate, published")
Expand Down Expand Up @@ -276,7 +281,7 @@ export default function Home() {
title: "History",
type: "articles",
feedURL: "history",
icon: "https://logo.clearbit.com/feedbomb.app",
icon: "https://www.google.com/s2/favicons?domain=feedbomb.app&sz=32",
items: [],
};
for (let i = 0; i < readHistory.length; i++) {
Expand Down

0 comments on commit 4aa4865

Please sign in to comment.