Development

This commit is contained in:
Matthew Grotke 2026-06-02 00:47:03 -04:00
parent 6d9aac0460
commit 59ac3c5973
20 changed files with 1466 additions and 1 deletions

View file

@ -0,0 +1,19 @@
import json
from view_common import get_system_interfaces, iface_info
def collect_tokens(cfg):
net = cfg.get('network_interfaces', {})
wan = net.get('wan_interface', '')
lan = net.get('lan_interface', '')
sys_ifaces = get_system_interfaces()
for configured in [wan, lan]:
if configured and configured not in sys_ifaces:
sys_ifaces.append(configured)
sys_ifaces.sort()
iface_data = [iface_info(i) for i in sys_ifaces]
return {
'GENERAL_WAN_INTERFACE': str(wan or '-'),
'GENERAL_LAN_INTERFACE': str(lan or '-'),
'NETWORK_INTERFACE_DATA_JSON': json.dumps(iface_data),
}