diff --git a/API.md b/API.md index aec5536..07e5749 100644 --- a/API.md +++ b/API.md @@ -119,7 +119,10 @@ share every ~30 minutes under a global advisory lease; `WebDavConnection` + `WebDavItem` (migration 020) store credentials and the path↔bookmark ledger. On Core the deployment's `NEXTCLOUD_URL` makes the list carry a one-click suggestion (`https:///remote.php/dav/files/`) — DATA, not a code -fork on TIER. +fork on TIER. The UI composes the viewer's username into the per-user DAV +root (`/files//`), and the Core app container pins the Nextcloud +hostname to the deployment's public IP (compose `extra_hosts`): the +split-horizon private answer has no 443 listener and netguard stays strict. | Method | Path | Returns / behavior | |---|---|---| diff --git a/deploy/federated/lib-superbrain.sh b/deploy/federated/lib-superbrain.sh index fbfd133..2757e18 100644 --- a/deploy/federated/lib-superbrain.sh +++ b/deploy/federated/lib-superbrain.sh @@ -69,6 +69,14 @@ services: migrate: {condition: service_completed_successfully} env_file: - ./.env + # Split-horizon DNS: nextcloud.$DOMAIN resolves to a private container IP + # inside the core network, where nothing listens on 443 (traefik holds + # TLS on the public address) and netguard refuses private dials anyway. + # Pin the public IP - the same house pattern the web service uses for + # authelia - so the WebDAV/CalDAV/CardDAV connectors reach the deployment's + # Nextcloud over the public, netguard-clean route. No guard relaxation. + extra_hosts: + - "nextcloud.$DOMAIN:$EXTERNALIP" healthcheck: test: [CMD, /superbrain, --healthcheck] interval: 3s diff --git a/scripts/regressions.mjs b/scripts/regressions.mjs index c7e3b25..7ad9d6b 100644 --- a/scripts/regressions.mjs +++ b/scripts/regressions.mjs @@ -681,7 +681,8 @@ try { console.log('PASS: sidebar persists drag reordering') // Settings → WebDAV: masked list rows render; the deployment suggestion - // (NEXTCLOUD_URL) prefills the connect form with the viewer's username; + // (NEXTCLOUD_URL) prefills the connect form with the username composed into + // the per-user DAV root; // save POSTs the form; Sync/Test surface the server's verbatim results. await page.goto(`${base}/settings`) await page.getByRole('tab', { name: 'WebDAV' }).click() @@ -690,13 +691,13 @@ try { await page.getByText('Nextcloud files detected on this server').waitFor() await page.getByRole('button', { name: 'Use', exact: true }).click() const suggestUrl = page.getByPlaceholder('https://cloud.example.com/remote.php/dav/files/username/Documents') - assert.equal(await suggestUrl.inputValue(), 'https://cloud.federatedcomputer.ai/remote.php/dav/files/') + assert.equal(await suggestUrl.inputValue(), 'https://cloud.federatedcomputer.ai/remote.php/dav/files/fixture/') assert.equal(await page.getByPlaceholder('erwin').inputValue(), 'fixture') // session email local-part await page.getByPlaceholder('erwin').fill('erwin') await page.getByPlaceholder('Account or app password').fill('app-secret') await page.locator('[role="dialog"]').getByRole('button', { name: 'Connect share' }).click() await eventually(() => webdavConnections.length === 2, 'WebDAV connect POST did not reach the API') - assert.equal(lastWebdavCreate.url, 'https://cloud.federatedcomputer.ai/remote.php/dav/files/') + assert.equal(lastWebdavCreate.url, 'https://cloud.federatedcomputer.ai/remote.php/dav/files/fixture/') assert.equal(lastWebdavCreate.username, 'erwin') assert.equal(lastWebdavCreate.password, 'app-secret') await page.getByRole('button', { name: 'Sync House docs' }).click() @@ -716,13 +717,13 @@ try { await page.getByText('Nextcloud calendars detected on this server').waitFor() await page.getByRole('button', { name: 'Use', exact: true }).click() const calSuggestUrl = page.getByPlaceholder('https://cloud.example.com/remote.php/dav/calendars/username') - assert.equal(await calSuggestUrl.inputValue(), 'https://cloud.federatedcomputer.ai/remote.php/dav/calendars/') + assert.equal(await calSuggestUrl.inputValue(), 'https://cloud.federatedcomputer.ai/remote.php/dav/calendars/fixture/') assert.equal(await page.getByPlaceholder('erwin').inputValue(), 'fixture') await page.getByPlaceholder('erwin').fill('erwin') await page.getByPlaceholder('Account or app password').fill('cal-app-secret') await page.locator('[role="dialog"]').getByRole('button', { name: 'Connect calendar' }).click() await eventually(() => caldavConnections.length === 2, 'CalDAV connect POST did not reach the API') - assert.equal(lastCaldavCreate.url, 'https://cloud.federatedcomputer.ai/remote.php/dav/calendars/') + assert.equal(lastCaldavCreate.url, 'https://cloud.federatedcomputer.ai/remote.php/dav/calendars/fixture/') assert.equal(lastCaldavCreate.username, 'erwin') assert.equal(lastCaldavCreate.password, 'cal-app-secret') await page.getByRole('button', { name: 'Sync My calendars' }).click() diff --git a/web/components/caldav-settings.tsx b/web/components/caldav-settings.tsx index 6354a49..c38c6fb 100644 --- a/web/components/caldav-settings.tsx +++ b/web/components/caldav-settings.tsx @@ -74,7 +74,12 @@ export function CalDavSettings() { const openCreate = () => setForm({ ...emptyForm }) const openSuggestion = (s: Suggestion) => { const email = session?.user?.email ?? '' - setForm({ ...emptyForm, name: s.name, url: s.url, username: email ? email.split('@')[0] : '' }) + const username = email ? email.split('@')[0] : '' + // Nextcloud's DAV roots are per-user (/files//, + // /calendars//): compose the username into the URL so the + // prefill is a working endpoint, not a 404 one level up. The URL shown + // is the URL saved; the person can still edit both fields. + setForm({ ...emptyForm, name: s.name, username, url: username ? s.url + username + '/' : s.url }) } const openEdit = (c: CalDavConnection) => setForm({ id: c.id, version: c.version, name: c.name, url: c.url, username: c.username, diff --git a/web/components/webdav-settings.tsx b/web/components/webdav-settings.tsx index da6e5ae..19ce692 100644 --- a/web/components/webdav-settings.tsx +++ b/web/components/webdav-settings.tsx @@ -72,7 +72,12 @@ export function WebdavSettings() { const openCreate = () => setForm({ ...emptyForm }) const openSuggestion = (s: Suggestion) => { const email = session?.user?.email ?? '' - setForm({ ...emptyForm, name: s.name, url: s.url, username: email ? email.split('@')[0] : '' }) + const username = email ? email.split('@')[0] : '' + // Nextcloud's DAV roots are per-user (/files//, + // /calendars//): compose the username into the URL so the + // prefill is a working endpoint, not a 404 one level up. The URL shown + // is the URL saved; the person can still edit both fields. + setForm({ ...emptyForm, name: s.name, username, url: username ? s.url + username + '/' : s.url }) } const openEdit = (c: WebdavConnection) => setForm({ id: c.id, version: c.version, name: c.name, url: c.url, username: c.username,