mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 11:13:30 +00:00
clean up
This commit is contained in:
parent
236131087a
commit
1d93f8cf6a
@ -21,7 +21,7 @@ export function NWCScreen() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center bg-white/5">
|
||||||
<div className="flex w-full flex-col gap-5">
|
<div className="flex w-full flex-col gap-5">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<h3 className="text-2xl font-bold leading-tight">
|
<h3 className="text-2xl font-bold leading-tight">
|
||||||
|
@ -40,13 +40,18 @@ export const NDKInstance = () => {
|
|||||||
const successes = responses.filter((res) => res.ok);
|
const successes = responses.filter((res) => res.ok);
|
||||||
|
|
||||||
const verifiedRelays: string[] = successes.map((res) => {
|
const verifiedRelays: string[] = successes.map((res) => {
|
||||||
// TODO: support payment
|
const url = new URL(res.url);
|
||||||
|
|
||||||
// @ts-expect-error, not have type yet
|
// @ts-expect-error, not have type yet
|
||||||
if (!res.data.limitation?.payment_required) {
|
if (res.data?.limitation?.payment_required) {
|
||||||
const url = new URL(res.url);
|
if (url.protocol === 'http:')
|
||||||
if (url.protocol === 'http:') return `ws://${url.hostname + url.pathname}`;
|
return `ws://${url.hostname + url.pathname + db.account.npub}`;
|
||||||
if (url.protocol === 'https:') return `wss://${url.hostname + url.pathname}`;
|
if (url.protocol === 'https:')
|
||||||
|
return `wss://${url.hostname + url.pathname + db.account.npub}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url.protocol === 'http:') return `ws://${url.hostname + url.pathname}`;
|
||||||
|
if (url.protocol === 'https:') return `wss://${url.hostname + url.pathname}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// return all validated relays
|
// return all validated relays
|
||||||
|
@ -25,26 +25,19 @@ export function ActiveAccount() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filter: NDKFilter = {
|
const filter: NDKFilter = {
|
||||||
'#p': [db.account.pubkey],
|
'#p': [db.account.pubkey],
|
||||||
kinds: [
|
kinds: [NDKKind.Text, NDKKind.Repost, NDKKind.Reaction, NDKKind.Zap],
|
||||||
NDKKind.Text,
|
|
||||||
NDKKind.Contacts,
|
|
||||||
NDKKind.Repost,
|
|
||||||
NDKKind.Reaction,
|
|
||||||
NDKKind.Zap,
|
|
||||||
],
|
|
||||||
since: Math.floor(Date.now() / 1000),
|
since: Math.floor(Date.now() / 1000),
|
||||||
};
|
};
|
||||||
|
|
||||||
sub(
|
sub(
|
||||||
filter,
|
filter,
|
||||||
async (event) => {
|
async (event) => {
|
||||||
|
console.log('new notify: ', event);
|
||||||
addActivity(event);
|
addActivity(event);
|
||||||
|
|
||||||
switch (event.kind) {
|
switch (event.kind) {
|
||||||
case NDKKind.Text:
|
case NDKKind.Text:
|
||||||
return await sendNativeNotification('Mention');
|
return await sendNativeNotification('Mention');
|
||||||
case NDKKind.Contacts:
|
|
||||||
return await sendNativeNotification("You've a new follower");
|
|
||||||
case NDKKind.Repost:
|
case NDKKind.Repost:
|
||||||
return await sendNativeNotification('Repost');
|
return await sendNativeNotification('Repost');
|
||||||
case NDKKind.Reaction:
|
case NDKKind.Reaction:
|
||||||
|
@ -148,7 +148,7 @@ export function Repost({
|
|||||||
<User pubkey={event.pubkey} time={event.created_at} variant="repost" />
|
<User pubkey={event.pubkey} time={event.created_at} variant="repost" />
|
||||||
<div className="relative flex flex-col">
|
<div className="relative flex flex-col">
|
||||||
<User pubkey={data.pubkey} time={data.created_at} />
|
<User pubkey={data.pubkey} time={data.created_at} />
|
||||||
<div className="-mt-2 flex items-start gap-3">
|
<div className="-mt-5 flex items-start gap-3">
|
||||||
<div className="w-10 shrink-0" />
|
<div className="w-10 shrink-0" />
|
||||||
<div className="relative z-20 flex-1">
|
<div className="relative z-20 flex-1">
|
||||||
{renderKind(data)}
|
{renderKind(data)}
|
||||||
|
@ -47,11 +47,13 @@ export function useNostr() {
|
|||||||
closeOnEose: false,
|
closeOnEose: false,
|
||||||
groupable: groupable ?? true,
|
groupable: groupable ?? true,
|
||||||
});
|
});
|
||||||
subManager.set(JSON.stringify(filter), subEvent);
|
|
||||||
|
|
||||||
subEvent.addListener('event', (event: NDKEvent) => {
|
subEvent.addListener('event', (event: NDKEvent) => {
|
||||||
callback(event);
|
callback(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
subManager.set(JSON.stringify(filter), subEvent);
|
||||||
|
console.log(subManager.keys());
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchUserData = async (preFollows?: string[]) => {
|
const fetchUserData = async (preFollows?: string[]) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user