revamp onboarding and launching process
This commit is contained in:
@@ -219,7 +219,7 @@ export function useNostr() {
|
||||
const relayMap = new Map<string, string[]>();
|
||||
const relayEvents = fetcher.fetchLatestEventsPerAuthor(
|
||||
{
|
||||
authors: db.account.follows,
|
||||
authors: db.account.contacts,
|
||||
relayUrls: relayUrls,
|
||||
},
|
||||
{ kinds: [NDKKind.RelayList] },
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NDKUserProfile } from '@nostr-dev-kit/ndk';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
|
||||
import { useNDK } from '@libs/ndk/provider';
|
||||
|
||||
@@ -17,10 +18,13 @@ export function useProfile(pubkey: string, embed?: string) {
|
||||
return profile;
|
||||
}
|
||||
|
||||
const cleanPubkey = pubkey.replace(/[^a-zA-Z0-9]/g, '');
|
||||
const user = ndk.getUser({ pubkey: cleanPubkey });
|
||||
let hexstring = pubkey.replace(/[^a-zA-Z0-9]/g, '');
|
||||
if (hexstring.startsWith('npub1'))
|
||||
hexstring = nip19.decode(hexstring).data as string;
|
||||
|
||||
const user = ndk.getUser({ pubkey: hexstring });
|
||||
if (!user) return Promise.reject(new Error("user's profile not found"));
|
||||
|
||||
return await user.fetchProfile();
|
||||
},
|
||||
staleTime: Infinity,
|
||||
|
||||
18
src/utils/types.d.ts
vendored
18
src/utils/types.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { type NDKEvent, type NDKUserProfile } from '@nostr-dev-kit/ndk';
|
||||
import { type NDKEvent, NDKRelayList, type NDKUserProfile } from '@nostr-dev-kit/ndk';
|
||||
import { type Response } from '@tauri-apps/plugin-http';
|
||||
|
||||
export interface RichContent {
|
||||
@@ -21,18 +21,16 @@ export interface DBEvent {
|
||||
richContent?: RichContent;
|
||||
}
|
||||
|
||||
export interface Account extends NDKUserProfile {
|
||||
export interface Account {
|
||||
id: string;
|
||||
pubkey: string;
|
||||
follows: null | string[];
|
||||
circles: null | string[];
|
||||
is_active: number;
|
||||
last_login_at: number;
|
||||
}
|
||||
|
||||
export interface Profile extends NDKUserProfile {
|
||||
ident?: string;
|
||||
pubkey?: string;
|
||||
contacts: string[];
|
||||
relayList: NDKRelayList;
|
||||
/**
|
||||
* @deprecated Use contacts instead
|
||||
*/
|
||||
follows: string[];
|
||||
}
|
||||
|
||||
export interface WidgetGroup {
|
||||
|
||||
Reference in New Issue
Block a user