mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-18 19:41:48 +02:00
dont show open graph cards in user description
This commit is contained in:
@@ -45,5 +45,13 @@ export function renderVideoUrl(match: URL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function renderGenericUrl(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" />;
|
return <OpenGraphCard url={match} maxW="lg" />;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { replaceDomain } from "../../helpers/url";
|
import { replaceDomain } from "../../helpers/url";
|
||||||
import appSettings from "../../services/app-settings";
|
import appSettings from "../../services/app-settings";
|
||||||
import { TweetEmbed } from "../tweet-embed";
|
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
|
// 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"];
|
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;
|
if (!TWITTER_DOMAINS.includes(match.hostname)) return null;
|
||||||
|
|
||||||
const { twitterRedirect } = appSettings.value;
|
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} />;
|
else return <TweetEmbed href={match.toString()} conversation={false} />;
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,6 @@ import {
|
|||||||
embedNostrHashtags,
|
embedNostrHashtags,
|
||||||
renderWavlakeUrl,
|
renderWavlakeUrl,
|
||||||
renderYoutubeUrl,
|
renderYoutubeUrl,
|
||||||
renderGenericUrl,
|
|
||||||
renderImageUrl,
|
renderImageUrl,
|
||||||
renderTwitterUrl,
|
renderTwitterUrl,
|
||||||
renderAppleMusicUrl,
|
renderAppleMusicUrl,
|
||||||
@@ -19,6 +18,7 @@ import {
|
|||||||
renderTidalUrl,
|
renderTidalUrl,
|
||||||
renderVideoUrl,
|
renderVideoUrl,
|
||||||
embedEmoji,
|
embedEmoji,
|
||||||
|
renderOpenGraphUrl,
|
||||||
} from "../embed-types";
|
} from "../embed-types";
|
||||||
import { ImageGalleryProvider } from "../image-gallery";
|
import { ImageGalleryProvider } from "../image-gallery";
|
||||||
import { useTrusted } from "./trust";
|
import { useTrusted } from "./trust";
|
||||||
@@ -38,7 +38,7 @@ function buildContents(event: NostrEvent | DraftNostrEvent, trusted = false) {
|
|||||||
renderTidalUrl,
|
renderTidalUrl,
|
||||||
renderImageUrl,
|
renderImageUrl,
|
||||||
renderVideoUrl,
|
renderVideoUrl,
|
||||||
renderGenericUrl,
|
renderOpenGraphUrl,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// bitcoin
|
// bitcoin
|
||||||
|
@@ -9,5 +9,5 @@ export default function useOpenGraphData(url: URL) {
|
|||||||
return extractMetaTags(html);
|
return extractMetaTags(html);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
return null;
|
return null;
|
||||||
}, [url]);
|
}, [url.toString()]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user