Development

This commit is contained in:
Matthew Grotke 2026-05-30 16:39:12 -04:00
parent f81acce23a
commit fcdaf09477
2 changed files with 7 additions and 3 deletions

View file

@ -1,7 +1,7 @@
from pathlib import Path
from flask import Blueprint, redirect, flash
from auth import require_level
from config_utils import queued_msg, CONFIGS_DIR
from config_utils import CONFIGS_DIR
_PAGE = Path(__file__).parent.name
@ -18,5 +18,5 @@ def regenerate():
except OSError as ex:
flash(f'Could not delete .radius-secret: {ex}', 'error')
return redirect(f'/{_PAGE}')
flash(queued_msg('core apply', action_label='Secret deleted - new secret will be generated on next apply'), 'success')
flash('Secret deleted. A new secret will be generated when the pending command is applied.', 'success')
return redirect(f'/{_PAGE}')

View file

@ -779,7 +779,7 @@ def collect_tokens():
try:
tokens['RADIUS_SECRET'] = open(f'{CONFIGS_DIR}/.radius-secret').read().strip()
except OSError:
tokens['RADIUS_SECRET'] = '(not yet generated - run core apply)'
tokens['RADIUS_SECRET'] = '(Generation is pending - visit Actions to apply generation command)'
tokens['STAT_BANNED_IP_COUNT'] = str(sum(1 for b in cfg.get('banned_ips', []) if b.get('enabled', True)))
tokens['STAT_BLOCKLIST_COUNT'] = str(len(cfg.get('dns_blocking', {}).get('blocklists', [])))
tokens['BLOCKLIST_STATS_HTML'] = _blocklist_stats_html(cfg)
@ -1121,6 +1121,10 @@ def serve_view(page_name):
tokens = collect_tokens()
if page_name == 'radius' and not os.path.exists(f'{CONFIGS_DIR}/.radius-secret'):
from config_utils import queue_command
queue_command('gen radius')
flash_html = ''
for category, message in get_flashed_messages(with_categories=True):
variant = {'error': 'danger', 'warning': 'warning', 'success': 'success'}.get(category, 'info')