dont show open graph cards in user description

This commit is contained in:
hzrd149 2023-06-29 11:07:31 -05:00
parent af37c07656
commit c6b1cc3d33
4 changed files with 13 additions and 5 deletions

View File

@ -45,5 +45,13 @@ export function renderVideoUrl(match: URL) {
}
export function renderGenericUrl(match: URL) {
return (
<Link href={match.toString()} isExternal color="blue.500">
{match.toString()}
</Link>
);
}
export function renderOpenGraphUrl(match: URL) {
return <OpenGraphCard url={match} maxW="lg" />;
}

View File

@ -1,7 +1,7 @@
import { replaceDomain } from "../../helpers/url";
import appSettings from "../../services/app-settings";
import { TweetEmbed } from "../tweet-embed";
import { renderGenericUrl } from "./common";
import { renderOpenGraphUrl } from "./common";
// copied from https://github.com/SimonBrazell/privacy-redirect/blob/master/src/assets/javascripts/helpers/twitter.js
export const TWITTER_DOMAINS = ["twitter.com", "www.twitter.com", "mobile.twitter.com", "pbs.twimg.com"];
@ -10,6 +10,6 @@ export function renderTwitterUrl(match: URL) {
if (!TWITTER_DOMAINS.includes(match.hostname)) return null;
const { twitterRedirect } = appSettings.value;
if (twitterRedirect) return renderGenericUrl(replaceDomain(match, twitterRedirect));
if (twitterRedirect) return renderOpenGraphUrl(replaceDomain(match, twitterRedirect));
else return <TweetEmbed href={match.toString()} conversation={false} />;
}

View File

@ -11,7 +11,6 @@ import {
embedNostrHashtags,
renderWavlakeUrl,
renderYoutubeUrl,
renderGenericUrl,
renderImageUrl,
renderTwitterUrl,
renderAppleMusicUrl,
@ -19,6 +18,7 @@ import {
renderTidalUrl,
renderVideoUrl,
embedEmoji,
renderOpenGraphUrl,
} from "../embed-types";
import { ImageGalleryProvider } from "../image-gallery";
import { useTrusted } from "./trust";
@ -38,7 +38,7 @@ function buildContents(event: NostrEvent | DraftNostrEvent, trusted = false) {
renderTidalUrl,
renderImageUrl,
renderVideoUrl,
renderGenericUrl,
renderOpenGraphUrl,
]);
// bitcoin

View File

@ -9,5 +9,5 @@ export default function useOpenGraphData(url: URL) {
return extractMetaTags(html);
} catch (e) {}
return null;
}, [url]);
}, [url.toString()]);
}