mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-03 22:12:00 +10:00
- ASP.NET Core 9 Blazor Web App + Web API - Hosts file management (read/write, hosts(5) format) - DHCP static hosts (dhcp-host=, dnsmasq config) - DHCP leases (read-only, dnsmasq lease file format) - Reload and status commands (configurable) - Docker: standalone app image + Dockerfile.dnsmasq (app + dnsmasq) - docker-compose.test.yml: app + dhcp-client, testdata mount - Unit tests (Hosts, DhcpHost, Leases, DnsmasqConfig parsers) using testdata
79 lines
2.6 KiB
Plaintext
79 lines
2.6 KiB
Plaintext
@page "/"
|
|
@rendermode InteractiveServer
|
|
@inject HttpClient Http
|
|
|
|
<PageTitle>Dnsmasq Web UI</PageTitle>
|
|
|
|
<h1 class="mb-4">Dnsmasq Web UI</h1>
|
|
|
|
<p class="lead text-muted mb-4">Manage DNS hosts and DHCP static assignments for dnsmasq.</p>
|
|
|
|
@if (_status != null)
|
|
{
|
|
<div class="alert alert-@(_status.dnsmasqStatus == "active" ? "success" : "secondary") mb-4 py-2">
|
|
<strong>Service:</strong> @(_status.dnsmasqStatus ?? "—")
|
|
@if (_status.reloadCommandConfigured)
|
|
{
|
|
<span class="ms-2 text-muted small">· Reload configured</span>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
<div class="row g-4">
|
|
<div class="col-md-4">
|
|
<div class="card h-100 shadow-sm">
|
|
<div class="card-body">
|
|
<h5 class="card-title">
|
|
<span class="bi bi-file-text me-2" aria-hidden="true"></span>Hosts
|
|
</h5>
|
|
<p class="card-text text-muted small">Edit the hosts file (/etc/hosts). Add or change static hostname-to-IP mappings.</p>
|
|
<a href="hosts" class="btn btn-primary btn-sm">Open Hosts</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="card h-100 shadow-sm">
|
|
<div class="card-body">
|
|
<h5 class="card-title">
|
|
<span class="bi bi-hdd-network me-2" aria-hidden="true"></span>DHCP
|
|
</h5>
|
|
<p class="card-text text-muted small">Manage static DHCP host entries (dhcp-host=). Assign fixed IPs by MAC or hostname.</p>
|
|
<a href="dhcp" class="btn btn-primary btn-sm">Open DHCP</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="card h-100 shadow-sm">
|
|
<div class="card-body">
|
|
<h5 class="card-title">
|
|
<span class="bi bi-list-check me-2" aria-hidden="true"></span>Leases
|
|
</h5>
|
|
<p class="card-text text-muted small">View active DHCP leases (read-only). Refreshes from the leases file on demand.</p>
|
|
<a href="leases" class="btn btn-primary btn-sm">Open Leases</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private HomeStatusDto? _status;
|
|
|
|
private class HomeStatusDto
|
|
{
|
|
public string? dnsmasqStatus { get; set; }
|
|
public bool reloadCommandConfigured { get; set; }
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
_status = await Http.GetFromJsonAsync<HomeStatusDto>("api/status");
|
|
}
|
|
catch
|
|
{
|
|
// Status is optional on home; leave _status null
|
|
}
|
|
}
|
|
}
|