filter streams with no HLS link
This commit is contained in:
parent
3641cadd0d
commit
364d2c272f
@ -52,8 +52,6 @@
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"build": "vite build",
|
||||
"deploy": "__XXX='false' && yarn build && npx wrangler pages publish --project-name nostr-live build",
|
||||
"deploy:xxzap": "__XXX='true' && yarn build && npx wrangler pages publish --project-name xxzap build",
|
||||
"intl-extract": "formatjs extract 'src/**/*.ts*' --ignore='**/*.d.ts' --out-file src/lang.json --flatten true",
|
||||
"intl-compile": "formatjs compile src/lang.json --out-file src/translations/en.json"
|
||||
},
|
||||
|
2
src/d.ts
2
src/d.ts
@ -2,8 +2,6 @@
|
||||
/// <reference types="@webbtc/webln-types" />
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare const __XXX: boolean;
|
||||
declare const __XXX_HOST: string;
|
||||
declare const __ZAP_STREAM_VERSION__: string;
|
||||
|
||||
declare module "*.md" {
|
||||
|
@ -10,7 +10,7 @@ import { Icon } from "./icon";
|
||||
import { useStreamProvider } from "@/hooks/stream-provider";
|
||||
import { NostrStreamProvider, StreamProvider, StreamProviders } from "@/providers";
|
||||
import { StreamEditor, StreamEditorProps } from "./stream-editor";
|
||||
import { eventLink, findTag } from "@/utils";
|
||||
import { eventLink } from "@/utils";
|
||||
import { NostrProviderDialog } from "./nostr-provider-dialog";
|
||||
import AsyncButton from "./async-button";
|
||||
|
||||
@ -38,14 +38,10 @@ function NewStream({ ev, onFinish }: Omit<StreamEditorProps, "onFinish"> & { onF
|
||||
onFinish={ex => {
|
||||
currentProvider.updateStreamInfo(system, ex);
|
||||
if (!ev) {
|
||||
if (findTag(ex, "content-warning") && __XXX_HOST && __XXX === false) {
|
||||
location.href = `${__XXX_HOST}/${eventLink(ex)}`;
|
||||
} else {
|
||||
navigate(`/${eventLink(ex)}`, {
|
||||
state: ex,
|
||||
});
|
||||
onFinish?.();
|
||||
}
|
||||
navigate(`/${eventLink(ex)}`, {
|
||||
state: ex,
|
||||
});
|
||||
onFinish?.();
|
||||
} else {
|
||||
onFinish?.();
|
||||
}
|
||||
|
@ -75,15 +75,17 @@ export function NostrProviderDialog({
|
||||
const raw = Math.max(0, info.balance / ep.rate);
|
||||
if (ep.unit === "min" && raw > 60) {
|
||||
const pm = hrs * 60 * ep.rate;
|
||||
return <>
|
||||
{`${(raw / 60).toFixed(0)} hour @ ${ep.rate} sats/${ep.unit}`}
|
||||
or <br />
|
||||
{`${pm.toLocaleString()} sats/month ($${(rate.ask * pm * 1e-8).toFixed(2)}/mo) streaming ${hrs} hrs/month`}
|
||||
<div className="paper">
|
||||
Hrs
|
||||
<input type="number" value={hrs} onChange={e => setHrs(e.target.valueAsNumber)} />
|
||||
</div>
|
||||
</>
|
||||
return (
|
||||
<>
|
||||
{`${(raw / 60).toFixed(0)} hour @ ${ep.rate} sats/${ep.unit}`}
|
||||
or <br />
|
||||
{`${pm.toLocaleString()} sats/month ($${(rate.ask * pm * 1e-8).toFixed(2)}/mo) streaming ${hrs} hrs/month`}
|
||||
<div className="paper">
|
||||
Hrs
|
||||
<input type="number" value={hrs} onChange={e => setHrs(e.target.valueAsNumber)} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
return `${raw.toFixed(0)} ${ep.unit} @ ${ep.rate} sats/${ep.unit}`;
|
||||
}
|
||||
@ -273,7 +275,7 @@ export function NostrProviderDialog({
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
<AddForwardInputs provider={provider} onAdd={() => { }} />
|
||||
<AddForwardInputs provider={provider} onAdd={() => {}} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -56,24 +56,25 @@ export function useStreamsFeed(tag?: string) {
|
||||
const feed = useRequestBuilder(rb);
|
||||
const feedSorted = useMemo(() => {
|
||||
if (feed) {
|
||||
if (__XXX) {
|
||||
return [...feed].filter(
|
||||
a =>
|
||||
findTag(a, "content-warning") !== undefined &&
|
||||
(!import.meta.env.VITE_SINGLE_PUBLISHER || import.meta.env.VITE_SINGLE_PUBLISHER === getHost(a))
|
||||
);
|
||||
} else {
|
||||
return [...feed].filter(
|
||||
a =>
|
||||
findTag(a, "content-warning") === undefined &&
|
||||
(!import.meta.env.VITE_SINGLE_PUBLISHER || import.meta.env.VITE_SINGLE_PUBLISHER === getHost(a))
|
||||
);
|
||||
}
|
||||
return [...feed].filter(
|
||||
a => !import.meta.env.VITE_SINGLE_PUBLISHER || import.meta.env.VITE_SINGLE_PUBLISHER === getHost(a)
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}, [feed]);
|
||||
|
||||
const live = feedSorted.filter(a => findTag(a, "status") === StreamState.Live).sort(sortStarts);
|
||||
const live = feedSorted
|
||||
.filter(a => {
|
||||
try {
|
||||
return (
|
||||
findTag(a, "status") === StreamState.Live &&
|
||||
a.tags.some(a => a[0] === "streaming" && new URL(a[1]).pathname.includes(".m3u8"))
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.sort(sortStarts);
|
||||
const planned = feedSorted.filter(a => findTag(a, "status") === StreamState.Planned).sort(sortStarts);
|
||||
const ended = feedSorted
|
||||
.filter(a => {
|
||||
|
@ -162,7 +162,7 @@ export function StreamPage({ link, evPreload }: { evPreload?: NostrEvent; link:
|
||||
status={status}
|
||||
/>
|
||||
</Suspense>
|
||||
<ProfileInfo ev={ev} goal={goal} />
|
||||
<ProfileInfo ev={ev as TaggedNostrEvent} goal={goal} />
|
||||
<StreamCards host={host} />
|
||||
</div>
|
||||
<LiveChat
|
||||
|
@ -41,7 +41,5 @@ export default defineConfig({
|
||||
},
|
||||
define: {
|
||||
global: {},
|
||||
__XXX: process.env["__XXX"] || JSON.stringify(false),
|
||||
__XXX_HOST: JSON.stringify("https://xxzap.com"),
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user