This commit is contained in:
ennmichael 2023-04-09 20:20:32 +02:00
parent 3ffe4d5b19
commit d754551ebb
No known key found for this signature in database
GPG Key ID: 6E6E183431A26AF7
3 changed files with 3 additions and 3 deletions

View File

@ -1,3 +1,4 @@
export * from "./legacy"
import "./nostr-object"
// TODO This file should only contain re-exports and only re-export what is needed

View File

@ -7,7 +7,6 @@ declare global {
getPublicKey: () => Promise<PublicKey>
signEvent: <T extends RawEvent>(event: Unsigned<T>) => Promise<T>
// TODO It's unclear to me if I should use this anywhere.
getRelays?: () => Promise<{
[url: string]: { read: boolean; write: boolean }
}>

View File

@ -41,9 +41,9 @@ export async function setup(
const publisherSecret =
"nsec15fnff4uxlgyu79ua3l7327w0wstrd6x565cx6zze78zgkktmr8vs90j363"
// Set up the global window.nostr object for the publisher.
if (typeof window !== "undefined") {
if (window.location.pathname === "/nostr-object") {
// Mock the global window.nostr object for the publisher.
window.nostr = {
getPublicKey: () => Promise.resolve(parsePublicKey(publisherPubkey)),
signEvent: <T extends RawEvent>(event: Unsigned<T>) =>
@ -74,7 +74,7 @@ export async function setup(
},
}
} else {
// Otherwise, disable the user's nostr extension if they have one.
// Disable the user's nostr extension if they have one.
window.nostr = undefined
}
}