Nostr stream provider init

This commit is contained in:
2023-07-03 16:55:43 +01:00
parent cbc49a0def
commit 7cc613646c
15 changed files with 566 additions and 198 deletions

View File

@ -1,3 +1,4 @@
import { NostrEvent } from "@snort/system";
import { StreamState } from "index";
import { StreamProvider, StreamProviderInfo, StreamProviders } from "providers";
@ -10,6 +11,10 @@ export class OwncastProvider implements StreamProvider {
this.#token = token;
}
get name() {
return new URL(this.#url).host
}
createConfig(): any & { type: StreamProviders; } {
return {
type: StreamProviders.Owncast,
@ -18,10 +23,15 @@ export class OwncastProvider implements StreamProvider {
}
}
updateStreamInfo(ev: NostrEvent): Promise<void> {
return Promise.resolve();
}
async info() {
const info = await this.#getJson<ConfigResponse>("GET", "/api/config");
const status = await this.#getJson<StatusResponse>("GET", "/api/status");
return {
type: StreamProviders.Owncast,
name: info.name,
summary: info.summary,
version: info.version,