Merge branch 'use-signer-stream-load' into 'main'

Move useSignerStream to SoapboxLoad

See merge request soapbox-pub/soapbox!3043
environments/review-main-yi2y9f/deployments/4656
Alex Gleason 4 months ago
commit 7a0ec9fa31

@ -32,7 +32,7 @@ export class NConnect {
const pubkey = await this.signer.getPublicKey(); const pubkey = await this.signer.getPublicKey();
const signal = this.controller.signal; 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') { if (msg[0] === 'EVENT') {
const event = msg[2]; const event = msg[2];
this.handleEvent(event); this.handleEvent(event);
@ -61,11 +61,7 @@ export class NConnect {
// Prevent unauthorized access. // Prevent unauthorized access.
if (pubkey !== this.authorizedPubkey) { if (pubkey !== this.authorizedPubkey) {
return this.sendResponse(pubkey, { return;
id: request.id,
result: '',
error: 'Unauthorized',
});
} }
// Authorized methods. // Authorized methods.

@ -13,7 +13,6 @@ import { fetchScheduledStatuses } from 'soapbox/actions/scheduled-statuses';
import { fetchSuggestionsForTimeline } from 'soapbox/actions/suggestions'; import { fetchSuggestionsForTimeline } from 'soapbox/actions/suggestions';
import { expandHomeTimeline } from 'soapbox/actions/timelines'; import { expandHomeTimeline } from 'soapbox/actions/timelines';
import { useUserStream } from 'soapbox/api/hooks'; import { useUserStream } from 'soapbox/api/hooks';
import { useSignerStream } from 'soapbox/api/hooks/nostr/useSignerStream';
import SidebarNavigation from 'soapbox/components/sidebar-navigation'; import SidebarNavigation from 'soapbox/components/sidebar-navigation';
import ThumbNavigation from 'soapbox/components/thumb-navigation'; import ThumbNavigation from 'soapbox/components/thumb-navigation';
import { Layout } from 'soapbox/components/ui'; import { Layout } from 'soapbox/components/ui';
@ -462,7 +461,6 @@ const UI: React.FC<IUI> = ({ children }) => {
}, []); }, []);
useUserStream(); useUserStream();
useSignerStream();
// The user has logged in // The user has logged in
useEffect(() => { useEffect(() => {

@ -4,6 +4,7 @@ import { IntlProvider } from 'react-intl';
import { fetchInstance } from 'soapbox/actions/instance'; import { fetchInstance } from 'soapbox/actions/instance';
import { fetchMe } from 'soapbox/actions/me'; import { fetchMe } from 'soapbox/actions/me';
import { loadSoapboxConfig } from 'soapbox/actions/soapbox'; import { loadSoapboxConfig } from 'soapbox/actions/soapbox';
import { useSignerStream } from 'soapbox/api/hooks/nostr/useSignerStream';
import LoadingScreen from 'soapbox/components/loading-screen'; import LoadingScreen from 'soapbox/components/loading-screen';
import { import {
useAppSelector, useAppSelector,
@ -43,6 +44,8 @@ const SoapboxLoad: React.FC<ISoapboxLoad> = ({ children }) => {
const [localeLoading, setLocaleLoading] = useState(true); const [localeLoading, setLocaleLoading] = useState(true);
const [isLoaded, setIsLoaded] = useState(false); const [isLoaded, setIsLoaded] = useState(false);
useSignerStream();
/** Whether to display a loading indicator. */ /** Whether to display a loading indicator. */
const showLoading = [ const showLoading = [
me === null, me === null,

Loading…
Cancel
Save