Find Stalwart's administration instead of asking for it #366

Closed
opened 2026-09-15 17:01:17 +00:00 by jcoffey-dev · 0 comments
Owner

The dashboard's "Open Stalwart admin" link needed STALWART_ADMIN_URL. Its value can be worked out from the server instead.

How it's found (for accounts that administer, during the account-info fetch, cached with it):

  • Origin: the host Stalwart advertises in its session URLs (new URL(apiUrl, baseUrl).origin). That's the public address even when STALWART_URL is private, like the demo's http://127.0.0.1:8788.
  • Prefix: from x:Application/query + get on the account's own server. An enabled application claiming /admin gives /admin/.
    • On production it reads "Stalwart Web Interface", enabled, urlPrefix: {"/admin": true, "/account": true}, checked read-only on 2026-09-15.
    • /admin is also Stalwart's first-boot default (manager/defaults.rs).
  • When the web interface is disabled, removed or moved: no link.
  • When the viewer can't read applications: Stalwart's default /admin/.

Precedence: STALWART_ADMIN_URL, or a servers-file adminUrl, still wins. A routed domain with neither now uses what its own server reported; it's never pointed at the default server's.

For prod this means the link becomes https://mail.inbuxa.com/admin/ with nothing to configure (that URL returns 200 today).

Mock: x:Application with the production shape; admin gets sysApplicationGet/Query.

Checked

  • Typecheck, 1292 web and 228 server tests pass, as do the build.
  • New tests cover:
    • prefix parsing (enabled, disabled, moved, empty, refused);
    • advertised origin (absolute apiUrl on a private base, relative apiUrl);
    • configured values winning over detected ones, including routed domains.
  • Docs: FEATURES (dashboard section and env table), README (several servers), the example servers file.

No new strings.

Merged 2026-09-15 as coffey-labs/ihasmail@8639e9885b

Rebuilt from: git history, session transcript.

The dashboard's "Open Stalwart admin" link needed `STALWART_ADMIN_URL`. Its value can be worked out from the server instead. **How it's found** (for accounts that administer, during the account-info fetch, cached with it): - **Origin:** the host Stalwart advertises in its session URLs (`new URL(apiUrl, baseUrl).origin`). That's the public address even when `STALWART_URL` is private, like the demo's `http://127.0.0.1:8788`. - **Prefix:** from `x:Application/query` + `get` on the account's own server. An enabled application claiming `/admin` gives `/admin/`. - On production it reads `"Stalwart Web Interface"`, enabled, `urlPrefix: {"/admin": true, "/account": true}`, checked read-only on 2026-09-15. - `/admin` is also Stalwart's first-boot default (`manager/defaults.rs`). - **When the web interface is disabled, removed or moved:** no link. - **When the viewer can't read applications:** Stalwart's default `/admin/`. **Precedence:** `STALWART_ADMIN_URL`, or a servers-file `adminUrl`, still wins. A routed domain with neither now uses what its own server reported; it's never pointed at the default server's. For prod this means the link becomes `https://mail.inbuxa.com/admin/` with nothing to configure (that URL returns 200 today). **Mock:** `x:Application` with the production shape; admin gets `sysApplicationGet`/`Query`. **Checked** - Typecheck, 1292 web and 228 server tests pass, as do the build. - New tests cover: - prefix parsing (enabled, disabled, moved, empty, refused); - advertised origin (absolute apiUrl on a private base, relative apiUrl); - configured values winning over detected ones, including routed domains. - Docs: FEATURES (dashboard section and env table), README (several servers), the example servers file. No new strings. **Merged** 2026-09-15 as coffey-labs/ihasmail@8639e9885b12 <sub>Rebuilt from: git history, session transcript.</sub>
This repo is archived. You cannot comment on issues.