Include nsite "a" tag in kind 31990 app events when deployment exists

This commit is contained in:
Alex Gleason committed 2026-04-02 02:47:52 -05:00
1 parent f29510ed00
commit d4d6ff0d89
1 file changed
+19
+19
View File
@@ -1,6 +1,7 @@
import git from 'isomorphic-git';
import { DotAI } from './DotAI';
import { NostrURI } from './NostrURI';
import { readNsiteVfsConfig } from './nsiteConfig';
import type { JSRuntimeFS } from './JSRuntime';
/** Input for building a kind 31990 app event. */
@@ -97,6 +98,24 @@ export async function buildAppEvent(
}
}
// If an nsite deployment exists, add an "a" tag referencing the site manifest event
if (opts?.fs && opts.cwd && opts.pubkey) {
try {
const nsiteConfig = await readNsiteVfsConfig(opts.fs, opts.cwd);
if (nsiteConfig) {
if (nsiteConfig.id) {
// Named site: kind 35128 addressable event
tags.push(['a', `35128:${opts.pubkey}:${nsiteConfig.id}`]);
} else {
// Root site: kind 15128 replaceable event
tags.push(['a', `15128:${opts.pubkey}:`]);
}
}
} catch {
// No nsite config found, skip
}
}
return {
content: JSON.stringify(content),
tags,