-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96404b4
commit 1d47dfe
Showing
12 changed files
with
106 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { NDKKind, NDKSubscriptionCacheUsage } from "@nostr-dev-kit/ndk"; | ||
import { useEvent, useEvents } from "@ngine/core"; | ||
|
||
export function useStatus(url: string) { | ||
const event = useEvent( | ||
{ | ||
kinds: [30_066 as NDKKind], | ||
"#d": [url], | ||
authors: [ | ||
"151c17c9d234320cf0f189af7b761f63419fd6c38c6041587a008b7682e4640f", | ||
], | ||
}, | ||
{ | ||
cacheUsage: NDKSubscriptionCacheUsage.CACHE_FIRST, | ||
}, | ||
); | ||
return event; | ||
} | ||
|
||
export default function useRelayStatus() { | ||
const { events } = useEvents( | ||
{ | ||
kinds: [30_066 as NDKKind], | ||
authors: [ | ||
"151c17c9d234320cf0f189af7b761f63419fd6c38c6041587a008b7682e4640f", | ||
], | ||
}, | ||
{ | ||
cacheUsage: NDKSubscriptionCacheUsage.PARALLEL, | ||
}, | ||
); | ||
const online = events | ||
.filter((e) => e.tagValue("s") === "online") | ||
.map((e) => e.tagValue("d")) | ||
.filter((s) => s) as string[]; | ||
const offline = events | ||
.filter((e) => e.tagValue("s") !== "online") | ||
.map((e) => e.tagValue("d")) | ||
.filter((s) => s) as string[]; | ||
return { events, online, offline }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function encode(url: string): string { | ||
url = url.trim(); | ||
return encodeURIComponent(humanize(url)); | ||
} | ||
|
||
export function humanize(url: string) { | ||
return url.replace("ws://", "").replace("wss://", "").replace(/\/$/, ""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1d47dfe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ngine-badges – ./apps/badges
ngine-badges-git-main-bandarra-protonmailc-s-team.vercel.app
ngine-badges.vercel.app
badges.page
ngine-badges-bandarra-protonmailc-s-team.vercel.app
1d47dfe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ngine-emojis – ./apps/emojis
ngine-emojis-git-main-bandarra-protonmailc-s-team.vercel.app
ngine-emojis.vercel.app
ngine-emojis-bandarra-protonmailc-s-team.vercel.app
emojito.meme