Adopt: pass the church's address; Link: the short name is a name

crosscode adopt can only work out the church's address from an events.<address> domain, and
the Hub never sent --address, so adopting a site like events-demo.crosscode.co.za failed on the
server. The adopt form now asks for the address (required for such domains), the Hub refuses to
plan the move without it, and it goes into the job's arguments.

Link existing: the short name field and its error say it's a name like `hope`, not a folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 09:58:16 +02:00
co-authored by Claude Opus 5.5
parent 197edf3c1a
commit a2e97a5ea9
5 changed files with 47 additions and 7 deletions
@@ -24,7 +24,7 @@ export default function DeploymentPage() {
const [msg, setMsg] = useState<Msg>(warn ? { type: "err", text: warn } : null);
const [problems, setProblems] = useState<string[]>([]);
const [upd, setUpd] = useState({ version: "", at: toInput(new Date(Date.now() + 5 * H)), emergency: false, reason: "", totp: "" });
const [adopt, setAdopt] = useState({ eventsDir: "", version: "", at: toInput(new Date(Date.now() + 5 * H)) });
const [adopt, setAdopt] = useState({ eventsDir: "", version: "", address: "", at: toInput(new Date(Date.now() + 5 * H)) });
const [un, setUn] = useState({ at: toInput(new Date(Date.now() + 7 * 24 * H)), totp: "", confirm: "" });
const load = useCallback(() => api<Detail>(`/api/admin/deployments/${id}`).then(setD).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
@@ -85,9 +85,11 @@ export default function DeploymentPage() {
)}
{x.status === "live" && x.install?.version?.startsWith("2.1.") && (
<form className="card grid gap-3 md:grid-cols-3" onSubmit={e => { e.preventDefault(); act(`/api/admin/deployments/${x.id}/adopt`, { eventsDir: adopt.eventsDir, version: adopt.version || undefined, at: fromInput(adopt.at) }, "Adopt planned. The site admin was emailed."); }}>
<form className="card grid gap-3 md:grid-cols-3" onSubmit={e => { e.preventDefault(); act(`/api/admin/deployments/${x.id}/adopt`, { eventsDir: adopt.eventsDir, version: adopt.version || undefined, address: adopt.address || undefined, at: fromInput(adopt.at) }, "Adopt planned. The site admin was emailed."); }}>
<h2 className="font-medium md:col-span-3">Move onto the monorepo (crosscode adopt)</h2>
<p className="text-sm text-slate-500 md:col-span-3">Moves the site from its old folder to /var/www/sites/{x.shortName}/events. Same database, uploads, .env and ports; the old folder is kept 14 days for <code>crosscode adopt {x.shortName} --undo</code>.</p>
<div><label className="label" htmlFor="a-d">The old install&apos;s folder</label><input id="a-d" className="input font-mono" required placeholder="/var/www/hope-events" value={adopt.eventsDir} onChange={e => setAdopt({ ...adopt, eventsDir: e.target.value })} /></div>
<div><label className="label" htmlFor="a-a">The church&apos;s address</label><input id="a-a" className="input" required={!x.domain.startsWith("events.")} placeholder={x.domain.startsWith("events.") ? x.domain.slice("events.".length) : "hope.co.za"} value={adopt.address} onChange={e => setAdopt({ ...adopt, address: e.target.value })} /></div>
<div><label className="label" htmlFor="a-v">Release</label><input id="a-v" className="input" placeholder="latest" value={adopt.version} onChange={e => setAdopt({ ...adopt, version: e.target.value })} /></div>
<div><label className="label" htmlFor="a-at">When</label><input id="a-at" type="datetime-local" className="input" value={adopt.at} onChange={e => setAdopt({ ...adopt, at: e.target.value })} /></div>
<div className="md:col-span-3"><button className="btn-primary">Plan the move</button></div>
@@ -111,7 +111,7 @@ export default function InstallsPage() {
<p className="text-sm text-slate-500 md:col-span-2">For sites installed by hand or moved with <code>crosscode adopt</code>. Nothing on the server changes; the Hub records the server, folder name and ports (see the server&apos;s church.env and frpc.ini).</p>
<div><label className="label" htmlFor="l-inst">Install</label><select id="l-inst" className="input" required {...l("installId")}><option value="">Choose…</option>{installs.map(i => <option key={i.id} value={i.id}>{i.customer?.name || i.name} ({i.url})</option>)}</select></div>
<div><label className="label" htmlFor="l-srv">Server</label><select id="l-srv" className="input" required {...l("serverId")}><option value="">Choose…</option>{srv.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}</select></div>
<div><label className="label" htmlFor="l-short">Short name (its folder in /var/www/sites)</label><input id="l-short" className="input" required {...l("shortName")} /></div>
<div><label className="label" htmlFor="l-short">Short name</label><input id="l-short" className="input" required pattern="[a-z][a-z0-9-]{1,30}" placeholder="hope" {...l("shortName")} /><p className="mt-1 text-xs text-slate-500">Just the name, not a path: its folder is /var/www/sites/&lt;name&gt;. A site still in an old folder (/var/www/hope-events) gets that name when you move it onto the monorepo.</p></div>
<div className="grid grid-cols-2 gap-2">
<div><label className="label" htmlFor="l-web">Web port</label><input id="l-web" className="input" required inputMode="numeric" {...l("webPort")} /></div>
<div><label className="label" htmlFor="l-api">API port</label><input id="l-api" className="input" required inputMode="numeric" {...l("apiPort")} /></div>