fix: stream api changes

This commit is contained in:
2024-08-28 10:25:08 +01:00
parent 660b5153fc
commit df931472f9
3 changed files with 5 additions and 17 deletions

View File

@ -1,4 +1,3 @@
import { NostrEvent } from "@snort/system";
import { useContext, useEffect, useState } from "react"; import { useContext, useEffect, useState } from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { SnortContext } from "@snort/system-react"; import { SnortContext } from "@snort/system-react";
@ -212,18 +211,7 @@ export default function NostrProviderDialog({
provider.updateStreamInfo(system, ex); provider.updateStreamInfo(system, ex);
others.onFinish?.(ex); others.onFinish?.(ex);
}} }}
ev={ ev={others.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
}
options={{ options={{
canSetStream: false, canSetStream: false,
canSetStatus: false, canSetStatus: false,

View File

@ -15,6 +15,7 @@ export default function DashboardIntroStep1() {
const [error, setError] = useState<string>(); const [error, setError] = useState<string>();
useEffect(() => { useEffect(() => {
//TODO: remove "streamInfo" using account info
DefaultProvider.info().then(i => { DefaultProvider.info().then(i => {
setTitle(i.streamInfo?.title ?? ""); setTitle(i.streamInfo?.title ?? "");
setDescription(i.streamInfo?.summary ?? ""); setDescription(i.streamInfo?.summary ?? "");

View File

@ -3,7 +3,6 @@ import {
StreamProvider, StreamProvider,
StreamProviderEndpoint, StreamProviderEndpoint,
StreamProviderInfo, StreamProviderInfo,
StreamProviderStreamInfo,
StreamProviders, StreamProviders,
} from "."; } from ".";
import { EventKind, EventPublisher, NostrEvent, SystemInterface } from "@snort/system"; import { EventKind, EventPublisher, NostrEvent, SystemInterface } from "@snort/system";
@ -38,7 +37,6 @@ export class NostrStreamProvider implements StreamProvider {
name: this.name, name: this.name,
state: StreamState.Planned, state: StreamState.Planned,
viewers: 0, viewers: 0,
streamInfo: rsp.event,
balance: rsp.balance, balance: rsp.balance,
tosAccepted: rsp.tos?.accepted, tosAccepted: rsp.tos?.accepted,
tosLink: rsp.tos?.link, tosLink: rsp.tos?.link,
@ -64,8 +62,9 @@ export class NostrStreamProvider implements StreamProvider {
} }
async updateStreamInfo(_: SystemInterface, ev: NostrEvent): Promise<void> { async updateStreamInfo(_: SystemInterface, ev: NostrEvent): Promise<void> {
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", { await this.#getJson("PATCH", "event", {
id,
title, title,
summary, summary,
image, image,
@ -76,6 +75,7 @@ export class NostrStreamProvider implements StreamProvider {
} }
async updateStream(props: { async updateStream(props: {
id: string,
title?: string; title?: string;
summary?: string; summary?: string;
image?: string; image?: string;
@ -184,7 +184,6 @@ export class NostrStreamProvider implements StreamProvider {
interface AccountResponse { interface AccountResponse {
balance: number; balance: number;
event?: StreamProviderStreamInfo;
endpoints: Array<IngestEndpoint>; endpoints: Array<IngestEndpoint>;
tos?: { tos?: {
accepted: boolean; accepted: boolean;