Development

This commit is contained in:
Matthew Grotke 2026-06-02 00:07:39 -04:00
parent ea8a025488
commit f7cbe2acf9
2 changed files with 4 additions and 25 deletions

View file

@ -47,8 +47,7 @@
},
{
"label": "Vendor",
"field": "vendor",
"render": "raw_html"
"field": "vendor"
},
{
"label": "VLAN",

View file

@ -22,34 +22,14 @@ try:
except Exception:
_mac_parser = None
try:
from mac_vendor_lookup import MacLookup as _MacLookup
_mac_lookup = _MacLookup()
except Exception:
_mac_lookup = None
def _get_vendor(mac):
"""Return (short, long) where short is the abbreviated name and long is the full IEEE name."""
short, long = '', ''
if _mac_parser:
try:
short = _mac_parser.get_manuf(mac) or ''
return _mac_parser.get_manuf(mac) or ''
except Exception:
pass
if _mac_lookup:
try:
long = _mac_lookup.lookup(mac) or ''
except Exception:
pass
return (short or long, long)
def _vendor_html(vendor):
short, long = vendor
if not short:
return '-'
if long and long != short:
return f'<span class="tag" data-tooltip="{e(long)}">{e(short)}</span>'
return e(short)
return ''
# File loaders ======================================================
@ -249,7 +229,7 @@ def live_dhcp_leases():
'hostname': hostname_html,
'ip_address': parts[2],
'mac_address': parts[1],
'vendor': _vendor_html(_get_vendor(parts[1])),
'vendor': _get_vendor(parts[1]),
'vlan_name': vlan_name,
'last_active': last_active,
'renews': 'in ' + relative_time(renews_ts or expiry, now, short=True),