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>
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using Chronos.Testing;
|
|
using Chronos.Uploader.Server;
|
|
|
|
namespace Chronos.App.Tests.Uploader;
|
|
|
|
public sealed class ServerAddressTests
|
|
{
|
|
[Theory]
|
|
[Case("nas.local:8443", "https://nas.local:8443/")]
|
|
[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));
|
|
Assert.Equal(expected, uri.ToString());
|
|
}
|
|
|
|
[Theory]
|
|
[Case("")]
|
|
[Case(" ")]
|
|
[Case("ftp://nas.local")]
|
|
[Case("https://")]
|
|
public void InvalidServerAddressesAreRejected(string typed) => Assert.False(ServerAddress.TryParse(typed, out _));
|
|
}
|