Include source tags in nsite deployments

This commit is contained in:
hzrd149 committed 2026-03-25 16:25:22 -05:00
1 parent ee240cdfda
commit 113fc0a326
4 files changed
+57 -2

No files matched your search

+25
View File
@@ -4677,6 +4677,7 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4690,6 +4691,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4703,6 +4705,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4716,6 +4719,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4729,6 +4733,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4742,6 +4747,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4755,6 +4761,7 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4768,6 +4775,7 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4781,6 +4789,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4794,6 +4803,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4807,6 +4817,7 @@
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4820,6 +4831,7 @@
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4833,6 +4845,7 @@
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4846,6 +4859,7 @@
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4859,6 +4873,7 @@
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4872,6 +4887,7 @@
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4885,6 +4901,7 @@
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4898,6 +4915,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4911,6 +4929,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4924,6 +4943,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4937,6 +4957,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4950,6 +4971,7 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4963,6 +4985,7 @@
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4976,6 +4999,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -4989,6 +5013,7 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
+24 -2
View File
@@ -50,6 +50,23 @@ function normalizeUrl(url: string): string {
return `https://${url}`; return `https://${url}`;
} }
async function resolveNsiteSourceUrl(remoteUrl: string | null): Promise<string | undefined> {
if (!remoteUrl) {
return undefined;
}
if (/^https?:\/\//i.test(remoteUrl)) {
return remoteUrl;
}
if (remoteUrl.startsWith('nostr://')) {
const nostrURI = await NostrURI.parse(remoteUrl);
return nostrURI.toString();
}
return undefined;
}
/** /**
* Render provider icon using favicon or fallback * Render provider icon using favicon or fallback
*/ */
@@ -252,6 +269,10 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
throw new Error('You must be logged in to deploy to nsite.'); throw new Error('You must be logged in to deploy to nsite.');
} }
const sourceUrl = await resolveNsiteSourceUrl(
await git.getRemoteURL(projectPath, 'origin')
);
adapter = new NsiteAdapter({ adapter = new NsiteAdapter({
fs, fs,
nostr, nostr,
@@ -261,6 +282,7 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
blossomServers: nsiteProvider.blossomServers, blossomServers: nsiteProvider.blossomServers,
siteTitle: nsiteForm.siteTitle || undefined, siteTitle: nsiteForm.siteTitle || undefined,
siteDescription: nsiteForm.siteDescription || undefined, siteDescription: nsiteForm.siteDescription || undefined,
sourceUrl,
siteIdentifier: nsiteForm.siteType === 'named' && nsiteForm.dTag siteIdentifier: nsiteForm.siteType === 'named' && nsiteForm.dTag
? nsiteForm.dTag ? nsiteForm.dTag
: undefined, : undefined,
@@ -593,8 +615,8 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const siteLabel = isRoot const siteLabel = isRoot
? 'Root site' ? 'Root site'
: nsiteVfsConfig.id : nsiteVfsConfig.id
? `Named site: ${nsiteVfsConfig.id}` ? `Named site: ${nsiteVfsConfig.id}`
: 'Named site'; : 'Named site';
const relayCount = nsiteVfsConfig.relays?.length ?? 0; const relayCount = nsiteVfsConfig.relays?.length ?? 0;
const serverCount = nsiteVfsConfig.servers?.length ?? 0; const serverCount = nsiteVfsConfig.servers?.length ?? 0;
+6
View File
@@ -188,6 +188,7 @@ export class NsiteAdapter implements DeployAdapter {
private blossomServers: string[]; private blossomServers: string[];
private siteTitle?: string; private siteTitle?: string;
private siteDescription?: string; private siteDescription?: string;
private sourceUrl?: string;
private siteIdentifier?: string; private siteIdentifier?: string;
constructor(config: NsiteDeployConfig) { constructor(config: NsiteDeployConfig) {
@@ -199,6 +200,7 @@ export class NsiteAdapter implements DeployAdapter {
this.blossomServers = config.blossomServers; this.blossomServers = config.blossomServers;
this.siteTitle = config.siteTitle; this.siteTitle = config.siteTitle;
this.siteDescription = config.siteDescription; this.siteDescription = config.siteDescription;
this.sourceUrl = config.sourceUrl;
this.siteIdentifier = config.siteIdentifier; this.siteIdentifier = config.siteIdentifier;
} }
@@ -309,6 +311,10 @@ export class NsiteAdapter implements DeployAdapter {
tags.push(['description', this.siteDescription]); tags.push(['description', this.siteDescription]);
} }
if (this.sourceUrl) {
tags.push(['source', this.sourceUrl]);
}
const manifestEvent = await this.signer.signEvent({ const manifestEvent = await this.signer.signEvent({
kind: manifestKind, kind: manifestKind,
content: '', content: '',
+2
View File
@@ -58,6 +58,8 @@ export interface NsiteDeployConfig {
siteTitle?: string; siteTitle?: string;
/** Optional site description included as a ["description", ...] tag in the manifest */ /** Optional site description included as a ["description", ...] tag in the manifest */
siteDescription?: string; siteDescription?: string;
/** Optional source repository location included as a ["source", ...] tag in the manifest */
sourceUrl?: string;
/** /**
* Optional named-site identifier (the `d` tag value). * Optional named-site identifier (the `d` tag value).
* When set → publishes kind 35128 (named site), URL = {base36pubkey}{identifier}.{gateway} * When set → publishes kind 35128 (named site), URL = {base36pubkey}{identifier}.{gateway}