Nostr access

This commit is contained in:
nate
2024-06-12 19:00:18 -04:00
parent 187768bbf2
commit 13ea2ccd9e
4 changed files with 32 additions and 6 deletions

View File

@@ -17,7 +17,8 @@ if (relays) {
export const defaultRelays = [
'wss://purplepag.es',
'wss://relay.damus.io'
'wss://relay.damus.io',
'wss://relay.f7z.io'
]
if (!relayList || !Array.isArray(relayList) || relayList.length === 0) {
@@ -25,11 +26,13 @@ if (!relayList || !Array.isArray(relayList) || relayList.length === 0) {
}
const _ndk: NDKSvelte = new NDKSvelte({
devWriteRelayUrls: ['wss://relay.strfront.com'],
//devWriteRelayUrls: ['wss://relay.strfront.com'],
explicitRelayUrls: relayList,
enableOutboxModel: true,
}) as NDKSvelte;
const ndk = writable(_ndk);
_ndk.connect();
export default ndk;
export const ndk = _ndk;
// export default ndk;

View File

@@ -0,0 +1,5 @@
// import {ndk} from "$lib/stores/nostr";
// export function load({params}) {
// return ndk;
// }

View File

@@ -1,5 +1,23 @@
<script lang='ts'>
import { ndk } from "$lib/stores/nostr.js";
import { NDKHighlight } from '@nostr-dev-kit/ndk';
import { RelayList } from "@nostr-dev-kit/ndk-svelte-components";
// export let data;
const highlights = ndk.storeSubscribe(
{kinds: [9802 as number]},
{closeOnEose: true},
NDKHighlight
);
</script>
<svelte:head>
<title>Decentralized Manufacturing</title>
</svelte:head>
<h1>Home</h1>
<p>
{$highlights.length}
{ndk.explicitRelayUrls}
{ndk.activeUser}
</p>

View File

@@ -2,4 +2,4 @@
<title>Log In</title>
</svelte:head>
<p>Log In</p>n
<p>Log In</p>