feat: publish chat to stream event relays
This commit is contained in:
@ -224,7 +224,11 @@ export function LiveChat({
|
|||||||
{(canWrite ?? true) && (
|
{(canWrite ?? true) && (
|
||||||
<div className="flex gap-2 border-t py-2 border-layer-1">
|
<div className="flex gap-2 border-t py-2 border-layer-1">
|
||||||
{login ? (
|
{login ? (
|
||||||
<WriteMessage emojiPacks={allEmojiPacks} link={link} />
|
<WriteMessage
|
||||||
|
emojiPacks={allEmojiPacks}
|
||||||
|
link={link}
|
||||||
|
relays={ev?.tags.filter(a => a[0] === "relays").map(a => a[1])}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<p>
|
<p>
|
||||||
<FormattedMessage defaultMessage="Please login to write messages!" id="RXQdxR" />
|
<FormattedMessage defaultMessage="Please login to write messages!" id="RXQdxR" />
|
||||||
|
@ -16,10 +16,12 @@ export function WriteMessage({
|
|||||||
link,
|
link,
|
||||||
emojiPacks,
|
emojiPacks,
|
||||||
kind,
|
kind,
|
||||||
|
relays,
|
||||||
}: {
|
}: {
|
||||||
link: NostrLink;
|
link: NostrLink;
|
||||||
emojiPacks: EmojiPack[];
|
emojiPacks: EmojiPack[];
|
||||||
kind?: EventKind;
|
kind?: EventKind;
|
||||||
|
relays?: Array<string>;
|
||||||
}) {
|
}) {
|
||||||
const system = useContext(SnortContext);
|
const system = useContext(SnortContext);
|
||||||
const ref = useRef<HTMLDivElement | null>(null);
|
const ref = useRef<HTMLDivElement | null>(null);
|
||||||
@ -61,6 +63,9 @@ export function WriteMessage({
|
|||||||
if (reply) {
|
if (reply) {
|
||||||
console.debug(reply);
|
console.debug(reply);
|
||||||
system.BroadcastEvent(reply);
|
system.BroadcastEvent(reply);
|
||||||
|
for (const r of relays ?? []) {
|
||||||
|
system.WriteOnceToRelay(r, reply);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setChat("");
|
setChat("");
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ export function StreamPage({ link, evPreload }: { evPreload?: TaggedNostrEvent;
|
|||||||
</Helmet>
|
</Helmet>
|
||||||
<div className="flex flex-col gap-2 xl:overflow-y-auto scrollbar-hidden">
|
<div className="flex flex-col gap-2 xl:overflow-y-auto scrollbar-hidden">
|
||||||
<Suspense>
|
<Suspense>
|
||||||
{ev?.kind === LIVE_STREAM && (
|
{ev?.kind === LIVE_STREAM && evLink && (
|
||||||
<LiveVideoPlayer
|
<LiveVideoPlayer
|
||||||
title={title}
|
title={title}
|
||||||
stream={status === StreamState.Live ? stream : recording}
|
stream={status === StreamState.Live ? stream : recording}
|
||||||
|
Reference in New Issue
Block a user