fix(server): public ports as settings, container port lock and client address; clients default to 8443 and name non-Chronos servers
The owner's Uploader could not connect: the panel showed the container's listening ports (8080/8443) as if clients used them, the public ports were only environment variables (CHRONOS_PUBLIC_HTTP_PORT not even in the Unraid template), and the clients mapped a bare host to 443, where another service answered. - Public HTTP/HTTPS ports are settings (server.json, or locked by CHRONOS_PUBLIC_*) and apply at once; ServerSettingsDto gains appended PublicHttpPort, PublicHttpsPort and InContainer members. - In a container the listening ports are fixed by the template: locked in the panel, and saved values from earlier versions are ignored with a warning. - Settings > Network and TLS shows the client address with a Copy button; the discovery tooltip says a container needs network type Host. - ChronosAddress (shared by Chronos and the Uploader): no scheme and no port is https on 8443, https:// keeps 443, a typed port is kept, IPv6 is bracketed. - GetInfoAsync throws NotChronosServerException for answers that are not a Chronos server; another service's certificate is never offered for trust and no credentials are sent to it. Both clients name the address asked. - Unraid template, compose file, user guide, README, BRIEF, DECISIONS, CHANGELOG (with an Unraid upgrade note) and ARCHITECTURE updated; en/it strings added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b24cf74fc
commit
369e754bec
33 files changed
+862
-82
No files matched your search
@@ -80,6 +80,7 @@ public sealed class ConnectFlowTests
|
||||
[Case("ftp://nas.local", ConnectError.InvalidAddress)]
|
||||
[Case("down.local", ConnectError.Unreachable)]
|
||||
[Case("web.local", ConnectError.NotChronos)]
|
||||
[Case("other.local", ConnectError.NotChronos)]
|
||||
public async Task ProbeFailuresAreClassified(string address, ConnectError error)
|
||||
{
|
||||
using var flow = new ConnectFlow(new FakeServer(), new MemoryTrust());
|
||||
@@ -141,9 +142,32 @@ public sealed class ConnectFlowTests
|
||||
Assert.Equal(1, changes);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AnotherServiceOnThePortIsNamedWithTheAddressAsked()
|
||||
{
|
||||
// Owner review 3: "192.168.30.23" goes to port 8443, where the owner's NAS runs another service.
|
||||
var server = new FakeServer { SelfSigned = true };
|
||||
var trust = new MemoryTrust();
|
||||
using var flow = new ConnectFlow(server, trust);
|
||||
Assert.Equal(ConnectStep.Failed, await flow.ProbeAsync("other.local"));
|
||||
Assert.Equal(ConnectError.NotChronos, flow.Error);
|
||||
Assert.Null(flow.PendingFingerprint);
|
||||
Assert.Empty(trust.Fingerprints);
|
||||
Assert.Equal(Chronos.Core.Localization.Loc.L("Server.Error.NotChronosAt", Chronos.App.Infrastructure.Formatting.LeftToRight("https://other.local:8443")),
|
||||
ServerSession.ErrorText(flow.Error, flow.Address));
|
||||
Assert.Contains("https://other.local:8443", ServerSession.ErrorText(flow.Error, flow.Address));
|
||||
// Without the address, and for other errors, the sentence stays as it was.
|
||||
Assert.Equal(Chronos.Core.Localization.Loc.L("Server.Error.NotChronos"), ServerSession.ErrorText(ConnectError.NotChronos));
|
||||
Assert.Equal(Chronos.Core.Localization.Loc.L("Server.Error.Unreachable"), ServerSession.ErrorText(ConnectError.Unreachable, flow.Address));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddressesAreNormalised()
|
||||
{
|
||||
Assert.True(ServerAddress.TryParse("nas.local", out var bare));
|
||||
Assert.Equal("https://nas.local:8443/", bare.ToString());
|
||||
Assert.True(ServerAddress.TryParse("https://chronos.example.com", out var proxied));
|
||||
Assert.Equal("https://chronos.example.com/", proxied.ToString());
|
||||
Assert.True(ServerAddress.TryParse("nas.local:8443", out var a));
|
||||
Assert.Equal("https://nas.local:8443/", a.ToString());
|
||||
Assert.True(ServerAddress.TryParse(" http://10.0.0.5:8080/chronos?x=1 ", out var b));
|
||||
@@ -228,6 +252,8 @@ public sealed class ConnectFlowTests
|
||||
{
|
||||
if (BaseAddress.Host == "down.local") throw new HttpRequestException("No such host");
|
||||
if (BaseAddress.Host == "web.local") throw new ChronosApiException(HttpStatusCode.NotFound, new ApiError("http_404", "Not Found"));
|
||||
// What ChronosClient reports for another service on the port: its page, its sign-in redirect, its certificate.
|
||||
if (BaseAddress.Host == "other.local") throw new NotChronosServerException(BaseAddress);
|
||||
if (server.SelfSigned && !trusted.Contains(Fingerprint)) throw new UntrustedCertificateException(Fingerprint);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,10 +56,13 @@ public sealed class ConnectViewModelTests
|
||||
public void AServerThatIsNotChronosMarksTheServerField()
|
||||
{
|
||||
var form = Form(new FakeSession(SignInResult.NotChronos));
|
||||
// Owner review 3: the address as it was asked, port included, so the user sees which port answered.
|
||||
form.Address = "192.168.30.23";
|
||||
|
||||
form.SignInCommand.Execute(null);
|
||||
|
||||
Assert.Equal(Loc.L("Uploader.Connect.Error.NotChronos"), form.AddressError);
|
||||
Assert.Equal(Loc.L("Uploader.Connect.Error.NotChronosAt", "https://192.168.30.23:8443"), form.AddressError);
|
||||
Assert.Contains("https://192.168.30.23:8443", form.AddressToolTip);
|
||||
Assert.Null(form.ErrorText);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,18 @@ public sealed class ServerAddressTests
|
||||
[Case("https://nas.local:8443", "https://nas.local:8443/")]
|
||||
[Case(" http://192.168.1.20:8080/chronos ", "http://192.168.1.20:8080/chronos/")]
|
||||
[Case("https://nas.local/?x=1#y", "https://nas.local/")]
|
||||
// Owner review 3: no scheme and no port is Chronos's HTTPS port, as the placeholder shows.
|
||||
[Case("192.168.30.23", "https://192.168.30.23:8443/")]
|
||||
[Case("nas.local", "https://nas.local:8443/")]
|
||||
[Case("nas.local/chronos", "https://nas.local:8443/chronos/")]
|
||||
[Case("192.168.30.23:8444", "https://192.168.30.23:8444/")]
|
||||
[Case("nas.local:443", "https://nas.local/")]
|
||||
[Case("https://chronos.example.com", "https://chronos.example.com/")]
|
||||
[Case("http://nas.local", "http://nas.local/")]
|
||||
[Case("fd00::5", "https://[fd00::5]:8443/")]
|
||||
[Case("[fd00::5]", "https://[fd00::5]:8443/")]
|
||||
[Case("[fd00::5]:9443", "https://[fd00::5]:9443/")]
|
||||
[Case("https://[fd00::5]", "https://[fd00::5]/")]
|
||||
public void ServerAddressesBecomeApiBases(string typed, string expected)
|
||||
{
|
||||
Assert.True(ServerAddress.TryParse(typed, out var uri));
|
||||
|
||||
Reference in new issue
Block a user