diff --git a/.env b/.env new file mode 100644 index 0000000..a17cd5b --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_SINGLE_PUBLISHER= \ No newline at end of file diff --git a/src/d.ts b/src/d.ts index 9471123..fb527e4 100644 --- a/src/d.ts +++ b/src/d.ts @@ -4,7 +4,6 @@ declare const __XXX: boolean; declare const __XXX_HOST: string; declare const __ZAP_STREAM_VERSION__: string; -declare const __SINGLE_PUBLISHER: string; declare module "*.jpg" { const value: unknown; diff --git a/src/hooks/live-streams.ts b/src/hooks/live-streams.ts index ad2d97a..88ed1b3 100644 --- a/src/hooks/live-streams.ts +++ b/src/hooks/live-streams.ts @@ -15,13 +15,13 @@ export function useStreamsFeed(tag?: string) { rb.withOptions({ leaveOpen: true, }); - if (__SINGLE_PUBLISHER) { + if (import.meta.env.VITE_SINGLE_PUBLISHER) { if (tag) { - rb.withFilter().kinds([LIVE_STREAM]).tag("t", [tag]).authors([__SINGLE_PUBLISHER]); - rb.withFilter().kinds([LIVE_STREAM]).tag("t", [tag]).tag("p", [__SINGLE_PUBLISHER]); + rb.withFilter().kinds([LIVE_STREAM]).tag("t", [tag]).authors([import.meta.env.VITE_SINGLE_PUBLISHER]); + rb.withFilter().kinds([LIVE_STREAM]).tag("t", [tag]).tag("p", [import.meta.env.VITE_SINGLE_PUBLISHER]); } else { - rb.withFilter().kinds([LIVE_STREAM]).authors([__SINGLE_PUBLISHER]); - rb.withFilter().kinds([LIVE_STREAM]).tag("p", [__SINGLE_PUBLISHER]); + rb.withFilter().kinds([LIVE_STREAM]).authors([import.meta.env.VITE_SINGLE_PUBLISHER]); + rb.withFilter().kinds([LIVE_STREAM]).tag("p", [import.meta.env.VITE_SINGLE_PUBLISHER]); } } else { if (tag) { @@ -48,11 +48,11 @@ export function useStreamsFeed(tag?: string) { if (feed.data) { if (__XXX) { return [...feed.data].filter( - a => findTag(a, "content-warning") !== undefined && (!__SINGLE_PUBLISHER || __SINGLE_PUBLISHER === getHost(a)) + a => findTag(a, "content-warning") !== undefined && (!import.meta.env.VITE_SINGLE_PUBLISHER || import.meta.env.VITE_SINGLE_PUBLISHER === getHost(a)) ); } else { return [...feed.data].filter( - a => findTag(a, "content-warning") === undefined && (!__SINGLE_PUBLISHER || __SINGLE_PUBLISHER === getHost(a)) + a => findTag(a, "content-warning") === undefined && (!import.meta.env.VITE_SINGLE_PUBLISHER || import.meta.env.VITE_SINGLE_PUBLISHER === getHost(a)) ); } } diff --git a/src/pages/layout.tsx b/src/pages/layout.tsx index e769c46..0730ebe 100644 --- a/src/pages/layout.tsx +++ b/src/pages/layout.tsx @@ -57,7 +57,7 @@ export function LayoutPage() { return ( <> - {(!__SINGLE_PUBLISHER || __SINGLE_PUBLISHER === login.pubkey) && ( + {(!import.meta.env.VITE_SINGLE_PUBLISHER || import.meta.env.VITE_SINGLE_PUBLISHER === login.pubkey) && ( )}