Development

This commit is contained in:
Matthew Grotke 2026-06-09 21:40:14 -04:00
parent 0983e14de4
commit e4629fd164
4 changed files with 65 additions and 6 deletions

View file

@ -55,6 +55,27 @@ def upstreamdns_save():
return redirect(f'/{_PAGE}')
VALID_PERIODS = {0, 1, 7, 30, 60, 90, 365}
@bp.route('/action/dnsserver/metrics_period_save', methods=['POST'])
@auth.require_level('administrator')
def metrics_period_save():
try:
period = int(request.form.get('metrics_period', '0'))
except ValueError:
period = 0
if period not in VALID_PERIODS:
flash('Invalid period value.', 'error')
return redirect(f'/{_PAGE}')
if not config_utils.verify_config_hash(request.form.get('config_hash', '')):
flash('Configuration was modified by another session. Please refresh and try again.', 'error')
return redirect(f'/{_PAGE}')
cfg = config_utils.load_config()
cfg.setdefault('upstream_dns', {})['metrics_period'] = period
config_utils.save_config(cfg)
return redirect(f'/{_PAGE}')
@bp.route('/action/dnsserver/dnsforwarding_save', methods=['POST'])
@auth.require_level('administrator')
def dnsforwarding_save():