diff options
| author | Adrien Hopkins <[email protected]> | 2025-09-27 21:06:48 -0500 |
|---|---|---|
| committer | Adrien Hopkins <[email protected]> | 2025-09-27 21:06:48 -0500 |
| commit | 48d2cac1abf64d549cf10c18c90b875a086c575f (patch) | |
| tree | 29570bdf10eac0e3469a04e903b8680ac0754065 /src | |
| parent | 3083a8675ee2378513d63954ca1bd5468f738660 (diff) | |
| download | coinos-ui-48d2cac1abf64d549cf10c18c90b875a086c575f.tar.gz coinos-ui-48d2cac1abf64d549cf10c18c90b875a086c575f.zip | |
Upload DMs to specified relays
Currently, this is a comma-separated list specified in the env var
PUBLIC_DM_RELAYS. Later, it will use users' preferences.
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/dm/[recipient]/+page.svelte | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/routes/(app)/dm/[recipient]/+page.svelte b/src/routes/(app)/dm/[recipient]/+page.svelte index 8e01b7a8..4f02829d 100644 --- a/src/routes/(app)/dm/[recipient]/+page.svelte +++ b/src/routes/(app)/dm/[recipient]/+page.svelte @@ -2,12 +2,17 @@ import Icon from "$comp/Icon.svelte"; import { hexToBytes, bytesToHex } from '@noble/hashes/utils'; import * as toolsnip17 from 'nostr-tools/nip17'; + import { SimplePool } from 'nostr-tools/pool'; import * as libnip17 from '$lib/nip17'; import { sign, getPrivateKey } from '$lib/nostr'; let { data } = $props(); const { user, recipient } = data; + const pool = new SimplePool(); + import { PUBLIC_DM_RELAYS } from '$env/static/public'; + const DM_RELAYS_LIST = PUBLIC_DM_RELAYS.split(','); + let text = $state(""); const btnCreateMessage = async () => { @@ -20,8 +25,7 @@ event = libnip17.createNIP17MessageSK(text, sk, recipient.pubkey); } - // TODO send event to relays instead of displaying it - text = JSON.stringify(event); + await Promise.any(pool.publish(DM_RELAYS_LIST, event)); } const btnDecryptMessage = async () => { |
