+
{`${title} - zap.stream`}
diff --git a/src/providers/zsz.ts b/src/providers/zsz.ts
index 0492609..199391c 100644
--- a/src/providers/zsz.ts
+++ b/src/providers/zsz.ts
@@ -9,7 +9,7 @@ import {
import { EventKind, EventPublisher, NostrEvent, SystemInterface } from "@snort/system";
import { Login, StreamState } from "@/index";
import { getPublisher } from "@/login";
-import { findTag } from "@/utils";
+import { extractStreamInfo } from "@/utils";
export class Nip103StreamProvider implements StreamProvider {
#publisher?: EventPublisher;
@@ -53,13 +53,8 @@ export class Nip103StreamProvider implements StreamProvider {
};
}
- async updateStreamInfo(system: SystemInterface, ev: NostrEvent): Promise {
- const title = findTag(ev, "title");
- const summary = findTag(ev, "summary");
- const image = findTag(ev, "image");
- const tags = ev?.tags.filter(a => a[0] === "t").map(a => a[1]);
- const contentWarning = findTag(ev, "content-warning");
- const goal = findTag(ev, "goal");
+ async updateStreamInfo(_: SystemInterface, ev: NostrEvent): Promise {
+ const { title, summary, image, tags, contentWarning, goal } = extractStreamInfo(ev);
await this.#getJson("PATCH", "event", {
title,
summary,
diff --git a/src/translations/en.json b/src/translations/en.json
index d656648..d77849c 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -12,6 +12,7 @@
"1EYCdR": "Tags",
"1qsXCO": "eg. name@wallet.com",
"2/2yg+": "Add",
+ "37mth/": "Viewers",
"3HwrQo": "Zap!",
"3adEeb": "{n} viewers",
"3df560": "Login with private key",
@@ -22,6 +23,7 @@
"5JcXdV": "Create Account",
"5QYdPU": "Start Time",
"5kx+2v": "Server Url",
+ "5tM0VD": "Stream Started",
"6Z2pvJ": "Stream Providers",
"6pr6hJ": "Minimum amount for text to speech",
"79lLl+": "Music",
@@ -29,7 +31,6 @@
"8YT6ja": "Insert text to speak",
"9WRlF4": "Send",
"9a9+ww": "Title",
- "AIHaPH": "{person} zapped {amount} sats",
"Atr2p4": "NSFW Content",
"AukrPM": "No viewer data available",
"AyGauy": "Login",
@@ -78,6 +79,7 @@
"RJOmzk": "I have read and agree with {provider}''s {terms}.",
"RXQdxR": "Please login to write messages!",
"RrCui3": "Summary",
+ "RtYNX5": "Chat Users",
"TP/cMX": "Ended",
"TaTRKo": "Start Stream",
"TwyMau": "Account",
@@ -92,6 +94,7 @@
"Z8ZOEY": "This method is insecure. We recommend using a {nostrlink}",
"ZmqxZs": "You can change this later",
"acrOoz": "Continue",
+ "bfvyfs": "Anon",
"cPIKU2": "Following",
"cvAsEh": "Streamed on {date}",
"cyR7Kh": "Back",
@@ -110,13 +113,16 @@
"ieGrWo": "Follow",
"itPgxd": "Profile",
"izWS4J": "Unfollow",
+ "jctiUc": "Highest Viewers",
"jgOqxt": "Widgets",
+ "jkAQj5": "Stream Ended",
"jr4+vD": "Markdown",
"jvo0vs": "Save",
"k21gTS": "e.g. about me",
"kp0NPF": "Planned",
"lZpRMR": "Check here if this stream contains nudity or pornographic content.",
"ljmS5P": "Endpoint",
+ "miQKuZ": "Stream Time",
"mnJYBQ": "Voice",
"mtNGwh": "A short description of the content",
"nBCvvJ": "Topup",
@@ -125,7 +131,7 @@
"o8pHw3": "AUTO",
"oHPB8Q": "Zap {name}",
"oZrFyI": "Stream type should be HLS",
- "pO/lPX": "Scheduled for {date}",
+ "q+zTWM": "{person} zapped {amount} sats",
"r2Jjms": "Log In",
"rELDbB": "Refresh",
"rWBFZA": "Sexually explicit material ahead!",
@@ -152,4 +158,4 @@
"y867Vs": "Volume",
"yzKwBQ": "eg. nsec1xyz",
"zVDHAu": "Zap Alert"
-}
+}
\ No newline at end of file
diff --git a/src/utils.ts b/src/utils.ts
index a20e8bb..799e1a7 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -2,6 +2,7 @@ import { NostrEvent, NostrLink, TaggedNostrEvent } from "@snort/system";
import type { Tags } from "@/types";
import { LIVE_STREAM } from "@/const";
+import { StreamState } from ".";
export function toAddress(e: NostrEvent): string {
if (e.kind && e.kind >= 30000 && e.kind <= 40000) {
@@ -82,3 +83,43 @@ export function uniqBy(vals: Array, key: (x: T) => string) {
export function getPlaceholder(id: string) {
return `https://robohash.v0l.io/${id}.png`;
}
+
+interface StreamInfo {
+ title?: string;
+ summary?: string;
+ image?: string;
+ status?: string;
+ stream?: string;
+ recording?: string;
+ contentWarning?: string;
+ tags?: Array;
+ goal?: string;
+ participants?: string;
+ starts?: string;
+ ends?: string;
+}
+export function extractStreamInfo(ev?: NostrEvent) {
+ const ret = {} as StreamInfo;
+ const matchTag = (tag: Array, k: string, into: (v: string) => void) => {
+ if (tag[0] === k) {
+ into(tag[1]);
+ }
+ };
+
+ for (const t of ev?.tags ?? []) {
+ matchTag(t, "title", v => (ret.title = v));
+ matchTag(t, "summary", v => (ret.summary = v));
+ matchTag(t, "image", v => (ret.image = v));
+ matchTag(t, "status", v => (ret.status = v));
+ matchTag(t, "streaming", v => (ret.stream = v));
+ matchTag(t, "recording", v => (ret.recording = v));
+ matchTag(t, "content-warning", v => (ret.contentWarning = v));
+ matchTag(t, "current_participants", v => (ret.participants = v));
+ matchTag(t, "goal", v => (ret.goal = v));
+ matchTag(t, "starts", v => (ret.starts = v));
+ matchTag(t, "ends", v => (ret.ends = v));
+ }
+ ret.tags = ev?.tags.filter(a => a[0] === "t").map(a => a[1]) ?? [];
+
+ return ret;
+}
diff --git a/tailwind.config.js b/tailwind.config.js
index 5d9339a..2e5c982 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -6,12 +6,14 @@ module.exports = {
colors: {
"gray-1": "#171717",
"gray-2": "#222",
+ "gray-3": "#797979",
primary: "var(--primary)",
secondary: "var(--secondary)",
- zap: "var(--zap)"
+ zap: "var(--zap)",
},
animation: {
"ping-once": "ping 1s cubic-bezier(0, 0, 0.2, 1);",
+ flash: "pulse 0.5s 6 linear;"
},
},
},
diff --git a/yarn.lock b/yarn.lock
index ae55bd5..c81f248 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2896,14 +2896,14 @@ __metadata:
languageName: node
linkType: hard
-"@snort/system-react@npm:^1.1.5":
- version: 1.1.5
- resolution: "@snort/system-react@npm:1.1.5"
+"@snort/system-react@npm:^1.1.6":
+ version: 1.1.6
+ resolution: "@snort/system-react@npm:1.1.6"
dependencies:
"@snort/shared": ^1.0.10
- "@snort/system": ^1.1.5
+ "@snort/system": ^1.1.6
react: ^18.2.0
- checksum: 3192ca161b89d0f040e0432c37d7d90976f5977506bae5079dec0f370f913e8e5f9498f38636bb025ea2638ab00b5c9505cdc83a1c350a2dcf8cdbbd7aee8fa5
+ checksum: ea7658d6cf14508e87b6239346b89de34db848817beac7da7cc1b33e1f776920ecc6d079b3470eece3e60c6ec37b50fca94b84bd57b6d7ee24234fa3eb1fc945
languageName: node
linkType: hard
@@ -2943,9 +2943,9 @@ __metadata:
languageName: node
linkType: hard
-"@snort/system@npm:^1.1.5":
- version: 1.1.5
- resolution: "@snort/system@npm:1.1.5"
+"@snort/system@npm:^1.1.6":
+ version: 1.1.6
+ resolution: "@snort/system@npm:1.1.6"
dependencies:
"@noble/curves": ^1.2.0
"@noble/hashes": ^1.3.2
@@ -2957,7 +2957,7 @@ __metadata:
isomorphic-ws: ^5.0.0
uuid: ^9.0.0
ws: ^8.14.0
- checksum: 91561b2266d392ece8656f765325dd0a04d504a86d71a866c08616197a34e58049ef63ac25adabcbe28878aefc97cc14e386f0471b5e5afc57e40246cac37493
+ checksum: 087c25f72cab8b547e23190f9e3db398366f3dc1965cc5fcd6eee6983aaf3fe15a9b028047edca8080c3d63348e7359a44c42c91b2d6fa2bf36346acc0d69fda
languageName: node
linkType: hard
@@ -7806,8 +7806,8 @@ __metadata:
"@react-hook/resize-observer": ^1.2.6
"@scure/base": ^1.1.3
"@snort/shared": ^1.0.10
- "@snort/system": ^1.1.5
- "@snort/system-react": ^1.1.5
+ "@snort/system": ^1.1.6
+ "@snort/system-react": ^1.1.6
"@snort/system-wasm": ^1.0.1
"@snort/system-web": ^1.0.2
"@szhsin/react-menu": ^4.0.2