Development
This commit is contained in:
parent
99447b4987
commit
27f2356cd1
10 changed files with 241 additions and 6 deletions
26
docker/routlin-dash/app/pages/captiveportal/view.py
Normal file
26
docker/routlin-dash/app/pages/captiveportal/view.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import json
|
||||
|
||||
import config_utils
|
||||
import factory
|
||||
|
||||
|
||||
def collect_tokens(cfg):
|
||||
tokens = config_utils.collect_layout_tokens(cfg)
|
||||
cp = cfg.get('captive_portal', {})
|
||||
captive_vlans = [v for v in cfg.get('vlans', []) if v.get('restricted_vlan') == 'c']
|
||||
|
||||
if captive_vlans:
|
||||
names = ', '.join(v['name'] for v in captive_vlans)
|
||||
tokens['CAPTIVE_STATUS_TEXT'] = f"Captive portal active on: {names}."
|
||||
else:
|
||||
tokens['CAPTIVE_STATUS_TEXT'] = (
|
||||
'No captive portal VLANs configured. '
|
||||
'Set Restricted VLAN = Captive Portal on the Network Layout page.'
|
||||
)
|
||||
|
||||
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', []))
|
||||
|
||||
return tokens
|
||||
Loading…
Add table
Add a link
Reference in a new issue