Development
This commit is contained in:
parent
270856b391
commit
2bfa5ff29a
18 changed files with 814 additions and 565 deletions
|
|
@ -2,6 +2,7 @@ from flask import Blueprint, request, redirect, flash
|
|||
from auth import require_level
|
||||
from config_utils import load_core, save_core, verify_core_hash, queued_msg
|
||||
import sanitize
|
||||
import validation as validate
|
||||
|
||||
bp = Blueprint('action_apply_upstream_dns', __name__)
|
||||
|
||||
|
|
@ -26,11 +27,8 @@ def apply_upstream_dns():
|
|||
return redirect('/view/view_upstream_dns')
|
||||
upstream_servers.append(clean)
|
||||
|
||||
try:
|
||||
cache_size = int(cache_size_raw)
|
||||
if cache_size < 0:
|
||||
raise ValueError
|
||||
except (ValueError, TypeError):
|
||||
cache_size = validate.int_range(cache_size_raw, 0, None)
|
||||
if cache_size is None:
|
||||
flash('Cache Size must be a non-negative integer.', 'error')
|
||||
return redirect('/view/view_upstream_dns')
|
||||
|
||||
|
|
@ -51,6 +49,11 @@ def apply_upstream_dns():
|
|||
'cache_size': cache_size,
|
||||
'upstream_servers': upstream_servers,
|
||||
})
|
||||
errors = validate.validate_config(core)
|
||||
if errors:
|
||||
for msg in errors:
|
||||
flash(msg, 'error')
|
||||
return redirect('/view/view_upstream_dns')
|
||||
save_core(core)
|
||||
flash(queued_msg('core apply'), 'success')
|
||||
return redirect('/view/view_upstream_dns')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue