Repair swarm bootstrap seed for new and existing nodes

Hop-State: A_06FP90SDWE5709BB1G6J4B8
Hop-Proposal: R_06FP90RS27BNBV5H5N053A0
Hop-Task: T_06FP905Q50D1ZFPC56N3DZG
Hop-Attempt: AT_06FP905Q50E6P72ZMVT4038
This commit is contained in:
2026-07-14 23:42:26 -07:00
committed by Hop
parent 65e901393b
commit 6edf8991fa
7 changed files with 65 additions and 8 deletions
+15
View File
@@ -1,5 +1,9 @@
import { parse } from 'tldts';
const LEGACY_SWARM_SEED_DOMAINS: Readonly<Record<string, string>> = {
'node.synapsis.social': 'synapsis.social',
};
export function normalizeNodeDomain(domain: string): string {
return domain
.trim()
@@ -52,3 +56,14 @@ export function isPublicSwarmDomain(value: string | null | undefined): boolean {
return getPublicSwarmDomain(value) !== null;
}
/**
* Resolve retired bootstrap hostnames to the node identity they represent.
* This keeps upgraded nodes working even before their persisted seed rows are
* rewritten by the accompanying data migration.
*/
export function getCanonicalSwarmSeedDomain(value: string | null | undefined): string | null {
const domain = getPublicSwarmDomain(value);
if (!domain) return null;
return LEGACY_SWARM_SEED_DOMAINS[domain] ?? domain;
}