Development

This commit is contained in:
Matthew Grotke 2026-06-07 15:11:40 -04:00
parent 27f2356cd1
commit 19f0bfa79c
4 changed files with 115 additions and 21 deletions

View file

@ -20,7 +20,23 @@ def collect_tokens(cfg):
tokens['CAPTIVE_HTTP_PORT'] = str(cp.get('http_port', 8081))
tokens['CAPTIVE_HTTPS_DOMAIN'] = cp.get('https_domain', '')
tokens['CAPTIVE_SPLASH_TEXT'] = cp.get('splash_text', '')
tokens['CAPTIVE_TERMS'] = json.dumps(cp.get('terms', []))
display_rows = []
for vlan in captive_vlans:
terms = vlan.get('portal_terms', [])
n = len(terms)
display_rows.append({
'vlan_name': vlan['name'],
'portal_splash_title': vlan.get('portal_splash_title', ''),
'portal_splash_text': vlan.get('portal_splash_text', ''),
'portal_terms': terms,
'portal_terms_display': f'{n} term{"s" if n != 1 else ""}' if n else '--',
})
content = factory.load_json(f'{factory.PAGES_DIR}/captiveportal/content.json')
for table_item in factory.iter_table_items(content.get('items', [])):
ds = table_item.get('datasource', '')
data = display_rows if ds == 'captive_portals' else []
tokens[factory.table_token_key(ds)] = factory.build_table(table_item, tokens, data)
return tokens