From 9957c9d64f5644f39378d53cf33370b17b5d22db Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Sat, 4 Jul 2026 17:29:19 +0200 Subject: [PATCH] fix(ui): correct HTTPS URL override toggle + normalize derived override (#355) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two follow-ups to the derive/show/override settings work: - The "advanced override" affordance reused the .info-toggle style with a text label, which is an 18px circular icon badge — the label rendered as a broken blue circle. Use the icon-toggle pattern like TLS extra hosts: a small ⓘ that reveals a details block containing the explanation and the override input. - Existing installs persist their old effective HTTPS URL in the (now override) https_server_url field, so the UI showed "(override)" even when the value equals what we would derive. On load, treat an override that exactly matches the derived URL as "derive" (clear it), so default installs show "(derived from Target Domain)"; genuinely custom values are kept as overrides. Verified live: an existing settings.json with https_server_url equal to the derived value now reports an empty override, and the served admin HTML uses the ⓘ toggle. refs #355 Co-Authored-By: Claude Opus 4.8 (1M context) --- cmd/soundtouch-service/main.go | 13 ++++++++++--- pkg/service/handlers/web/index.html | 29 ++++++++++++++--------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cmd/soundtouch-service/main.go b/cmd/soundtouch-service/main.go index 79209f1..6892f88 100644 --- a/cmd/soundtouch-service/main.go +++ b/cmd/soundtouch-service/main.go @@ -964,10 +964,17 @@ func applyPersistedSettings(ds *datastore.DataStore, config *serviceConfig) data } // persisted.HTTPServerURL is the HTTPS override (empty = derive). - // Existing installs carry their old effective value here, so it is - // preserved as an override; recompute the effective URL either way, - // since serverURL may have come from the persisted settings above. + // Existing installs carry their old effective value here; if it is + // exactly what we would derive anyway, treat it as "derive" so those + // installs don't show a spurious override in the UI. A genuinely custom + // value is kept as an override. Recompute either way, since serverURL + // may have come from the persisted settings above. config.httpsOverride = persisted.HTTPServerURL + if config.httpsOverride != "" && + config.httpsOverride == handlers.DeriveHTTPSURL(config.serverURL, "", config.httpsPort, config.httpsDefaultURL) { + config.httpsOverride = "" + } + config.httpsServerURL = handlers.DeriveHTTPSURL(config.serverURL, config.httpsOverride, config.httpsPort, config.httpsDefaultURL) config.discoveryEnabled = persisted.DiscoveryEnabled diff --git a/pkg/service/handlers/web/index.html b/pkg/service/handlers/web/index.html index 9a5f7c5..8d84e4c 100644 --- a/pkg/service/handlers/web/index.html +++ b/pkg/service/handlers/web/index.html @@ -187,21 +187,20 @@ -
- Advanced: override HTTPS URL ⓘ -
-

- AfterTouch also serves an HTTPS endpoint (used for the - DNS-based redirect, music-service login, and certificate - trust). By default it follows the Target Domain above - (same host, on the HTTPS port), so you normally don't - set anything here. Provide an override only when a - reverse proxy serves HTTPS on a different host or port. - Leave it empty to go back to deriving it automatically. - Takes effect after saving. -

- -
+ +
+

+ AfterTouch also serves an HTTPS endpoint (used for the + DNS-based redirect, music-service login, and certificate + trust). By default it follows the Target Domain above + (same host, on the HTTPS port), so you normally don't set + anything here. Provide an override only when a reverse + proxy serves HTTPS on a different host or port. Leave it + empty to go back to deriving it automatically. Takes effect + after saving. +

+ +