fix: filter by host
This commit is contained in:
@ -6,7 +6,7 @@ import { useRequestBuilder } from "@snort/system-react";
|
|||||||
import { unixNow } from "@snort/shared";
|
import { unixNow } from "@snort/shared";
|
||||||
import { LIVE_STREAM } from "const";
|
import { LIVE_STREAM } from "const";
|
||||||
import { StreamState } from "index";
|
import { StreamState } from "index";
|
||||||
import { findTag } from "utils";
|
import { findTag, getHost } from "utils";
|
||||||
import { WEEK } from "const";
|
import { WEEK } from "const";
|
||||||
|
|
||||||
export function useStreamsFeed(tag?: string) {
|
export function useStreamsFeed(tag?: string) {
|
||||||
@ -17,16 +17,9 @@ export function useStreamsFeed(tag?: string) {
|
|||||||
leaveOpen: true,
|
leaveOpen: true,
|
||||||
});
|
});
|
||||||
if (tag) {
|
if (tag) {
|
||||||
rb.withFilter()
|
rb.withFilter().kinds([LIVE_STREAM]).tag("t", [tag]).since(since);
|
||||||
.kinds([LIVE_STREAM])
|
|
||||||
.tag("t", [tag])
|
|
||||||
.since(since)
|
|
||||||
.authors(__SINGLE_PUBLISHER ? [__SINGLE_PUBLISHER] : undefined);
|
|
||||||
} else {
|
} else {
|
||||||
rb.withFilter()
|
rb.withFilter().kinds([LIVE_STREAM]).since(since);
|
||||||
.kinds([LIVE_STREAM])
|
|
||||||
.since(since)
|
|
||||||
.authors(__SINGLE_PUBLISHER ? [__SINGLE_PUBLISHER] : undefined);
|
|
||||||
}
|
}
|
||||||
return rb;
|
return rb;
|
||||||
}, [tag, since]);
|
}, [tag, since]);
|
||||||
@ -45,9 +38,13 @@ export function useStreamsFeed(tag?: string) {
|
|||||||
const feedSorted = useMemo(() => {
|
const feedSorted = useMemo(() => {
|
||||||
if (feed.data) {
|
if (feed.data) {
|
||||||
if (__XXX) {
|
if (__XXX) {
|
||||||
return [...feed.data].filter(a => findTag(a, "content-warning") !== undefined);
|
return [...feed.data].filter(
|
||||||
|
a => findTag(a, "content-warning") !== undefined && (!__SINGLE_PUBLISHER || __SINGLE_PUBLISHER === getHost(a))
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return [...feed.data].filter(a => findTag(a, "content-warning") === undefined);
|
return [...feed.data].filter(
|
||||||
|
a => findTag(a, "content-warning") === undefined && (!__SINGLE_PUBLISHER || __SINGLE_PUBLISHER === getHost(a))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
|
Reference in New Issue
Block a user