mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-19 11:43:30 +00:00
update
This commit is contained in:
parent
7c8d8a09fd
commit
de88ca51fe
@ -35,7 +35,7 @@ export function FollowList() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rounded-xl bg-neutral-100 p-3 text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200">
|
<div className="relative rounded-xl bg-neutral-100 p-3 text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200">
|
||||||
<h5 className="font-semibold">Your follows</h5>
|
<h5 className="font-semibold">Your follows</h5>
|
||||||
<div className="mt-2 flex w-full items-center justify-center">
|
<div className="mt-2 flex w-full items-center justify-center">
|
||||||
{status === 'loading' ? (
|
{status === 'loading' ? (
|
||||||
|
@ -47,6 +47,8 @@ export function ImportAccountScreen() {
|
|||||||
await db.secureSave(pubkey + '-bunker', localSigner.privateKey);
|
await db.secureSave(pubkey + '-bunker', localSigner.privateKey);
|
||||||
|
|
||||||
const remoteSigner = new NDKNip46Signer(ndk, npub, localSigner);
|
const remoteSigner = new NDKNip46Signer(ndk, npub, localSigner);
|
||||||
|
await remoteSigner.blockUntilReady();
|
||||||
|
|
||||||
ndk.signer = remoteSigner;
|
ndk.signer = remoteSigner;
|
||||||
|
|
||||||
setPubkey(pubkey);
|
setPubkey(pubkey);
|
||||||
|
@ -11,17 +11,17 @@ import { SuggestFollow } from '@app/auth/components/features/suggestFollow';
|
|||||||
import { LoaderIcon } from '@shared/icons';
|
import { LoaderIcon } from '@shared/icons';
|
||||||
|
|
||||||
export function OnboardingListScreen() {
|
export function OnboardingListScreen() {
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const { state } = useLocation();
|
const { state } = useLocation();
|
||||||
const { newuser }: { newuser: boolean } = state;
|
const { newuser }: { newuser: boolean } = state;
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const completed = () => {
|
const completed = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
const timeout = setTimeout(() => setLoading(false), 1200);
|
const timeout = setTimeout(() => setLoading(false), 200);
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
navigate('/');
|
navigate('/');
|
||||||
|
@ -1,22 +1,25 @@
|
|||||||
import { NDKEvent } from '@nostr-dev-kit/ndk';
|
import { NDKEvent, NDKUser } from '@nostr-dev-kit/ndk';
|
||||||
import { nip04 } from 'nostr-tools';
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import { useNDK } from '@libs/ndk/provider';
|
||||||
import { useStorage } from '@libs/storage/provider';
|
import { useStorage } from '@libs/storage/provider';
|
||||||
|
|
||||||
export function useDecryptMessage(message: NDKEvent) {
|
export function useDecryptMessage(message: NDKEvent) {
|
||||||
const { db } = useStorage();
|
const { db } = useStorage();
|
||||||
|
const { ndk } = useNDK();
|
||||||
|
|
||||||
const [content, setContent] = useState(message.content);
|
const [content, setContent] = useState(message.content);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function decryptContent() {
|
async function decryptContent() {
|
||||||
try {
|
try {
|
||||||
const privkey = await db.secureLoad(db.account.pubkey);
|
const sender = new NDKUser({
|
||||||
const sender =
|
hexpubkey:
|
||||||
db.account.pubkey === message.pubkey
|
db.account.pubkey === message.pubkey
|
||||||
? message.tags.find((el) => el[0] === 'p')[1]
|
? message.tags.find((el) => el[0] === 'p')[1]
|
||||||
: message.pubkey;
|
: message.pubkey,
|
||||||
const result = await nip04.decrypt(privkey, sender, message.content);
|
});
|
||||||
|
const result = await ndk.signer.decrypt(sender, message.content);
|
||||||
setContent(result);
|
setContent(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
@ -60,7 +60,7 @@ export const NDKInstance = () => {
|
|||||||
if (localSignerPrivkey) {
|
if (localSignerPrivkey) {
|
||||||
const localSigner = new NDKPrivateKeySigner(localSignerPrivkey);
|
const localSigner = new NDKPrivateKeySigner(localSignerPrivkey);
|
||||||
const remoteSigner = new NDKNip46Signer(instance, db.account.id, localSigner);
|
const remoteSigner = new NDKNip46Signer(instance, db.account.id, localSigner);
|
||||||
// await remoteSigner.blockUntilReady();
|
await remoteSigner.blockUntilReady();
|
||||||
|
|
||||||
return remoteSigner;
|
return remoteSigner;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,9 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
|
|||||||
if (uri) setWalletConnectURL(uri);
|
if (uri) setWalletConnectURL(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWalletConnectURL();
|
if (isOpen) {
|
||||||
|
getWalletConnectURL();
|
||||||
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setAmount('21');
|
setAmount('21');
|
||||||
@ -92,7 +94,7 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
|
|||||||
setIsCompleted(false);
|
setIsCompleted(false);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
}, []);
|
}, [isOpen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog.Root open={isOpen} onOpenChange={setIsOpen}>
|
<Dialog.Root open={isOpen} onOpenChange={setIsOpen}>
|
||||||
|
@ -47,23 +47,25 @@ export const User = memo(function User({
|
|||||||
if (status === 'loading') {
|
if (status === 'loading') {
|
||||||
if (variant === 'avatar') {
|
if (variant === 'avatar') {
|
||||||
return (
|
return (
|
||||||
<div className="h-12 w-12 animate-pulse overflow-hidden rounded-lg bg-neutral-400 dark:bg-neutral-600" />
|
<div className="h-12 w-12 animate-pulse overflow-hidden rounded-lg bg-neutral-300 dark:bg-neutral-700" />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant === 'mention') {
|
if (variant === 'mention') {
|
||||||
return (
|
return (
|
||||||
<div className="relative flex items-center gap-3">
|
<div className="relative flex items-center gap-3">
|
||||||
<div className="relative z-10 h-6 w-6 shrink-0 animate-pulse overflow-hidden rounded bg-neutral-400 dark:bg-neutral-600" />
|
<div className="relative z-10 h-6 w-6 shrink-0 animate-pulse overflow-hidden rounded bg-neutral-300 dark:bg-neutral-700" />
|
||||||
<div className="h-3.5 w-36 animate-pulse rounded bg-neutral-400 dark:bg-neutral-600" />
|
<div className="h-3.5 w-36 animate-pulse rounded bg-neutral-300 dark:bg-neutral-700" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-start gap-3">
|
<div className="flex items-start gap-3">
|
||||||
<div className="h-10 w-10 shrink-0 animate-pulse rounded-lg bg-neutral-400 dark:bg-neutral-600" />
|
<div className="h-10 w-10 shrink-0 animate-pulse rounded-lg bg-neutral-300 dark:bg-neutral-700" />
|
||||||
<div className="h-6 w-36 animate-pulse rounded bg-neutral-400 dark:bg-neutral-600" />
|
<div className="h-6 w-full">
|
||||||
|
<div className="h-3 w-24 animate-pulse rounded bg-neutral-300 dark:bg-neutral-700" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
import {
|
import { NDKEvent, NDKFilter, NDKKind, NDKSubscription } from '@nostr-dev-kit/ndk';
|
||||||
NDKEvent,
|
|
||||||
NDKFilter,
|
|
||||||
NDKKind,
|
|
||||||
NDKPrivateKeySigner,
|
|
||||||
NDKSubscription,
|
|
||||||
} from '@nostr-dev-kit/ndk';
|
|
||||||
import { message, open } from '@tauri-apps/plugin-dialog';
|
import { message, open } from '@tauri-apps/plugin-dialog';
|
||||||
import { fetch } from '@tauri-apps/plugin-http';
|
import { fetch } from '@tauri-apps/plugin-http';
|
||||||
import { LRUCache } from 'lru-cache';
|
import { LRUCache } from 'lru-cache';
|
||||||
@ -318,15 +312,6 @@ export function useNostr() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createZap = async (event: NDKEvent, amount: number, message?: string) => {
|
const createZap = async (event: NDKEvent, amount: number, message?: string) => {
|
||||||
const privkey: string = await db.secureLoad(db.account.pubkey);
|
|
||||||
// #TODO: show prompt
|
|
||||||
if (!privkey) return;
|
|
||||||
|
|
||||||
if (!ndk.signer) {
|
|
||||||
const signer = new NDKPrivateKeySigner(privkey);
|
|
||||||
ndk.signer = signer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-expect-error, NostrEvent to NDKEvent
|
// @ts-expect-error, NostrEvent to NDKEvent
|
||||||
const ndkEvent = new NDKEvent(ndk, event);
|
const ndkEvent = new NDKEvent(ndk, event);
|
||||||
const res = await ndkEvent.zap(amount, message ?? 'zap from lume');
|
const res = await ndkEvent.zap(amount, message ?? 'zap from lume');
|
||||||
|
Loading…
Reference in New Issue
Block a user