forked from Kieran/snort
add more paid relays
This commit is contained in:
parent
c35b144dba
commit
6fef29a41e
@ -40,8 +40,10 @@ export const ProfileCacheExpire = 1_000 * 60 * 5;
|
|||||||
*/
|
*/
|
||||||
export const DefaultRelays = new Map<string, RelaySettings>([
|
export const DefaultRelays = new Map<string, RelaySettings>([
|
||||||
["wss://relay.snort.social", { read: true, write: true }],
|
["wss://relay.snort.social", { read: true, write: true }],
|
||||||
["wss://eden.nostr.land", { read: true, write: true }],
|
["wss://nostr.wine", { read: true, write: false }],
|
||||||
["wss://atlas.nostr.land", { read: true, write: true }],
|
["wss://eden.nostr.land", { read: true, write: false }],
|
||||||
|
["wss://atlas.nostr.land", { read: true, write: false }],
|
||||||
|
["wss://relay.orangepill.dev", { read: true, write: false }],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "./Root.css";
|
import "./Root.css";
|
||||||
import { useMemo, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useIntl, FormattedMessage } from "react-intl";
|
import { useIntl, FormattedMessage } from "react-intl";
|
||||||
@ -11,10 +11,11 @@ import { TimelineSubject } from "Feed/TimelineFeed";
|
|||||||
|
|
||||||
import messages from "./messages";
|
import messages from "./messages";
|
||||||
import { System } from "Nostr/System";
|
import { System } from "Nostr/System";
|
||||||
|
import { debounce } from "Util";
|
||||||
|
|
||||||
export default function RootPage() {
|
export default function RootPage() {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const { loggedOut, publicKey: pubKey, follows, tags } = useSelector((s: RootState) => s.login);
|
const { loggedOut, publicKey: pubKey, follows, tags, relays } = useSelector((s: RootState) => s.login);
|
||||||
const RootTab: Record<string, Tab> = {
|
const RootTab: Record<string, Tab> = {
|
||||||
Posts: {
|
Posts: {
|
||||||
text: formatMessage(messages.Posts),
|
text: formatMessage(messages.Posts),
|
||||||
@ -31,6 +32,7 @@ export default function RootPage() {
|
|||||||
};
|
};
|
||||||
const [tab, setTab] = useState<Tab>(RootTab.Posts);
|
const [tab, setTab] = useState<Tab>(RootTab.Posts);
|
||||||
const [relay, setRelay] = useState<string>();
|
const [relay, setRelay] = useState<string>();
|
||||||
|
const [globalRelays, setGlobalRelays] = useState<string[]>([]);
|
||||||
const tagTabs = tags.map((t, idx) => {
|
const tagTabs = tags.map((t, idx) => {
|
||||||
return { text: `#${t}`, value: idx + 3 };
|
return { text: `#${t}`, value: idx + 3 };
|
||||||
});
|
});
|
||||||
@ -53,18 +55,20 @@ export default function RootPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalRelays = useMemo(() => {
|
useEffect(() => {
|
||||||
const ret: string[] = [];
|
return debounce(1_000, () => {
|
||||||
System.Sockets.forEach((v, k) => {
|
const ret: string[] = [];
|
||||||
if (v.Info?.limitation?.payment_required === true) {
|
System.Sockets.forEach((v, k) => {
|
||||||
ret.push(k);
|
if (v.Info?.limitation?.payment_required === true) {
|
||||||
}
|
ret.push(k);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (ret.length > 0 && !relay) {
|
if (ret.length > 0 && !relay) {
|
||||||
setRelay(ret[0]);
|
setRelay(ret[0]);
|
||||||
}
|
}
|
||||||
return ret;
|
setGlobalRelays(ret);
|
||||||
|
});
|
||||||
}, [relays, relay]);
|
}, [relays, relay]);
|
||||||
|
|
||||||
const isGlobal = loggedOut || tab.value === RootTab.Global.value;
|
const isGlobal = loggedOut || tab.value === RootTab.Global.value;
|
||||||
@ -109,7 +113,7 @@ export default function RootPage() {
|
|||||||
subject={timelineSubect}
|
subject={timelineSubect}
|
||||||
postsOnly={tab.value === RootTab.Posts.value}
|
postsOnly={tab.value === RootTab.Posts.value}
|
||||||
method={"TIME_RANGE"}
|
method={"TIME_RANGE"}
|
||||||
window={isGlobal ? 60 : undefined}
|
window={undefined}
|
||||||
relay={isGlobal ? relay : undefined}
|
relay={isGlobal ? relay : undefined}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user