Skip to content

Commit

Permalink
fix: use yandex favicon service behind imageProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Aug 11, 2024
1 parent ec515a3 commit d4430be
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
11 changes: 6 additions & 5 deletions apps/web/src/lib/components/FilterCombobox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Checkbox } from "$lib/components/ui/checkbox"
import * as Command from "$lib/components/ui/command"
import * as Popover from "$lib/components/ui/popover"
import { PUBLIC_WORKER_URL } from "$env/static/public"
const {
data: inputData,
Expand Down Expand Up @@ -33,11 +34,11 @@
variant="outline"
role="combobox"
aria-expanded={open}
class="justify-between w-[300px]"
class="w-[300px] justify-between"
>
{placeholder}
<svg
class="ml-2 w-4 h-4 opacity-50 shrink-0"
class="ml-2 h-4 w-4 shrink-0 opacity-50"
data-slot="icon"
fill="none"
stroke-width="1.5"
Expand All @@ -54,7 +55,7 @@
</svg>
</Button>
</Popover.Trigger>
<Popover.Content class="p-0 w-[300px]">
<Popover.Content class="w-[300px] p-0">
<Command.Root>
<Command.Input placeholder="Search.." />
<Command.Empty>No results</Command.Empty>
Expand All @@ -68,9 +69,9 @@
>
<Checkbox id={item.id} bind:checked={item.visible} />
<img
src={`https://favicon.yandex.net/favicon/${new URL(item.url).hostname}`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(item.url).hostname}`}
alt="URL Favicon"
class="m-2 rounded-full size-4"
class="size-4 m-2 rounded-full"
/>
<span class="truncate">{item.name}</span>
</Command.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<p class="line-clamp-2 pr-10 md:pr-0">{bookmark.desc}</p>
<div class="text-muted flex items-center justify-start gap-2 text-sm">
<img
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.im/${new URL(bookmark.url).hostname}?larger=true`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(bookmark.url).hostname}`}
alt="URL Favicon"
class="size-4 rounded-full"
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/components/feed-row/FeedRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<div class="text-muted mt-2 flex items-center justify-start gap-2 text-sm">
{#if feedEntry.link}
<img
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.im/${new URL(feedEntry.link).hostname}`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(feedEntry.link).hostname}`}
alt="URL Favicon"
class="size-4 rounded-full"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="flex w-64 flex-col gap-1">
<div class="flex justify-between">
<img
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.im/${new URL(item.url).hostname}`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(item.url).hostname}`}
alt="URL Favicon"
class="size-5 rounded-full"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<div class="flex w-64 flex-col gap-1 overflow-hidden">
<div class="flex justify-between">
<img
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.im/${new URL(item.link).hostname}`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(item.link).hostname}`}
alt="URL Favicon"
class="size-5 rounded-full"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
const faviconUrl = $derived.by(() => {
let iconUrl = ""
try {
iconUrl = `${PUBLIC_WORKER_URL}/img/_/https://favicon.im/${new URL($form.url as string).hostname}`
iconUrl = `${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL($form.url as string).hostname}`
} catch {
iconUrl = "https://raw.githubusercontent.com/hustcc/placeholder.js/master/favicon.ico"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { Feed } from "$lib/types/zod"
import type { PageServerLoad } from "./$types"
import { page } from "$app/stores"
import { PUBLIC_WORKER_URL } from "$env/static/public"
const ui = useInterface()
Expand Down Expand Up @@ -44,7 +45,7 @@
<label for={new URL(feed.url).host} class="flex items-center justify-start gap-2">
<span> {new URL(feed.url).host} </span>
<img
src={`https://favicon.yandex.net/favicon/${new URL(feed.url).hostname}`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(feed.url).hostname}`}
alt="URL Favicon"
class="size-6 rounded-full"
/>
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/routes/(dashboard)/feeds/FilterBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import * as Popover from "$lib/components/ui/popover"
import { useInterface } from "$lib/state/ui.svelte"
import { page } from "$app/stores"
import { PUBLIC_WORKER_URL } from "$env/static/public"
const ui = useInterface()
let open = $state(false)
Expand Down Expand Up @@ -68,7 +69,7 @@
>
<span class="mx-2 flex-grow truncate">{feed.name}</span>
<img
src={`https://favicon.yandex.net/favicon/${new URL(feed.url).hostname}`}
src={`${PUBLIC_WORKER_URL}/img/_/https://favicon.yandex.net/favicon/${new URL(feed.url).hostname}`}
alt="URL Favicon"
class="size-5 m-2 rounded-full"
/>
Expand Down

0 comments on commit d4430be

Please sign in to comment.