fix(server): client address from the page's port, stricter Chronos identity, Host networking notes

Review fixes on top of the public ports change (owner review 3):

- Settings > Network and TLS: opened over HTTPS, the client address uses the port
  the page came through (a container's 8443 published as 8444 with Public HTTPS
  port still empty showed the wrong 8443), and a "Use <port>" button fills that
  port in. Saving a Public HTTPS port other than the page's asks first, since the
  HTTPS redirect follows it at once and a typo would lock the panel's link out.
- GetInfoAsync tells Chronos from other services by stricter rules on both the
  trusted and the untrusted-certificate path: any redirect, any answer that is not
  JSON, more than 1 MB, or an error without the X-Chronos-Api header is not
  Chronos. Another service's certificate is no longer offered for trust after a
  cross-scheme redirect, an error page or a JSON 401/403/404, and a JSON 401 over
  HTTP no longer reads as a wrong password.
- The HTTP port typed without a scheme (TLS to a plain HTTP port) now gives the
  not-Chronos error instead of "the server did not answer".
- The Uploader's certificate question names the address with its port.
- A link-local IPv6 address with a zone index is refused instead of losing it.
- In a container, the first save of the settings removes HttpPort/HttpsPort from
  server.json, so the start-up warning stops; the warning says so.
- Guide, README, compose and template: with network type Host the mappings do
  nothing and CHRONOS_HTTP_PORT / CHRONOS_HTTPS_PORT move the listening ports off
  ones another service uses; the template overview is back to two sentences.
- BRIEF, DECISIONS and CHANGELOG updated; en/it strings added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 10:28:08 +01:00
1 parent 369e754bec
commit 0aa2fb8135
19 files changed
+303 -67

No files matched your search

+7 -2
View File
@@ -615,7 +615,12 @@ One line per decision: date · decision · alternative · reason.
| 2026-11-04 | `ServerSettingsDto` gains `PublicHttpPort`, `PublicHttpsPort` and `InContainer`, appended as optional positional members. In a request a null public port keeps the saved value and 0 clears it; responses send null when unset. | null clears | A client or script of the earlier shape sends no public ports: with null as "clear" every save from it would drop them, or be refused as `setting_locked` when a variable fixes them. |
| 2026-11-04 | In a container (`DOTNET_RUNNING_IN_CONTAINER=true`, read in `ServerOptions.Load`; tests set `ServerOptions.InContainer`) the listening ports are locked (listed in `Locked`, `lockedBy` `DOTNET_RUNNING_IN_CONTAINER` unless a `CHRONOS_HTTP(S)_PORT` sets them) and a `server.json` value for them is ignored with a warning at start; the variables still change them. | Keep honouring server.json | The template publishes the default container ports: a port saved from the panel before would leave the container unreachable after a restart. Host networking users who need other ports set the variables. |
| 2026-11-04 | Listening ports are validated only when a request changes them. | Always validate | A value the panel cannot change (a container's, the test server's 0) must never block saving the other settings. |
| 2026-11-04 | The admin panel's client address is computed in the browser from the saved settings: `https://` + `location.hostname` (IPv6 in brackets) + `:` + public HTTPS port or HTTPS port (no port when 443); `location.origin` in TLS mode proxy. No other page shows a pairing code or a connect hint, so it appears only in Settings › Network and TLS. | Server-side address | Only the browser knows the host name the LAN uses for the server (an IP, a NAS name); the server sees its container address. |
| 2026-11-04 | The admin panel's client address is computed in the browser: `https://` + `location.hostname` (IPv6 in brackets) + `:` + the port the page came through when the browser speaks HTTPS to the server itself, else (plain HTTP, only from the server's own machine) the public HTTPS port or HTTPS port (no port when 443); `location.origin` in TLS mode proxy. When the page's HTTPS port is not the saved one (a container's 8443 published as 8444, Public HTTPS port still empty), a *Use 8444* button next to Public HTTPS port fills it in. No other page shows a pairing code or a connect hint, so it appears only in Settings › Network and TLS. | Server-side address | Only the browser knows the host name the LAN uses for the server (an IP, a NAS name); the server sees its container address. |
| 2026-11-04 | One address rule for both clients, `Chronos.Protocol.Client.ChronosAddress` (both apps reference Chronos.Protocol, which builds on Linux): no scheme and no port means https on 8443, `https://host` keeps 443, a typed port is kept, a bare IPv6 address is bracketed. Saved addresses carry their scheme, so they keep their port. | A copy per app | The placeholder and the error text say `nas.local:8443`; "192.168.30.23" meant port 443. |
| 2026-11-04 | `ChronosClient.GetInfoAsync` throws `NotChronosServerException` for an HTML or redirected page, JSON without a Chronos `ServerInfo` (name, version, API version, lists, limits), or a 4xx without a Chronos error; on an untrusted certificate it reads `server/info` once more with certificate checks off and no token, and only a Chronos answer leads to the fingerprint question. Nothing is trusted or stored by that read. | Ask about the fingerprint first | Before, `{}` was accepted as a server (the Uploader then sent the password to it), a 401 read as a wrong password, and the self-signed certificate of another service on port 8443 was offered for trust. |
| 2026-11-04 | `ChronosClient.GetInfoAsync` throws `NotChronosServerException` when `server/info` is not Chronos's: any 3xx (Chronos never redirects it), any answer that is not JSON whatever its status, more than 1 MB, JSON without a Chronos `ServerInfo` (name, version, API version, lists, limits), or an error without the `X-Chronos-Api` header every Chronos response carries and a Chronos error code. A busy answer (408, 429, 502-504) with JSON or no body cannot tell. On an untrusted certificate it reads `server/info` once more with certificate checks off, no token, no cookies and no redirects, under the same rules, and only a Chronos answer leads to the fingerprint question. Nothing is trusted or stored by that read. | Ask about the fingerprint first | Before, `{}` was accepted as a server (the Uploader then sent the password to it), a 401 read as a wrong password, and the self-signed certificate of another service on port 8443 was offered for trust. |
| 2026-11-04 | The not-Chronos error names the normalised address (port included) in new keys `Server.Error.NotChronosAt` and `Uploader.Connect.Error.NotChronosAt`; the old keys stay as they are. | Add {0} to the old keys | The 36 other cultures translate the old keys without the placeholder; changing it would fail the i18n check until they are translated again. |
| 2026-11-04 | Saving a public HTTPS port (or clearing it to the listening one) other than both the saved one and the port this page came through over HTTPS asks first (*Send clients to port 8445?*); the server does not check it. | Server-side warning in the log | The HTTPS redirect follows the saved port at once, so a typo would send the panel's link to a dead port or another service's sign-in page; only the browser knows which port really reached the server. Saving other settings never asks. |
| 2026-11-04 | `GetInfoAsync`: when TLS fails on an HTTPS address and no certificate was refused (the port speaks plain HTTP: the HTTP port typed without a scheme, `192.168.30.23:8087`), it reads `server/info` over `http://` on the same authority, without credentials; any answer gives `NotChronosServerException` (check the port, the client address), no answer rethrows (unreachable). | Report it as unreachable | The server did answer; the useful advice is the port and the panel's client address. |
| 2026-11-04 | In a container, the first save of the settings removes `HttpPort` and `HttpsPort` from `server.json` (also when nothing else changed); the start-up warning says so. | Remove them at load | Load only reads; the panel cannot edit locked ports, so without this the warning came back at every start. |
| 2026-11-04 | Host networking: the guide, README and compose comments say the port mappings do nothing there, the server listens on the host's 8080/8443 and `CHRONOS_HTTP_PORT` / `CHRONOS_HTTPS_PORT` move it off ports another service uses (public ports empty). No template entries for them. | Advanced template entries *Listening HTTP/HTTPS port* | On Bridge such an entry would unmap the template's ports; Host users add a variable, which Unraid offers on every container. |
| 2026-11-04 | `ChronosAddress` refuses a link-local IPv6 address with a zone index (`fe80::1%12`): *Invalid address*. | Keep the zone as `%25` | `Uri` and the connection would drop the zone, failing later with a less clear error; the LAN address or name works. |