Fix swarm bootstrap for logo-less nodes

This commit is contained in:
cyph3rasi
2026-03-07 20:54:30 -08:00
parent 2acebc15a5
commit 853c564755
3 changed files with 32 additions and 2 deletions
+10 -1
View File
@@ -9,6 +9,15 @@ import { eq, sql } from 'drizzle-orm';
import type { SwarmAnnouncement, SwarmNodeInfo, SwarmCapability } from './types';
import { upsertSwarmNode, getSeedNodes, markNodeSuccess, markNodeFailure } from './registry';
function normalizeOptionalUrl(value: string | null | undefined): string | undefined {
if (!value) {
return undefined;
}
const trimmed = value.trim();
return trimmed.length > 0 ? trimmed : undefined;
}
/**
* Build this node's announcement payload
*/
@@ -32,7 +41,7 @@ export async function buildAnnouncement(): Promise<SwarmAnnouncement> {
if (node) {
name = node.name;
description = node.description ?? undefined;
logoUrl = node.logoUrl ?? undefined;
logoUrl = normalizeOptionalUrl(node.logoUrl);
publicKey = node.publicKey ?? '';
isNsfw = node.isNsfw;
}