station: Default device type to "unknown" and propagate DHCP hostname

GuessDeviceType silently returned "mobile" for any device whose hostname
or MAC OUI didn't match a known pattern, so the UI labelled every
unidentified device as a phone. Default to "unknown" instead and broaden
hostname matching (pixel/galaxy, thinkpad, imac/-pc, QEMU OUI).

The hostapd backend was also dropping DHCP hostnames on the floor: the
correlator only forwarded MAC->IP, and convertStation hard-coded the
hostname to "". Replace UpdateIPMapping with UpdateLeaseInfo that carries
both maps so hostnames flow through to ConnectedDevice.Name.

Frontend gains a "Sans nom" fallback when no hostname is available and
French labels for the device-type badge.
This commit is contained in:
nemunaire 2026-05-01 22:21:14 +08:00
commit a758c331c0
4 changed files with 68 additions and 35 deletions

View file

@ -401,13 +401,17 @@ function displayDevices(devices) {
const deviceCard = document.createElement('div');
deviceCard.className = 'device-card';
const displayName = device.name && device.name.trim() !== ''
? device.name
: 'Sans nom';
deviceCard.innerHTML = `
${getDeviceIcon(device.type)}
<div class="device-name">${escapeHtml(device.name)}</div>
<div class="device-type">${device.type}</div>
<div class="device-name">${escapeHtml(displayName)}</div>
<div class="device-type">${escapeHtml(formatDeviceType(device.type))}</div>
<div class="device-info">
<div>${device.ip}</div>
<div style="font-size: 0.75rem;">${device.mac}</div>
<div>${escapeHtml(device.ip || '—')}</div>
<div style="font-size: 0.75rem;">${escapeHtml(device.mac)}</div>
</div>
`;
@ -415,6 +419,17 @@ function displayDevices(devices) {
});
}
function formatDeviceType(type) {
const labels = {
mobile: 'Mobile',
tablet: 'Tablette',
laptop: 'Portable',
desktop: 'Ordinateur',
unknown: 'Inconnu'
};
return labels[type] || labels.unknown;
}
function addLogEntry(log) {
const logContainer = document.getElementById('logContainer');