From c2f95f57a84870456e960ad42dee306e0d31a5fa Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 29 May 2024 22:38:29 -0500 Subject: [PATCH] Move useSignerStream to SoapboxLoad --- src/features/nostr/NConnect.ts | 8 ++------ src/features/ui/index.tsx | 2 -- src/init/soapbox-load.tsx | 3 +++ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/features/nostr/NConnect.ts b/src/features/nostr/NConnect.ts index bfbea45da..1eb23c7de 100644 --- a/src/features/nostr/NConnect.ts +++ b/src/features/nostr/NConnect.ts @@ -32,7 +32,7 @@ export class NConnect { const pubkey = await this.signer.getPublicKey(); const signal = this.controller.signal; - for await (const msg of this.relay.req([{ kinds: [24133], '#p': [pubkey], limit: 0 }], { signal })) { + for await (const msg of this.relay.req([{ kinds: [24133], '#p': [pubkey] }], { signal })) { if (msg[0] === 'EVENT') { const event = msg[2]; this.handleEvent(event); @@ -61,11 +61,7 @@ export class NConnect { // Prevent unauthorized access. if (pubkey !== this.authorizedPubkey) { - return this.sendResponse(pubkey, { - id: request.id, - result: '', - error: 'Unauthorized', - }); + return; } // Authorized methods. diff --git a/src/features/ui/index.tsx b/src/features/ui/index.tsx index 32a52a034..552adf723 100644 --- a/src/features/ui/index.tsx +++ b/src/features/ui/index.tsx @@ -13,7 +13,6 @@ import { fetchScheduledStatuses } from 'soapbox/actions/scheduled-statuses'; import { fetchSuggestionsForTimeline } from 'soapbox/actions/suggestions'; import { expandHomeTimeline } from 'soapbox/actions/timelines'; import { useUserStream } from 'soapbox/api/hooks'; -import { useSignerStream } from 'soapbox/api/hooks/nostr/useSignerStream'; import SidebarNavigation from 'soapbox/components/sidebar-navigation'; import ThumbNavigation from 'soapbox/components/thumb-navigation'; import { Layout } from 'soapbox/components/ui'; @@ -462,7 +461,6 @@ const UI: React.FC = ({ children }) => { }, []); useUserStream(); - useSignerStream(); // The user has logged in useEffect(() => { diff --git a/src/init/soapbox-load.tsx b/src/init/soapbox-load.tsx index cc9b883f1..ccd3ce70e 100644 --- a/src/init/soapbox-load.tsx +++ b/src/init/soapbox-load.tsx @@ -4,6 +4,7 @@ import { IntlProvider } from 'react-intl'; import { fetchInstance } from 'soapbox/actions/instance'; import { fetchMe } from 'soapbox/actions/me'; import { loadSoapboxConfig } from 'soapbox/actions/soapbox'; +import { useSignerStream } from 'soapbox/api/hooks/nostr/useSignerStream'; import LoadingScreen from 'soapbox/components/loading-screen'; import { useAppSelector, @@ -43,6 +44,8 @@ const SoapboxLoad: React.FC = ({ children }) => { const [localeLoading, setLocaleLoading] = useState(true); const [isLoaded, setIsLoaded] = useState(false); + useSignerStream(); + /** Whether to display a loading indicator. */ const showLoading = [ me === null,