forked from Kieran/zap.stream
cleanup
This commit is contained in:
parent
d071736d4c
commit
16c54185bb
@ -10,7 +10,6 @@
|
|||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<link rel="manifest" href="/manifest.json" />
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<title>zap.stream</title>
|
<title>zap.stream</title>
|
||||||
<link href="/fonts/outfit/outfit.css" rel="stylesheet" />
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -65,7 +65,7 @@ export function ChatMessage({
|
|||||||
inView?.isIntersecting ? ev.pubkey : undefined
|
inView?.isIntersecting ? ev.pubkey : undefined
|
||||||
);
|
);
|
||||||
const shouldShowMuteButton =
|
const shouldShowMuteButton =
|
||||||
ev.pubkey !== streamer && ev.pubkey != login?.pubkey;
|
ev.pubkey !== streamer && ev.pubkey !== login?.pubkey;
|
||||||
const zapTarget = profile?.lud16 ?? profile?.lud06;
|
const zapTarget = profile?.lud16 ?? profile?.lud06;
|
||||||
const zaps = useMemo(() => {
|
const zaps = useMemo(() => {
|
||||||
return reactions
|
return reactions
|
||||||
@ -111,8 +111,8 @@ export function ChatMessage({
|
|||||||
const pub = login?.publisher();
|
const pub = login?.publisher();
|
||||||
if (emoji.native) {
|
if (emoji.native) {
|
||||||
reply = await pub?.react(ev, emoji.native || "+1");
|
reply = await pub?.react(ev, emoji.native || "+1");
|
||||||
} else {
|
} else if (emoji.id) {
|
||||||
const e = getEmojiById(emoji.id!);
|
const e = getEmojiById(emoji.id);
|
||||||
if (e) {
|
if (e) {
|
||||||
reply = await pub?.generic((eb) => {
|
reply = await pub?.generic((eb) => {
|
||||||
return eb
|
return eb
|
||||||
@ -120,7 +120,7 @@ export function ChatMessage({
|
|||||||
.content(`:${emoji.id}:`)
|
.content(`:${emoji.id}:`)
|
||||||
.tag(["e", ev.id])
|
.tag(["e", ev.id])
|
||||||
.tag(["p", ev.pubkey])
|
.tag(["p", ev.pubkey])
|
||||||
.tag(["emoji", e.at(1)!, e.at(2)!]);
|
.tag(["emoji", e[1], e[2]]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ export function ChatMessage({
|
|||||||
setShowEmojiPicker(!showEmojiPicker);
|
setShowEmojiPicker(!showEmojiPicker);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function muteUser(e: React.MouseEvent) {
|
function muteUser(e: React.MouseEvent) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
mute();
|
mute();
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ export function ChatMessage({
|
|||||||
<div className="message-reaction-container">
|
<div className="message-reaction-container">
|
||||||
{isCustomEmojiReaction && emoji ? (
|
{isCustomEmojiReaction && emoji ? (
|
||||||
<span className="message-reaction">
|
<span className="message-reaction">
|
||||||
<EmojiComponent name={emoji.at(1)!} url={emoji.at(2)!} />
|
<EmojiComponent name={emoji[1]} url={emoji[2]} />
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span className="message-reaction">{e}</span>
|
<span className="message-reaction">{e}</span>
|
||||||
@ -210,16 +210,16 @@ export function ChatMessage({
|
|||||||
style={
|
style={
|
||||||
isTablet
|
isTablet
|
||||||
? {
|
? {
|
||||||
display: showZapDialog || isHovering ? "flex" : "none",
|
display: showZapDialog || isHovering ? "flex" : "none",
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
top: topOffset ? topOffset - 12 : 0,
|
top: topOffset ? topOffset - 12 : 0,
|
||||||
left: leftOffset ? leftOffset - 32 : 0,
|
left: leftOffset ? leftOffset - 32 : 0,
|
||||||
opacity: showZapDialog || isHovering ? 1 : 0,
|
opacity: showZapDialog || isHovering ? 1 : 0,
|
||||||
pointerEvents:
|
pointerEvents:
|
||||||
showZapDialog || isHovering ? "auto" : "none",
|
showZapDialog || isHovering ? "auto" : "none",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{zapTarget && (
|
{zapTarget && (
|
||||||
|
@ -12,7 +12,9 @@ export function LoggedInFollowButton({
|
|||||||
value: string;
|
value: string;
|
||||||
}) {
|
}) {
|
||||||
const login = useLogin();
|
const login = useLogin();
|
||||||
const { tags, content, timestamp } = login!.follows;
|
if (!login) return;
|
||||||
|
|
||||||
|
const { tags, content, timestamp } = login.follows;
|
||||||
const follows = tags.filter((t) => t.at(0) === tag);
|
const follows = tags.filter((t) => t.at(0) === tag);
|
||||||
const isFollowing = follows.find((t) => t.at(1) === value);
|
const isFollowing = follows.find((t) => t.at(1) === value);
|
||||||
|
|
||||||
|
@ -325,8 +325,6 @@
|
|||||||
text-transform: lowercase;
|
text-transform: lowercase;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-family: Outfit;
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
parseZap,
|
parseZap,
|
||||||
encodeTLV,
|
encodeTLV,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { unixNow } from "@snort/shared";
|
import { unixNow, unwrap } from "@snort/shared";
|
||||||
import { useEffect, useMemo } from "react";
|
import { useEffect, useMemo } from "react";
|
||||||
import uniqBy from "lodash.uniqby";
|
import uniqBy from "lodash.uniqby";
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export function LiveChat({
|
|||||||
const login = useLogin();
|
const login = useLogin();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const pubkeys = [
|
const pubkeys = [
|
||||||
...new Set(feed.zaps.flatMap((a) => [a.pubkey, findTag(a, "p")!])),
|
...new Set(feed.zaps.flatMap((a) => [a.pubkey, unwrap(findTag(a, "p"))])),
|
||||||
];
|
];
|
||||||
System.ProfileLoader.TrackMetadata(pubkeys);
|
System.ProfileLoader.TrackMetadata(pubkeys);
|
||||||
return () => System.ProfileLoader.UntrackMetadata(pubkeys);
|
return () => System.ProfileLoader.UntrackMetadata(pubkeys);
|
||||||
|
@ -9,6 +9,7 @@ import { StreamEditor, StreamEditorProps } from "./stream-editor";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { eventLink, findTag } from "utils";
|
import { eventLink, findTag } from "utils";
|
||||||
import { NostrProviderDialog } from "./nostr-provider-dialog";
|
import { NostrProviderDialog } from "./nostr-provider-dialog";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
|
|
||||||
function NewStream({ ev, onFinish }: StreamEditorProps) {
|
function NewStream({ ev, onFinish }: StreamEditorProps) {
|
||||||
const providers = useStreamProvider();
|
const providers = useStreamProvider();
|
||||||
@ -19,7 +20,7 @@ function NewStream({ ev, onFinish }: StreamEditorProps) {
|
|||||||
if (!currentProvider) {
|
if (!currentProvider) {
|
||||||
setCurrentProvider(
|
setCurrentProvider(
|
||||||
ev !== undefined
|
ev !== undefined
|
||||||
? providers.find((a) => a.name.toLowerCase() === "manual")!
|
? unwrap(providers.find((a) => a.name.toLowerCase() === "manual"))
|
||||||
: providers.at(0)
|
: providers.at(0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { Menu, MenuItem } from "@szhsin/react-menu";
|
import { Menu, MenuItem } from "@szhsin/react-menu";
|
||||||
import * as Dialog from "@radix-ui/react-dialog";
|
import * as Dialog from "@radix-ui/react-dialog";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
|
import { NostrEvent, NostrPrefix, encodeTLV } from "@snort/system";
|
||||||
|
|
||||||
import { Icon } from "./icon";
|
import { Icon } from "./icon";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Textarea } from "./textarea";
|
import { Textarea } from "./textarea";
|
||||||
import { NostrEvent, NostrPrefix, encodeTLV } from "@snort/system";
|
|
||||||
import { findTag } from "utils";
|
import { findTag } from "utils";
|
||||||
import AsyncButton from "./async-button";
|
import AsyncButton from "./async-button";
|
||||||
import { useLogin } from "hooks/login";
|
import { useLogin } from "hooks/login";
|
||||||
@ -18,7 +20,7 @@ export function ShareMenu({ ev }: { ev: NostrEvent }) {
|
|||||||
|
|
||||||
const naddr = encodeTLV(
|
const naddr = encodeTLV(
|
||||||
NostrPrefix.Address,
|
NostrPrefix.Address,
|
||||||
findTag(ev, "d")!,
|
unwrap(findTag(ev, "d")),
|
||||||
undefined,
|
undefined,
|
||||||
ev.kind,
|
ev.kind,
|
||||||
ev.pubkey
|
ev.pubkey
|
||||||
|
@ -100,7 +100,7 @@ function Card({ canEdit, ev, cards }: CardProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
function findTagByIdentifier(d: string) {
|
function findTagByIdentifier(d: string) {
|
||||||
return tags.find((t) => t.at(1)!.endsWith(`:${d}`));
|
return tags.find((t) => t[1].endsWith(`:${d}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
const [dropStyle, dropRef] = useDrop(
|
const [dropStyle, dropRef] = useDrop(
|
||||||
@ -293,7 +293,7 @@ function EditCard({ card, cards }: EditCardProps) {
|
|||||||
async function onCancel() {
|
async function onCancel() {
|
||||||
const pub = login?.publisher();
|
const pub = login?.publisher();
|
||||||
if (pub) {
|
if (pub) {
|
||||||
const newTags = tags.filter((t) => !t.at(1)!.endsWith(`:${identifier}`));
|
const newTags = tags.filter((t) => !t[1].endsWith(`:${identifier}`));
|
||||||
const userCardsEv = await pub.generic((eb) => {
|
const userCardsEv = await pub.generic((eb) => {
|
||||||
eb.kind(USER_CARDS).content("");
|
eb.kind(USER_CARDS).content("");
|
||||||
for (const tag of newTags) {
|
for (const tag of newTags) {
|
||||||
@ -408,7 +408,7 @@ export function StreamCardEditor({ pubkey, tags }: StreamCardEditorProps) {
|
|||||||
<>
|
<>
|
||||||
<div className="stream-cards">
|
<div className="stream-cards">
|
||||||
{cards.map((ev) => (
|
{cards.map((ev) => (
|
||||||
<Card canEdit={isEditing} cards={cards} key={ev.id} ev={ev!} />
|
<Card canEdit={isEditing} cards={cards} key={ev.id} ev={ev} />
|
||||||
))}
|
))}
|
||||||
{isEditing && <AddCard cards={cards} />}
|
{isEditing && <AddCard cards={cards} />}
|
||||||
</div>
|
</div>
|
||||||
@ -433,7 +433,7 @@ export function ReadOnlyStreamCards({ host }: StreamCardsProps) {
|
|||||||
return (
|
return (
|
||||||
<div className="stream-cards">
|
<div className="stream-cards">
|
||||||
{cards.map((ev) => (
|
{cards.map((ev) => (
|
||||||
<Card cards={cards} key={ev!.id} ev={ev!} />
|
<Card cards={cards} key={ev.id} ev={ev} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -53,11 +53,11 @@ export function Textarea({ emojis, ...props }: TextareaProps) {
|
|||||||
const userDataProvider = async (token: string) => {
|
const userDataProvider = async (token: string) => {
|
||||||
const cache = System.ProfileLoader.Cache;
|
const cache = System.ProfileLoader.Cache;
|
||||||
if (cache instanceof UserProfileCache) {
|
if (cache instanceof UserProfileCache) {
|
||||||
return cache.search(token);
|
return await cache.search(token);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const emojiDataProvider = async (token: string) => {
|
const emojiDataProvider = (token: string) => {
|
||||||
const results = emojis
|
const results = emojis
|
||||||
.map((t) => {
|
.map((t) => {
|
||||||
return {
|
return {
|
||||||
|
@ -29,7 +29,7 @@ export function useUserCards(
|
|||||||
|
|
||||||
const subRelated = useMemo(() => {
|
const subRelated = useMemo(() => {
|
||||||
if (!pubkey) return null;
|
if (!pubkey) return null;
|
||||||
const splitted = related.map((t) => t.at(1)!.split(":"));
|
const splitted = related.map((t) => t[1].split(":"));
|
||||||
const authors = splitted
|
const authors = splitted
|
||||||
.map((s) => s.at(1))
|
.map((s) => s.at(1))
|
||||||
.filter((s) => s)
|
.filter((s) => s)
|
||||||
@ -58,7 +58,7 @@ export function useUserCards(
|
|||||||
const cards = useMemo(() => {
|
const cards = useMemo(() => {
|
||||||
return related
|
return related
|
||||||
.map((t) => {
|
.map((t) => {
|
||||||
const [k, pubkey, identifier] = t.at(1)!.split(":");
|
const [k, pubkey, identifier] = t[1].split(":");
|
||||||
const kind = Number(k);
|
const kind = Number(k);
|
||||||
return (data ?? []).find(
|
return (data ?? []).find(
|
||||||
(e) =>
|
(e) =>
|
||||||
@ -104,7 +104,7 @@ export function useCards(pubkey: string, leaveOpen = false): TaggedRawEvent[] {
|
|||||||
|
|
||||||
const subRelated = useMemo(() => {
|
const subRelated = useMemo(() => {
|
||||||
if (!pubkey) return null;
|
if (!pubkey) return null;
|
||||||
const splitted = related.map((t) => t.at(1)!.split(":"));
|
const splitted = related.map((t) => t[1].split(":"));
|
||||||
const authors = splitted
|
const authors = splitted
|
||||||
.map((s) => s.at(1))
|
.map((s) => s.at(1))
|
||||||
.filter((s) => s)
|
.filter((s) => s)
|
||||||
@ -134,7 +134,7 @@ export function useCards(pubkey: string, leaveOpen = false): TaggedRawEvent[] {
|
|||||||
const cards = useMemo(() => {
|
const cards = useMemo(() => {
|
||||||
return related
|
return related
|
||||||
.map((t) => {
|
.map((t) => {
|
||||||
const [k, pubkey, identifier] = t.at(1)!.split(":");
|
const [k, pubkey, identifier] = t[1].split(":");
|
||||||
const kind = Number(k);
|
const kind = Number(k);
|
||||||
return cardEvents.find(
|
return cardEvents.find(
|
||||||
(e) =>
|
(e) =>
|
||||||
|
@ -45,7 +45,7 @@ export function useUserEmojiPacks(pubkey?: string, userEmoji?: Tags) {
|
|||||||
|
|
||||||
const subRelated = useMemo(() => {
|
const subRelated = useMemo(() => {
|
||||||
if (!pubkey) return null;
|
if (!pubkey) return null;
|
||||||
const splitted = related.map((t) => t.at(1)!.split(":"));
|
const splitted = related.map((t) => t[1].split(":"));
|
||||||
const authors = splitted
|
const authors = splitted
|
||||||
.map((s) => s.at(1))
|
.map((s) => s.at(1))
|
||||||
.filter((s) => s)
|
.filter((s) => s)
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
parseZap,
|
parseZap,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
import { GOAL } from "const";
|
import { GOAL } from "const";
|
||||||
import { System } from "index";
|
import { System } from "index";
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ export function useZapGoal(host: string, link: NostrLink, leaveOpen = false) {
|
|||||||
b.withFilter()
|
b.withFilter()
|
||||||
.kinds([GOAL])
|
.kinds([GOAL])
|
||||||
.authors([host])
|
.authors([host])
|
||||||
.tag("a", [`${link.kind}:${link.author!}:${link.id}`]);
|
.tag("a", [`${link.kind}:${unwrap(link.author)}:${link.id}`]);
|
||||||
return b;
|
return b;
|
||||||
}, [link, leaveOpen]);
|
}, [link, leaveOpen]);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import "@szhsin/react-menu/dist/index.css";
|
import "@szhsin/react-menu/dist/index.css";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
import "./fonts/outfit/outfit.css";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { bytesToHex } from "@noble/curves/abstract/utils";
|
import { bytesToHex } from "@noble/curves/abstract/utils";
|
||||||
import { schnorr } from "@noble/curves/secp256k1";
|
import { schnorr } from "@noble/curves/secp256k1";
|
||||||
import { ExternalStore } from "@snort/shared";
|
import { ExternalStore, unwrap } from "@snort/shared";
|
||||||
import { EventPublisher, Nip7Signer, PrivateKeySigner } from "@snort/system";
|
import { EventPublisher, Nip7Signer, PrivateKeySigner } from "@snort/system";
|
||||||
import type { EmojiPack, Tags } from "types";
|
import type { EmojiPack, Tags } from "types";
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ export function getPublisher(session: LoginSession) {
|
|||||||
}
|
}
|
||||||
case LoginType.PrivateKey: {
|
case LoginType.PrivateKey: {
|
||||||
return new EventPublisher(
|
return new EventPublisher(
|
||||||
new PrivateKeySigner(session.privateKey!),
|
new PrivateKeySigner(unwrap(session.privateKey)),
|
||||||
session.pubkey
|
session.pubkey
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,13 @@ import "./chat-popout.css";
|
|||||||
import { LiveChat } from "element/live-chat";
|
import { LiveChat } from "element/live-chat";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { NostrPrefix, encodeTLV, parseNostrLink } from "@snort/system";
|
import { NostrPrefix, encodeTLV, parseNostrLink } from "@snort/system";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
import { useCurrentStreamFeed } from "hooks/current-stream-feed";
|
import { useCurrentStreamFeed } from "hooks/current-stream-feed";
|
||||||
import { findTag } from "utils";
|
import { findTag } from "utils";
|
||||||
|
|
||||||
export function ChatPopout() {
|
export function ChatPopout() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const link = parseNostrLink(params.id!);
|
const link = parseNostrLink(unwrap(params.id));
|
||||||
const ev = useCurrentStreamFeed(link, true);
|
const ev = useCurrentStreamFeed(link, true);
|
||||||
|
|
||||||
const lnk = parseNostrLink(
|
const lnk = parseNostrLink(
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
encodeTLV,
|
encodeTLV,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { useUserProfile } from "@snort/system-react";
|
import { useUserProfile } from "@snort/system-react";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
import { Profile } from "element/profile";
|
import { Profile } from "element/profile";
|
||||||
import { Icon } from "element/icon";
|
import { Icon } from "element/icon";
|
||||||
import { SendZapsDialog } from "element/send-zap";
|
import { SendZapsDialog } from "element/send-zap";
|
||||||
@ -52,7 +53,7 @@ const defaultBanner = "https://void.cat/d/Hn1AdN5UKmceuDkgDW847q.webp";
|
|||||||
export function ProfilePage() {
|
export function ProfilePage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const link = parseNostrLink(params.npub!);
|
const link = parseNostrLink(unwrap(params.npub));
|
||||||
const placeholder = usePlaceholder(link.id);
|
const placeholder = usePlaceholder(link.id);
|
||||||
const profile = useUserProfile(System, link.id);
|
const profile = useUserProfile(System, link.id);
|
||||||
const zapTarget = profile?.lud16 ?? profile?.lud06;
|
const zapTarget = profile?.lud16 ?? profile?.lud06;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import "./stream-page.css";
|
import "./stream-page.css";
|
||||||
import { parseNostrLink, TaggedRawEvent } from "@snort/system";
|
import { parseNostrLink, TaggedRawEvent } from "@snort/system";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ export function StreamPage() {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const evPreload = getEventFromLocationState(location.state);
|
const evPreload = getEventFromLocationState(location.state);
|
||||||
const link = parseNostrLink(params.id!);
|
const link = parseNostrLink(unwrap(params.id));
|
||||||
const ev = useCurrentStreamFeed(link, true, evPreload);
|
const ev = useCurrentStreamFeed(link, true, evPreload);
|
||||||
const host = getHost(ev);
|
const host = getHost(ev);
|
||||||
const goal = useZapGoal(host, link, true);
|
const goal = useZapGoal(host, link, true);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import "./tag.css";
|
import "./tag.css";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { unwrap } from "@snort/shared";
|
||||||
|
|
||||||
import { VideoTile } from "element/video-tile";
|
import { VideoTile } from "element/video-tile";
|
||||||
import { FollowTagButton } from "element/follow-button";
|
import { FollowTagButton } from "element/follow-button";
|
||||||
@ -12,7 +13,7 @@ export function TagPage() {
|
|||||||
<div className="tag-page">
|
<div className="tag-page">
|
||||||
<div className="tag-page-header">
|
<div className="tag-page-header">
|
||||||
<h1>#{tag}</h1>
|
<h1>#{tag}</h1>
|
||||||
<FollowTagButton tag={tag!} />
|
<FollowTagButton tag={unwrap(tag)} />
|
||||||
</div>
|
</div>
|
||||||
<div className="video-grid">
|
<div className="video-grid">
|
||||||
{live.map((e) => (
|
{live.map((e) => (
|
||||||
|
@ -58,7 +58,7 @@ export class OwncastProvider implements StreamProvider {
|
|||||||
body?: unknown
|
body?: unknown
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const rsp = await fetch(`${this.#url}${path}`, {
|
const rsp = await fetch(`${this.#url}${path}`, {
|
||||||
method: method,
|
method,
|
||||||
body: body ? JSON.stringify(body) : undefined,
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
|
@ -103,7 +103,7 @@ export class Nip103StreamProvider implements StreamProvider {
|
|||||||
.tag(["method", method]);
|
.tag(["method", method]);
|
||||||
});
|
});
|
||||||
const rsp = await fetch(u, {
|
const rsp = await fetch(u, {
|
||||||
method: method,
|
method,
|
||||||
body: body ? JSON.stringify(body) : undefined,
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
|
@ -109,7 +109,7 @@ export function getHost(ev?: NostrEvent) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function openFile(): Promise<File | undefined> {
|
export function openFile(): Promise<File | undefined> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const elm = document.createElement("input");
|
const elm = document.createElement("input");
|
||||||
elm.type = "file";
|
elm.type = "file";
|
||||||
|
@ -503,7 +503,7 @@ export class WISH extends TypedEventTarget {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const body = await resp.text();
|
const body = await resp.text();
|
||||||
if (resp.status != 201) {
|
if (resp.status !== 201) {
|
||||||
throw new Error(`Unexpected status code ${resp.status}: ${body}`);
|
throw new Error(`Unexpected status code ${resp.status}: ${body}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ export class WISH extends TypedEventTarget {
|
|||||||
throw new Error(`Unexpected status code ${resp.status}: ${body}`);
|
throw new Error(`Unexpected status code ${resp.status}: ${body}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async WithEndpoint(endpoint: string, trickle: boolean) {
|
WithEndpoint(endpoint: string, trickle: boolean) {
|
||||||
if (endpoint === "") {
|
if (endpoint === "") {
|
||||||
throw new Error("Endpoint cannot be empty");
|
throw new Error("Endpoint cannot be empty");
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ export class WISH extends TypedEventTarget {
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
mode: "cors",
|
mode: "cors",
|
||||||
});
|
});
|
||||||
if (resp.status != 200) {
|
if (resp.status !== 200) {
|
||||||
const body = await resp.text();
|
const body = await resp.text();
|
||||||
throw new Error(`Unexpected status code ${resp.status}: ${body}`);
|
throw new Error(`Unexpected status code ${resp.status}: ${body}`);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ const config = {
|
|||||||
{ from: "public/robots.txt" },
|
{ from: "public/robots.txt" },
|
||||||
{ from: "public/icons.svg" },
|
{ from: "public/icons.svg" },
|
||||||
{ from: "public/logo.png" },
|
{ from: "public/logo.png" },
|
||||||
{ from: "_headers" },
|
{ from: "_headers" }
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
|
Loading…
Reference in New Issue
Block a user