Hosts: managed file, read-only system/addn-hosts, HostsFileSection UI

- Managed hosts file (zz-dnsmasq-webui.hosts): app reads/writes only this;
  addn-hosts in managed config loads it. SystemHostsPath is read-only display.
- Hosts page: editable managed file; then 'Other hosts (read-only)' (system
  hosts when configured and !no-hosts, plus addn-hosts excluding managed).
- GET api/hosts/readonly for read-only files; no-hosts hides system hosts.
- HostsFileSection.razor component; fix space before read-only badge.
- Test harness: show container /etc/hosts (default SystemHostsPath).
- Config parsing/sources, tests and client updates for new hosts model.
This commit is contained in:
2026-02-02 23:56:20 +10:00
parent 888bc980cf
commit a0863a663e
22 changed files with 249 additions and 107 deletions
@@ -62,6 +62,8 @@ public class StatusController : ControllerBase
var status = new DnsmasqServiceStatus(
SystemHostsPath: string.IsNullOrEmpty(systemHostsPath) ? null : systemHostsPath,
SystemHostsPathExists: !string.IsNullOrEmpty(systemHostsPath) && System.IO.File.Exists(systemHostsPath),
ManagedHostsFilePath: set.ManagedHostsFilePath,
ManagedHostsPathExists: !string.IsNullOrEmpty(set.ManagedHostsFilePath) && System.IO.File.Exists(set.ManagedHostsFilePath),
NoHosts: effectiveConfig.NoHosts,
AddnHostsPaths: effectiveConfig.AddnHostsPaths,
EffectiveConfig: effectiveConfig,