From df931472f95ce6ca52d52752525bf95f1c31374c Mon Sep 17 00:00:00 2001 From: kieran Date: Wed, 28 Aug 2024 10:25:08 +0100 Subject: [PATCH] fix: stream api changes --- src/element/provider/nostr/index.tsx | 14 +------------- src/pages/dashboard/intro/step1.tsx | 1 + src/providers/zsz.ts | 7 +++---- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/element/provider/nostr/index.tsx b/src/element/provider/nostr/index.tsx index 2295c8c..536dd5d 100644 --- a/src/element/provider/nostr/index.tsx +++ b/src/element/provider/nostr/index.tsx @@ -1,4 +1,3 @@ -import { NostrEvent } from "@snort/system"; import { useContext, useEffect, useState } from "react"; import { FormattedMessage } from "react-intl"; import { SnortContext } from "@snort/system-react"; @@ -212,18 +211,7 @@ export default function NostrProviderDialog({ provider.updateStreamInfo(system, ex); others.onFinish?.(ex); }} - ev={ - { - tags: [ - ["title", info.streamInfo?.title ?? ""], - ["summary", info.streamInfo?.summary ?? ""], - ["image", info.streamInfo?.image ?? ""], - ...(info.streamInfo?.goal ? [["goal", info.streamInfo.goal]] : []), - ...(info.streamInfo?.content_warning ? [["content-warning", info.streamInfo?.content_warning]] : []), - ...(info.streamInfo?.tags?.map(a => ["t", a]) ?? []), - ], - } as NostrEvent - } + ev={others.ev} options={{ canSetStream: false, canSetStatus: false, diff --git a/src/pages/dashboard/intro/step1.tsx b/src/pages/dashboard/intro/step1.tsx index fe8d34a..8a7c858 100644 --- a/src/pages/dashboard/intro/step1.tsx +++ b/src/pages/dashboard/intro/step1.tsx @@ -15,6 +15,7 @@ export default function DashboardIntroStep1() { const [error, setError] = useState(); useEffect(() => { + //TODO: remove "streamInfo" using account info DefaultProvider.info().then(i => { setTitle(i.streamInfo?.title ?? ""); setDescription(i.streamInfo?.summary ?? ""); diff --git a/src/providers/zsz.ts b/src/providers/zsz.ts index 700221d..7a0c518 100644 --- a/src/providers/zsz.ts +++ b/src/providers/zsz.ts @@ -3,7 +3,6 @@ import { StreamProvider, StreamProviderEndpoint, StreamProviderInfo, - StreamProviderStreamInfo, StreamProviders, } from "."; import { EventKind, EventPublisher, NostrEvent, SystemInterface } from "@snort/system"; @@ -38,7 +37,6 @@ export class NostrStreamProvider implements StreamProvider { name: this.name, state: StreamState.Planned, viewers: 0, - streamInfo: rsp.event, balance: rsp.balance, tosAccepted: rsp.tos?.accepted, tosLink: rsp.tos?.link, @@ -64,8 +62,9 @@ export class NostrStreamProvider implements StreamProvider { } async updateStreamInfo(_: SystemInterface, ev: NostrEvent): Promise { - const { title, summary, image, tags, contentWarning, goal, gameId } = extractStreamInfo(ev); + const { title, summary, image, tags, contentWarning, goal, gameId, id } = extractStreamInfo(ev); await this.#getJson("PATCH", "event", { + id, title, summary, image, @@ -76,6 +75,7 @@ export class NostrStreamProvider implements StreamProvider { } async updateStream(props: { + id: string, title?: string; summary?: string; image?: string; @@ -184,7 +184,6 @@ export class NostrStreamProvider implements StreamProvider { interface AccountResponse { balance: number; - event?: StreamProviderStreamInfo; endpoints: Array; tos?: { accepted: boolean;