mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-19 19:46:34 +00:00
update relay list
This commit is contained in:
parent
95e4a27b69
commit
01dff9f3c8
@ -20,8 +20,12 @@ export const ChannelListItem = ({ data }: { data: any }) => {
|
||||
pageID === data.event_id ? 'dark:bg-zinc-900 dark:text-zinc-100 hover:dark:bg-zinc-800' : ''
|
||||
)}
|
||||
>
|
||||
<div className="relative h-5 w-5 shrink-0 rounded bg-zinc-900">
|
||||
<img src={channel?.picture || DEFAULT_AVATAR} alt={data.event_id} className="h-5 w-5 rounded object-contain" />
|
||||
<div className="relative h-5 w-5 shrink-0 rounded">
|
||||
<img
|
||||
src={channel?.picture || DEFAULT_AVATAR}
|
||||
alt={data.event_id}
|
||||
className="h-5 w-5 rounded bg-white object-cover"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h5 className="truncate text-sm font-medium text-zinc-400">{channel?.name}</h5>
|
||||
|
@ -2,15 +2,13 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { AvatarUploader } from '@components/avatarUploader';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { defaultChannelsAtom } from '@stores/channel';
|
||||
import { DEFAULT_AVATAR, MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
import { createChannel } from '@utils/storage';
|
||||
|
||||
import { Dialog, Transition } from '@headlessui/react';
|
||||
import { Cancel, Plus } from 'iconoir-react';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { getEventHash, signEvent } from 'nostr-tools';
|
||||
import { Fragment, useContext, useEffect, useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
@ -24,8 +22,6 @@ export const CreateChannelModal = () => {
|
||||
const [image, setImage] = useState(DEFAULT_AVATAR);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const setChannel = useSetAtom(defaultChannelsAtom);
|
||||
|
||||
const closeModal = () => {
|
||||
setIsOpen(false);
|
||||
};
|
||||
@ -56,21 +52,12 @@ export const CreateChannelModal = () => {
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
// publish channel
|
||||
pool.publish(event, MESSAGE_RELAYS);
|
||||
// update jotai state
|
||||
setChannel((prev: any) => [
|
||||
...prev,
|
||||
{
|
||||
event_id: event.id,
|
||||
metadata: { name: data.name, picture: data.picture, about: data.about },
|
||||
created_at: event.created_at,
|
||||
},
|
||||
]);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
// insert to database
|
||||
createChannel(event.id, event.pubkey, event.content, event.created_at);
|
||||
// reset form
|
||||
reset();
|
||||
setTimeout(() => {
|
||||
// insert to database
|
||||
createChannel(event.id, event.content, event.created_at);
|
||||
// close modal
|
||||
setIsOpen(false);
|
||||
// redirect to channel page
|
||||
|
@ -2,7 +2,7 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import Tooltip from '@components/tooltip';
|
||||
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -26,7 +26,7 @@ export const HideMessageButton = ({ id }: { id: string }) => {
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
// publish note
|
||||
pool.publish(event, MESSAGE_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
}, [activeAccount.pubkey, activeAccount.privkey, id, pool]);
|
||||
|
||||
return (
|
||||
|
@ -2,7 +2,7 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import Tooltip from '@components/tooltip';
|
||||
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -26,7 +26,7 @@ export const MuteButton = ({ pubkey }: { pubkey: string }) => {
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
// publish note
|
||||
pool.publish(event, MESSAGE_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -2,11 +2,11 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { NetworkStatusIndicator } from '@components/networkStatusIndicator';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
import { hasNewerNoteAtom } from '@stores/note';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
import { createChannel, createChat, createNote, updateAccount } from '@utils/storage';
|
||||
import { createChat, createNote, updateAccount } from '@utils/storage';
|
||||
import { getParentID, nip02ToArray } from '@utils/transform';
|
||||
|
||||
import { useSetAtom } from 'jotai';
|
||||
@ -17,11 +17,10 @@ export default function EventCollector() {
|
||||
const activeAccount: any = useContext(AccountContext);
|
||||
|
||||
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
|
||||
const follows = activeAccount.follows ? JSON.parse(activeAccount.follows) : [];
|
||||
|
||||
const now = useRef(new Date());
|
||||
|
||||
const subscribe = useCallback(async () => {
|
||||
const follows = activeAccount.follows ? JSON.parse(activeAccount.follows) : [];
|
||||
const unsubscribe = pool.subscribe(
|
||||
[
|
||||
{
|
||||
@ -38,12 +37,8 @@ export default function EventCollector() {
|
||||
'#p': [activeAccount.pubkey],
|
||||
since: dateToUnix(now.current),
|
||||
},
|
||||
{
|
||||
kinds: [40],
|
||||
since: dateToUnix(now.current),
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: { kind: number; tags: string[]; id: string; pubkey: string; content: string; created_at: number }) => {
|
||||
switch (event.kind) {
|
||||
// metadata
|
||||
@ -91,10 +86,6 @@ export default function EventCollector() {
|
||||
''
|
||||
);
|
||||
break;
|
||||
// channel
|
||||
case 40:
|
||||
createChannel(event.id, event.content, event.created_at);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -104,7 +95,7 @@ export default function EventCollector() {
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [activeAccount.id, activeAccount.pubkey, follows, pool, setHasNewerNote]);
|
||||
}, [activeAccount.id, activeAccount.pubkey, activeAccount.follows, pool, setHasNewerNote]);
|
||||
|
||||
useEffect(() => {
|
||||
let ignore = false;
|
||||
|
@ -2,7 +2,7 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { ImagePicker } from '@components/form/imagePicker';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
import { noteContentAtom } from '@stores/note';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
@ -31,7 +31,7 @@ export default function FormBase() {
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
// publish note
|
||||
pool.publish(event, DEFAULT_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
// reset form
|
||||
resetValue();
|
||||
// send notification
|
||||
|
@ -4,7 +4,7 @@ import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserMini } from '@components/user/mini';
|
||||
|
||||
import { channelContentAtom, channelReplyAtom } from '@stores/channel';
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { FULL_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -48,7 +48,7 @@ export const FormChannel = ({ eventId }: { eventId: string | string[] }) => {
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
// publish note
|
||||
pool.publish(event, MESSAGE_RELAYS);
|
||||
pool.publish(event, FULL_RELAYS);
|
||||
// reset state
|
||||
resetValue();
|
||||
// reset channel reply
|
||||
|
@ -3,7 +3,7 @@ import { ImagePicker } from '@components/form/imagePicker';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { chatContentAtom } from '@stores/chat';
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { FULL_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -39,7 +39,7 @@ export default function FormChat({ receiverPubkey }: { receiverPubkey: string })
|
||||
event.id = getEventHash(event);
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
// publish note
|
||||
pool.publish(event, MESSAGE_RELAYS);
|
||||
pool.publish(event, FULL_RELAYS);
|
||||
// reset state
|
||||
resetValue();
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -28,7 +28,7 @@ export default function FormComment({ eventID }: { eventID: any }) {
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
// publish note
|
||||
pool.publish(event, DEFAULT_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
// send notification
|
||||
// sendNotification('Comment has been published successfully');
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -56,7 +56,7 @@ export const NoteComment = ({
|
||||
event.id = getEventHash(event);
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
|
||||
pool.publish(event, DEFAULT_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
setIsOpen(false);
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
@ -43,7 +43,7 @@ export const NoteReaction = ({
|
||||
event.id = getEventHash(event);
|
||||
event.sig = signEvent(event, activeAccount.privkey);
|
||||
// publish event to all relays
|
||||
pool.publish(event, DEFAULT_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
// update state to change icon to filled heart
|
||||
setIsReact(true);
|
||||
// update counter
|
||||
|
@ -3,7 +3,7 @@ import { NoteComment } from '@components/note/meta/comment';
|
||||
import { NoteReaction } from '@components/note/meta/reaction';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { memo, useContext, useEffect, useState } from 'react';
|
||||
|
||||
@ -34,7 +34,7 @@ export const NoteMetadata = memo(function NoteMetadata({
|
||||
kinds: [1, 7],
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: any) => {
|
||||
switch (event.kind) {
|
||||
case 1:
|
||||
|
@ -3,7 +3,7 @@ import { NoteMetadata } from '@components/note/metadata';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { contentParser } from '@utils/parser';
|
||||
import { createNote, getNoteByID } from '@utils/storage';
|
||||
@ -26,7 +26,7 @@ export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||
kinds: [1],
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: any) => {
|
||||
// update state
|
||||
setEvent(event);
|
||||
|
@ -2,7 +2,7 @@ import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { contentParser } from '@utils/parser';
|
||||
import { createNote, getNoteByID } from '@utils/storage';
|
||||
@ -25,7 +25,7 @@ export const NoteQuote = memo(function NoteQuote({ id }: { id: string }) {
|
||||
kinds: [1],
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: any) => {
|
||||
// update state
|
||||
setEvent(event);
|
||||
|
@ -2,7 +2,7 @@ import { NoteMetadata } from '@components/note/metadata';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { contentParser } from '@utils/parser';
|
||||
|
||||
@ -38,7 +38,7 @@ export const RootNote = memo(function RootNote({ event }: { event: any }) {
|
||||
kinds: [1],
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: any) => {
|
||||
setData(event);
|
||||
setContent(contentParser(event.content, event.tags));
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserFollow } from '@components/user/follow';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import destr from 'destr';
|
||||
import { Author } from 'nostr-relaypool';
|
||||
@ -12,7 +12,7 @@ export default function ProfileFollowers({ id }: { id: string }) {
|
||||
const [followers, setFollowers] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const user = new Author(pool, DEFAULT_RELAYS, id);
|
||||
const user = new Author(pool, READONLY_RELAYS, id);
|
||||
user.followers((res) => setFollowers(destr(res.tags)), 0, 100);
|
||||
}, [id, pool]);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserFollow } from '@components/user/follow';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { Author } from 'nostr-relaypool';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
@ -11,7 +11,7 @@ export default function ProfileFollows({ id }: { id: string }) {
|
||||
const [follows, setFollows] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const user = new Author(pool, DEFAULT_RELAYS, id);
|
||||
const user = new Author(pool, READONLY_RELAYS, id);
|
||||
user.follows((res) => setFollows(res), 0);
|
||||
}, [id, pool]);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_AVATAR, DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { DEFAULT_AVATAR, READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { shortenKey } from '@utils/shortenKey';
|
||||
|
||||
@ -15,7 +15,7 @@ export default function ProfileMetadata({ id }: { id: string }) {
|
||||
const [profile, setProfile] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const user = new Author(pool, DEFAULT_RELAYS, id);
|
||||
const user = new Author(pool, READONLY_RELAYS, id);
|
||||
user.metaData((res) => setProfile(destr(res.content)), 0);
|
||||
}, [id, pool]);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { NoteBase } from '@components/note/base';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { Author } from 'nostr-relaypool';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
@ -11,7 +11,7 @@ export default function ProfileNotes({ id }: { id: string }) {
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const user = new Author(pool, DEFAULT_RELAYS, id);
|
||||
const user = new Author(pool, READONLY_RELAYS, id);
|
||||
user.text((res) => setData((data) => [...data, res]), 100, 0);
|
||||
}, [id, pool]);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { RelayPool } from 'nostr-relaypool';
|
||||
import { createContext, useMemo } from 'react';
|
||||
@ -8,7 +8,7 @@ export const RelayContext = createContext({});
|
||||
export default function RelayProvider({ children }: { children: React.ReactNode }) {
|
||||
const pool = useMemo(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
return new RelayPool(DEFAULT_RELAYS, { useEventCache: false, logSubscriptions: false });
|
||||
return new RelayPool(READONLY_RELAYS, { useEventCache: false, logSubscriptions: false });
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import NewsfeedLayout from '@components/layouts/newsfeed';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { channelMessagesAtom, channelReplyAtom } from '@stores/channel';
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { FULL_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix, hoursAgo } from '@utils/getDate';
|
||||
import { usePageContext } from '@utils/hooks/usePageContext';
|
||||
@ -59,7 +59,7 @@ export function Page() {
|
||||
since: dateToUnix(hoursAgo(48, now.current)),
|
||||
},
|
||||
],
|
||||
MESSAGE_RELAYS,
|
||||
FULL_RELAYS,
|
||||
(event: { kind: number; tags: string[][]; pubkey: string; id: string }) => {
|
||||
if (muted.includes(event.pubkey)) {
|
||||
console.log('muted');
|
||||
|
@ -4,7 +4,7 @@ import NewsfeedLayout from '@components/layouts/newsfeed';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { chatMessagesAtom } from '@stores/chat';
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { FULL_RELAYS } from '@stores/constants';
|
||||
|
||||
import { usePageContext } from '@utils/hooks/usePageContext';
|
||||
|
||||
@ -44,7 +44,7 @@ export function Page() {
|
||||
'#p': [pubkey],
|
||||
},
|
||||
],
|
||||
MESSAGE_RELAYS,
|
||||
FULL_RELAYS,
|
||||
(event: any) => {
|
||||
setChatMessages((prev) => [...prev, event]);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { MESSAGE_RELAYS } from '@stores/constants';
|
||||
import { FULL_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix, hoursAgo } from '@utils/getDate';
|
||||
import {
|
||||
@ -69,7 +69,7 @@ export function Page() {
|
||||
// subscribe relays
|
||||
const unsubscribe = pool.subscribe(
|
||||
query,
|
||||
MESSAGE_RELAYS,
|
||||
FULL_RELAYS,
|
||||
(event: { kind: number; tags: string[]; id: string; pubkey: string; content: string; created_at: number }) => {
|
||||
switch (event.kind) {
|
||||
// short text note
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OnboardingLayout from '@components/layouts/onboarding';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { createAccount } from '@utils/storage';
|
||||
|
||||
@ -60,7 +60,7 @@ export function Page() {
|
||||
// insert to database
|
||||
createAccount(pubkey, privkey, metadata);
|
||||
// broadcast
|
||||
pool.publish(event, DEFAULT_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
// redirect to next step
|
||||
navigate(`/onboarding/create/step-2?pubkey=${pubkey}&privkey=${privkey}`, { overwriteLastHistoryEntry: true });
|
||||
}, [pool, pubkey, privkey, metadata]);
|
||||
|
@ -2,7 +2,7 @@ import OnboardingLayout from '@components/layouts/onboarding';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserBase } from '@components/user/base';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { WRITEONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { usePageContext } from '@utils/hooks/usePageContext';
|
||||
import { fetchProfileMetadata } from '@utils/hooks/useProfileMetadata';
|
||||
@ -100,7 +100,7 @@ export function Page() {
|
||||
event.id = getEventHash(event);
|
||||
event.sig = signEvent(event, privkey);
|
||||
// broadcast
|
||||
pool.publish(event, DEFAULT_RELAYS);
|
||||
pool.publish(event, WRITEONLY_RELAYS);
|
||||
// redirect to splashscreen
|
||||
navigate('/');
|
||||
}, [pubkey, privkey, follows, pool]);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OnboardingLayout from '@components/layouts/onboarding';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_AVATAR, DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { DEFAULT_AVATAR, READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { usePageContext } from '@utils/hooks/usePageContext';
|
||||
import { fetchProfileMetadata } from '@utils/hooks/useProfileMetadata';
|
||||
@ -53,7 +53,7 @@ export function Page() {
|
||||
authors: [pubkey],
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: any) => {
|
||||
switch (event.kind) {
|
||||
case 0:
|
||||
|
@ -1,16 +1,6 @@
|
||||
import { DEFAULT_CHANNELS } from '@stores/constants';
|
||||
|
||||
import { atom } from 'jotai';
|
||||
import { atomWithReset } from 'jotai/utils';
|
||||
|
||||
// channel list
|
||||
export const defaultChannelsAtom = atom(DEFAULT_CHANNELS);
|
||||
export const channelsAtom = atom(async (get) => {
|
||||
const { getChannels } = await import('@utils/storage');
|
||||
const result: any = await getChannels(100, 0);
|
||||
return get(defaultChannelsAtom).concat(result);
|
||||
});
|
||||
|
||||
// channel reply id
|
||||
export const channelReplyAtom = atomWithReset({ id: null, pubkey: null, content: null });
|
||||
|
||||
|
@ -1,35 +1,22 @@
|
||||
export const APP_VERSION = '0.2.5';
|
||||
|
||||
export const DEFAULT_AVATAR = 'https://void.cat/d/KmypFh2fBdYCEvyJrPiN89.webp';
|
||||
|
||||
export const DEFAULT_CHANNEL_BANNER =
|
||||
'https://bafybeiacwit7hjmdefqggxqtgh6ht5dhth7ndptwn2msl5kpkodudsr7py.ipfs.w3s.link/banner-1.jpg';
|
||||
export const DEFAULT_CHANNELS = [
|
||||
{
|
||||
event_id: 'e3cadf5beca1b2af1cddaa41a633679bedf263e3de1eb229c6686c50d85df753',
|
||||
metadata: {
|
||||
name: 'Lume General',
|
||||
picture: 'https://void.cat/d/UNyxBmAh1MUx5gQTX95jyf.webp',
|
||||
about: 'General discussion about the Lume client',
|
||||
},
|
||||
created_at: 1681898574,
|
||||
},
|
||||
{
|
||||
event_id: '1abf8948d2fd05dd1836b33b324dca65138b2e80c77b27eeeed4323246efba4d',
|
||||
metadata: { picture: 'https://void.cat/d/MsqUKXXC4SxDfmT2KiHovJ.webp', name: 'Arcade Open R&D', about: '' },
|
||||
created_at: 1682252461,
|
||||
},
|
||||
{
|
||||
event_id: '25e5c82273a271cb1a840d0060391a0bf4965cafeb029d5ab55350b418953fbb',
|
||||
metadata: {
|
||||
about: '',
|
||||
name: 'Nostr',
|
||||
picture: 'https://cloudflare-ipfs.com/ipfs/QmTN4Eas9atUULVbEAbUU8cowhtvK7g3t7jfKztY7wc8eP?.png',
|
||||
},
|
||||
created_at: 1661333723,
|
||||
},
|
||||
];
|
||||
export const DEFAULT_RELAYS = ['wss://welcome.nostr.wine', 'wss://relay.nostr.band', 'wss://nostr.mutinywallet.com'];
|
||||
export const MESSAGE_RELAYS = [
|
||||
|
||||
// read-only relay list
|
||||
export const READONLY_RELAYS = ['wss://welcome.nostr.wine', 'wss://relay.nostr.band'];
|
||||
|
||||
// write-only relay list
|
||||
export const WRITEONLY_RELAYS = ['wss://nostr.mutinywallet.com', 'wss://relay.nostr.band'];
|
||||
|
||||
// full-relay list, used for inital page and chat/channel messages loading
|
||||
export const FULL_RELAYS = [
|
||||
'wss://relay.damus.io',
|
||||
'wss://nos.lol',
|
||||
'wss://nostr.mom',
|
||||
'wss://relay.plebstr.com',
|
||||
'wss://nostr-pub.wellorder.net',
|
||||
'wss://nostr.zebedee.cloud',
|
||||
'wss://nostr.fmt.wiz.biz',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { READONLY_RELAYS } from '@stores/constants';
|
||||
|
||||
import { updateChannelMetadata } from '@utils/storage';
|
||||
import { getChannel } from '@utils/storage';
|
||||
@ -23,7 +23,7 @@ export const useChannelMetadata = (id: string, channelPubkey: string) => {
|
||||
kinds: [40],
|
||||
},
|
||||
],
|
||||
DEFAULT_RELAYS,
|
||||
READONLY_RELAYS,
|
||||
(event: { kind: number; pubkey: string; content: string }) => {
|
||||
switch (event.kind) {
|
||||
case 41:
|
||||
|
Loading…
Reference in New Issue
Block a user