Skip to content

Commit

Permalink
Added undefined window handling when posting handler event
Browse files Browse the repository at this point in the history
  • Loading branch information
calvadev committed Feb 28, 2025
1 parent e6af19c commit 664c05b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/dynamic-meta-head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const DynamicHead = ({
}, []);

const metaTags = getMetaTags(
origin ? origin : "https://shopstr.market",
origin ? origin : "https://shopstr.store",
router.pathname,
router.query,
productEvents,
Expand Down
9 changes: 7 additions & 2 deletions components/utility/nostr-helper-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,18 @@ export async function PostListing(

const handlerDTag = crypto.randomUUID();

const origin =
window && typeof window !== undefined
? window.location.origin
: "https://shopstr.store";

const handlerEvent = {
kind: 31990,
tags: [
["d", handlerDTag],
["k", "30402"],
["web", `${window.location.origin}/marketplace/<bech-32>`, "npub"],
["web", `${window.location.origin}/listing/<bech-32>`, "naddr"],
["web", `${origin}/marketplace/<bech-32>`, "npub"],
["web", `${origin}/listing/<bech-32>`, "naddr"],
],
content: "",
created_at: Math.floor(Date.now() / 1000),
Expand Down

0 comments on commit 664c05b

Please sign in to comment.