diff --git a/packages/app/public/index.html b/packages/app/public/index.html index c45a4333..931a2590 100644 --- a/packages/app/public/index.html +++ b/packages/app/public/index.html @@ -8,7 +8,7 @@ + content="default-src 'self'; child-src 'none'; worker-src 'self'; frame-src youtube.com www.youtube.com https://platform.twitter.com https://embed.tidal.com https://w.soundcloud.com https://www.mixcloud.com https://open.spotify.com https://player.twitch.tv https://embed.music.apple.com https://nostrnests.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *; img-src * data:; font-src https://fonts.gstatic.com; media-src *; script-src 'self' 'wasm-unsafe-eval' https://static.cloudflareinsights.com https://platform.twitter.com https://embed.tidal.com;" /> diff --git a/packages/app/src/Const.ts b/packages/app/src/Const.ts index e6b3ea2d..7adbdf98 100644 --- a/packages/app/src/Const.ts +++ b/packages/app/src/Const.ts @@ -147,3 +147,8 @@ export const TwitchRegex = /twitch.tv\/([a-z0-9_]+$)/i; */ export const AppleMusicRegex = /music\.apple\.com\/([a-z]{2}\/)?(?:album|playlist)\/[\w\d-]+\/([.a-zA-Z0-9-]+)(?:\?i=\d+)?/i; + +/** + * Nostr Nests embed regex + */ +export const NostrNestsRegex = /nostrnests\.com\/[a-zA-Z0-9]+/i; diff --git a/packages/app/src/Element/HyperText.tsx b/packages/app/src/Element/HyperText.tsx index c03d18e8..ea495fc6 100644 --- a/packages/app/src/Element/HyperText.tsx +++ b/packages/app/src/Element/HyperText.tsx @@ -14,6 +14,7 @@ import { SpotifyRegex, TwitchRegex, AppleMusicRegex, + NostrNestsRegex, } from "Const"; import { RootState } from "State/Store"; import SoundCloudEmbed from "Element/SoundCloudEmded"; @@ -23,6 +24,7 @@ import TidalEmbed from "Element/TidalEmbed"; import { ProxyImg } from "Element/ProxyImg"; import TwitchEmbed from "Element/TwitchEmbed"; import AppleMusicEmbed from "Element/AppleMusicEmbed"; +import NostrNestsEmbed from "./NostrNestsEmbed"; export default function HyperText({ link, creator }: { link: string; creator: HexKey }) { const pref = useSelector((s: RootState) => s.login.preferences); @@ -67,6 +69,7 @@ export default function HyperText({ link, creator }: { link: string; creator: He const isSpotifyLink = SpotifyRegex.test(a); const isTwitchLink = TwitchRegex.test(a); const isAppleMusicLink = AppleMusicRegex.test(a); + const isNostrNestsLink = NostrNestsRegex.test(a); const extension = FileExtensionRegex.test(url.pathname.toLowerCase()) && RegExp.$1; if (extension && !isAppleMusicLink) { switch (extension) { @@ -133,6 +136,15 @@ export default function HyperText({ link, creator }: { link: string; creator: He return ; } else if (isAppleMusicLink) { return ; + } else if (isNostrNestsLink) { + return ( + <> + e.stopPropagation()} target="_blank" rel="noreferrer" className="ext"> + {a} + + + + ); } else { return ( e.stopPropagation()} target="_blank" rel="noreferrer" className="ext"> diff --git a/packages/app/src/Element/NostrNestsEmbed.tsx b/packages/app/src/Element/NostrNestsEmbed.tsx new file mode 100644 index 00000000..f858d840 --- /dev/null +++ b/packages/app/src/Element/NostrNestsEmbed.tsx @@ -0,0 +1,5 @@ +const NostrNestsEmbed = ({ link }: { link: string }) => ( + +); + +export default NostrNestsEmbed;