diff --git a/packages/app/src/Element/ProxyImg.tsx b/packages/app/src/Element/ProxyImg.tsx index 84200fef..8a7714bd 100644 --- a/packages/app/src/Element/ProxyImg.tsx +++ b/packages/app/src/Element/ProxyImg.tsx @@ -1,5 +1,6 @@ import useImgProxy from "Hooks/useImgProxy"; import { useEffect, useState } from "react"; +import { FormattedMessage } from "react-intl"; interface ProxyImgProps extends React.DetailedHTMLProps, HTMLImageElement> { size?: number; @@ -8,6 +9,8 @@ interface ProxyImgProps extends React.DetailedHTMLProps { const { src, size, ...rest } = props; const [url, setUrl] = useState(); + const [loadFailed, setLoadFailed] = useState(false); + const [bypass, setBypass] = useState(false); const { proxy } = useImgProxy(); useEffect(() => { @@ -17,5 +20,25 @@ export const ProxyImg = (props: ProxyImgProps) => { } }, [src]); - return ; + if (loadFailed) { + if (bypass) { + return ; + } + return ( +
{ + e.stopPropagation(); + setBypass(true); + }}> + +
+ ); + } + return setLoadFailed(true)} />; }; diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json index f4001a56..b04a7399 100644 --- a/packages/app/src/lang.json +++ b/packages/app/src/lang.json @@ -157,6 +157,9 @@ "5ykRmX": { "defaultMessage": "Send zap" }, + "65BmHb": { + "defaultMessage": "Failed to proxy image from {host}, click here to load directly" + }, "6Yfvvp": { "defaultMessage": "Get an identifier" }, diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index aa07b96b..22c9f91d 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -51,6 +51,7 @@ "5rOdPG": "Once you setup your key manager extension and generated a key, you can follow our new users flow to setup your profile and help you find some interesting people on Nostr to follow.", "5u6iEc": "Transfer to Pubkey", "5ykRmX": "Send zap", + "65BmHb": "Failed to proxy image from {host}, click here to load directly", "6Yfvvp": "Get an identifier", "6ewQqw": "Likes ({n})", "6uMqL1": "Unpaid", @@ -403,4 +404,4 @@ "zjJZBd": "You're ready!", "zonsdq": "Failed to load LNURL service", "zvCDao": "Automatically show latest notes" -} \ No newline at end of file +}