Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: stop favicon requests for private link hosts on web and mobile #5838

Mergedfe-franco(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/5838/headmerged by juliusmarminge View on GitHub

Showing 10 changed files with 46 additions and 153 deletions (loading 7).

x
0 of 10 viewed, 10 left
8 additions and 4 deletionsapps/mobile/src/features/threads/ThreadFeed.tsxModified
View file
@@ -86,6 +86,7 @@
import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
import { downloadAndShareAttachment } from "../../lib/attachmentDownload";
import { hasWideMarkdownBlock } from "../../lib/wideMarkdownBlocks";
+import { faviconUrlForOrigin } from "@t3tools/shared/favicon";
import {
hasNativeSelectableMarkdownText,
SelectableMarkdownText,
@@ -596,7 +597,8 @@
readonly href: string;
readonly onPress: (href: string) => void;
}) {
- const [failed, setFailed] = useState(() => failedMarkdownFaviconHosts.has(props.host));
+ const [failedHost, setFailedHost] = useState<string | null>(null);
+ const faviconUrl = faviconUrlForOrigin(`https://${props.host}`);
​
return (
<NativeText
@@ -607,15 +609,17 @@
textDecorationLine: "none",
- {!failed ? (
+ {faviconUrl !== null &&
+ failedHost !== props.host &&
+ !failedMarkdownFaviconHosts.has(props.host) ? (
<Image
source={{