eny.space Landingpage
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(route.ts): debug hostname

+19 -1
+19 -1
app/api/webhooks/route.ts
··· 25 25 return h.replace(/\/$/, ""); 26 26 } 27 27 28 + function isValidFqdn(host: string) { 29 + if (!host || host.length > 253) return false; 30 + if (host.endsWith(".")) return false; 31 + const parts = host.split("."); 32 + if (parts.length < 2) return false; 33 + return parts.every((label) => { 34 + if (!label || label.length > 63) return false; 35 + if (!/^[a-z0-9-]+$/i.test(label)) return false; 36 + if (label.startsWith("-") || label.endsWith("-")) return false; 37 + return true; 38 + }); 39 + } 40 + 28 41 async function provisionPdsForUser({ 29 42 userId, 30 43 userEmail, ··· 45 58 46 59 const password = randomBytes(16).toString("base64url"); 47 60 const hostname = normalizeDeployHostname(pdsHostnameBase); 61 + if (!isValidFqdn(hostname)) { 62 + throw new Error( 63 + `Invalid hostname for deploy after normalization: "${hostname}" (raw="${pdsHostnameBase}")`, 64 + ); 65 + } 48 66 49 67 const disksizeParsed = Number(disksizeGb); 50 68 if (!Number.isFinite(disksizeParsed) || disksizeParsed <= 0) { ··· 107 125 status: "deploy_failed", 108 126 }); 109 127 throw new Error( 110 - `PDS deploy failed (${deployRes.status}): ${ 128 + `PDS deploy failed (${deployRes.status}) for hostname "${hostname}": ${ 111 129 typeof deployBody === "string" ? deployBody : JSON.stringify(deployBody) 112 130 }`, 113 131 );