mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-19 12:00:32 +02:00
Merge branch 'next'
This commit is contained in:
5
.changeset/cuddly-walls-fix.md
Normal file
5
.changeset/cuddly-walls-fix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"nostrudel": minor
|
||||
---
|
||||
|
||||
Add nostrapp.link option in profile and note menus
|
5
.changeset/quick-kiwis-peel.md
Normal file
5
.changeset/quick-kiwis-peel.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"nostrudel": minor
|
||||
---
|
||||
|
||||
add embeds for wavlake tracks
|
@@ -1,20 +0,0 @@
|
||||
import { EmbedableContent, embedJSX } from "../../helpers/embeds";
|
||||
|
||||
// note1tvqk2mu829yr6asf7w5dgpp8t0mlp2ax5t26ctfdx8m0ptkssamqsleeux
|
||||
// note1ygx9tec3af92704d92jwrj3zs7cws2jl29yvrlxzqlcdlykhwssqpupa7t
|
||||
export function embedAppleMusic(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
regexp: /https?:\/\/music\.apple\.com(?:\/[\+~%\/\.\w\-_]*)?(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\-\.\!\/\\\w]*))?/,
|
||||
render: (match) => (
|
||||
<iframe
|
||||
allow="encrypted-media *; fullscreen *; clipboard-write"
|
||||
frameBorder="0"
|
||||
height={match[0].includes("?i=") ? 175 : 450}
|
||||
style={{ width: "100%", maxWidth: "660px", overflow: "hidden", background: "transparent" }}
|
||||
// sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
|
||||
src={match[0].replace("music.apple.com", "embed.music.apple.com")}
|
||||
></iframe>
|
||||
),
|
||||
name: "Apple Music",
|
||||
});
|
||||
}
|
@@ -1,9 +1,6 @@
|
||||
export * from "./twitter";
|
||||
export * from "./lightning";
|
||||
export * from "./app-music";
|
||||
export * from "./music";
|
||||
export * from "./common";
|
||||
export * from "./spotify";
|
||||
export * from "./tidal";
|
||||
export * from "./youtube";
|
||||
export * from "./spotify";
|
||||
export * from "./nostr";
|
||||
|
75
src/components/embed-types/music.tsx
Normal file
75
src/components/embed-types/music.tsx
Normal file
@@ -0,0 +1,75 @@
|
||||
import { EmbedableContent, embedJSX } from "../../helpers/embeds";
|
||||
|
||||
export function embedWavlakeTrack(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
name: "Wavlake Track",
|
||||
regexp: /https?:\/\/wavlake\.com\/track\/[\w-]+/i,
|
||||
render: (match) => (
|
||||
<iframe
|
||||
loading="lazy"
|
||||
frameBorder="0"
|
||||
src={match[0].replace("wavlake.com", "embed.wavlake.com")}
|
||||
style={{ width: "100%", aspectRatio: 576 / 356, maxWidth: 573 }}
|
||||
></iframe>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
// note1tvqk2mu829yr6asf7w5dgpp8t0mlp2ax5t26ctfdx8m0ptkssamqsleeux
|
||||
// note1ygx9tec3af92704d92jwrj3zs7cws2jl29yvrlxzqlcdlykhwssqpupa7t
|
||||
export function embedAppleMusic(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
regexp: /https?:\/\/music\.apple\.com(?:\/[\+~%\/\.\w\-_]*)?(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\-\.\!\/\\\w]*))?/,
|
||||
render: (match) => (
|
||||
<iframe
|
||||
allow="encrypted-media *; fullscreen *; clipboard-write"
|
||||
frameBorder="0"
|
||||
height={match[0].includes("?i=") ? 175 : 450}
|
||||
style={{ width: "100%", maxWidth: "660px", overflow: "hidden", background: "transparent" }}
|
||||
// sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
|
||||
src={match[0].replace("music.apple.com", "embed.music.apple.com")}
|
||||
></iframe>
|
||||
),
|
||||
name: "Apple Music",
|
||||
});
|
||||
}
|
||||
|
||||
// nostr:nevent1qqs9r94qeqhqayvuz6q6u88spvuz0d25nhpyv0c39wympmfu646x4pgpz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3samnwvaz7tmjv4kxz7fwwdhx7un59eek7cmfv9kqmhxhvq
|
||||
export function embedSpotifyMusic(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
regexp:
|
||||
/https?:\/\/open\.spotify\.com\/(track|episode|album|playlist)\/(\w+)(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\-\.\!\/\\\w]*))?/im,
|
||||
render: (match) => {
|
||||
const isList = match[1] === "album" || match[1] === "playlist";
|
||||
return (
|
||||
<iframe
|
||||
style={{ borderRadius: "12px" }}
|
||||
width="100%"
|
||||
height={isList ? 400 : 152}
|
||||
title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix"
|
||||
frameBorder="0"
|
||||
allowFullScreen
|
||||
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
|
||||
loading="lazy"
|
||||
src={`https://open.spotify.com/embed/${match[1]}/${match[2]}`}
|
||||
></iframe>
|
||||
);
|
||||
},
|
||||
name: "Spotify",
|
||||
});
|
||||
}
|
||||
|
||||
// note132m5xc3zhj7fap67vzwx5x3s8xqgz49k669htcn8kppr4m654tuq960tuu
|
||||
export function embedTidalMusic(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
regexp: /https?:\/\/tidal\.com(\/browse)?\/(track|album)\/(\d+)/im,
|
||||
render: (match) => (
|
||||
<iframe
|
||||
src={`https://embed.tidal.com/${match[2]}s/${match[3]}?disableAnalytics=true`}
|
||||
width="100%"
|
||||
height={match[2] === "album" ? 400 : 96}
|
||||
></iframe>
|
||||
),
|
||||
name: "Tidal",
|
||||
});
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
import { EmbedableContent, embedJSX } from "../../helpers/embeds";
|
||||
|
||||
// nostr:nevent1qqs9r94qeqhqayvuz6q6u88spvuz0d25nhpyv0c39wympmfu646x4pgpz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3samnwvaz7tmjv4kxz7fwwdhx7un59eek7cmfv9kqmhxhvq
|
||||
export function embedSpotifyMusic(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
regexp:
|
||||
/https?:\/\/open\.spotify\.com\/(track|episode|album|playlist)\/(\w+)(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\-\.\!\/\\\w]*))?/im,
|
||||
render: (match) => {
|
||||
const isList = match[1] === "album" || match[1] === "playlist";
|
||||
return (
|
||||
<iframe
|
||||
style={{ borderRadius: "12px" }}
|
||||
width="100%"
|
||||
height={isList ? 400 : 152}
|
||||
title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix"
|
||||
frameBorder="0"
|
||||
allowFullScreen
|
||||
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
|
||||
loading="lazy"
|
||||
src={`https://open.spotify.com/embed/${match[1]}/${match[2]}`}
|
||||
></iframe>
|
||||
);
|
||||
},
|
||||
name: "Spotify",
|
||||
});
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
import { EmbedableContent, embedJSX } from "../../helpers/embeds";
|
||||
|
||||
// note132m5xc3zhj7fap67vzwx5x3s8xqgz49k669htcn8kppr4m654tuq960tuu
|
||||
export function embedTidalMusic(content: EmbedableContent) {
|
||||
return embedJSX(content, {
|
||||
regexp: /https?:\/\/tidal\.com(\/browse)?\/(track|album)\/(\d+)/im,
|
||||
render: (match) => (
|
||||
<iframe
|
||||
src={`https://embed.tidal.com/${match[2]}s/${match[3]}?disableAnalytics=true`}
|
||||
width="100%"
|
||||
height={match[2] === "album" ? 400 : 96}
|
||||
></iframe>
|
||||
),
|
||||
name: "Tidal",
|
||||
});
|
||||
}
|
@@ -19,6 +19,7 @@ import {
|
||||
embedNostrMentions,
|
||||
embedAppleMusic,
|
||||
embedNostrHashtags,
|
||||
embedWavlakeTrack,
|
||||
} from "../embed-types";
|
||||
import { ImageGalleryProvider } from "../image-gallery";
|
||||
import { useTrusted } from "./trust";
|
||||
@@ -31,6 +32,7 @@ function buildContents(event: NostrEvent | DraftNostrEvent, trusted = false) {
|
||||
content = embedYoutubeVideo(content);
|
||||
content = embedYoutubePlaylist(content);
|
||||
content = embedYoutubeMusic(content);
|
||||
content = embedWavlakeTrack(content);
|
||||
content = embedTidalMusic(content);
|
||||
content = embedAppleMusic(content);
|
||||
content = embedSpotifyMusic(content);
|
||||
|
@@ -18,7 +18,7 @@ import { Bech32Prefix, getSharableNoteId, normalizeToBech32 } from "../../helper
|
||||
import { NostrEvent } from "../../types/nostr-event";
|
||||
import { MenuIconButton, MenuIconButtonProps } from "../menu-icon-button";
|
||||
|
||||
import { ClipboardIcon, CodeIcon, LikeIcon, RepostIcon, TrashIcon } from "../icons";
|
||||
import { ClipboardIcon, CodeIcon, ExternalLinkIcon, LikeIcon, RepostIcon, TrashIcon } from "../icons";
|
||||
import NoteReactionsModal from "./note-zaps-modal";
|
||||
import NoteDebugModal from "../debug-modals/note-debug-modal";
|
||||
import { useCurrentAccount } from "../../hooks/use-current-account";
|
||||
@@ -68,6 +68,12 @@ export const NoteMenu = ({ event, ...props }: { event: NostrEvent } & Omit<MenuI
|
||||
<MenuItem onClick={reactionsModal.onOpen} icon={<LikeIcon />}>
|
||||
Zaps/Reactions
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => window.open(`https://nostrapp.link/#${getSharableNoteId(event.id)}?select=true`, "_blank")}
|
||||
icon={<ExternalLinkIcon />}
|
||||
>
|
||||
View in app...
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => copyToClipboard("nostr:" + getSharableNoteId(event.id))} icon={<RepostIcon />}>
|
||||
Copy Share Link
|
||||
</MenuItem>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { MenuItem, useDisclosure } from "@chakra-ui/react";
|
||||
import { MenuIconButton, MenuIconButtonProps } from "../../../components/menu-icon-button";
|
||||
|
||||
import { ClipboardIcon, CodeIcon, RelayIcon, SpyIcon } from "../../../components/icons";
|
||||
import { ClipboardIcon, CodeIcon, ExternalLinkIcon, RelayIcon, SpyIcon } from "../../../components/icons";
|
||||
import accountService from "../../../services/account";
|
||||
import { useUserMetadata } from "../../../hooks/use-user-metadata";
|
||||
import { getUserDisplayName } from "../../../helpers/user-metadata";
|
||||
@@ -41,6 +41,12 @@ export const UserProfileMenu = ({
|
||||
<MenuItem icon={<SpyIcon fontSize="1.5em" />} onClick={() => loginAsUser()}>
|
||||
Login as {getUserDisplayName(metadata, pubkey)}
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => window.open(`https://nostrapp.link/#${sharableId}?select=true`, "_blank")}
|
||||
icon={<ExternalLinkIcon />}
|
||||
>
|
||||
View in app...
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => copyToClipboard("nostr:" + sharableId)} icon={<ClipboardIcon />}>
|
||||
Copy share link
|
||||
</MenuItem>
|
||||
|
Reference in New Issue
Block a user