This commit is contained in:
2023-07-12 19:27:42 +01:00
parent 3b11f63573
commit 1ead1e4a7c
19 changed files with 663 additions and 537 deletions

View File

@ -1,7 +1,6 @@
import { TwitterTweetEmbed } from "react-twitter-embed";
import {
FileExtensionRegex,
YoutubeUrlRegex,
TweetUrlRegex,
TidalRegex,
@ -23,17 +22,14 @@ import AppleMusicEmbed from "Element/AppleMusicEmbed";
import WavlakeEmbed from "Element/WavlakeEmbed";
import LinkPreview from "Element/LinkPreview";
import NostrLink from "Element/NostrLink";
import RevealMedia from "Element/RevealMedia";
import MagnetLink from "Element/MagnetLink";
interface HypeTextProps {
link: string;
creator: string;
depth?: number;
disableMediaSpotlight?: boolean;
}
export default function HyperText({ link, creator, depth, disableMediaSpotlight }: HypeTextProps) {
export default function HyperText({ link, depth }: HypeTextProps) {
const a = link;
try {
const url = new URL(a);
@ -47,10 +43,7 @@ export default function HyperText({ link, creator, depth, disableMediaSpotlight
const isAppleMusicLink = AppleMusicRegex.test(a);
const isNostrNestsLink = NostrNestsRegex.test(a);
const isWavlakeLink = WavlakeRegex.test(a);
const extension = FileExtensionRegex.test(url.pathname.toLowerCase()) && RegExp.$1;
if (extension && !isAppleMusicLink) {
return <RevealMedia link={a} creator={creator} disableSpotlight={disableMediaSpotlight} />;
} else if (tweetId) {
if (tweetId) {
return (
<div className="tweet" key={tweetId}>
<TwitterTweetEmbed tweetId={tweetId} />