Development
This commit is contained in:
parent
a4652866c3
commit
27eaea3d73
19 changed files with 602 additions and 427 deletions
|
|
@ -10,39 +10,6 @@ bp = Blueprint('action_general', __name__)
|
|||
_VIEW = '/view/view_general'
|
||||
|
||||
|
||||
@bp.route('/action/general_cardlogging_save', methods=['POST'])
|
||||
@require_level('administrator')
|
||||
def general_cardlogging_save():
|
||||
log_max_kb_raw = request.form.get('log_max_kb', '').strip()
|
||||
log_errors_only = 'log_errors_only' in request.form
|
||||
dnsmasq_log_queries = 'dnsmasq_log_queries' in request.form
|
||||
|
||||
log_max_kb = validate.int_range(log_max_kb_raw, 64, None)
|
||||
if log_max_kb is None:
|
||||
flash('Max Log Size must be a number >= 64.', 'error')
|
||||
return redirect(_VIEW)
|
||||
|
||||
if not verify_core_hash(request.form.get('config_hash', '')):
|
||||
flash('Configuration was modified by another session. Please refresh and try again.', 'error')
|
||||
return redirect(_VIEW)
|
||||
|
||||
core = load_core()
|
||||
core.setdefault('general', {}).update({
|
||||
'log_max_kb': log_max_kb,
|
||||
'log_errors_only': log_errors_only,
|
||||
'dnsmasq_log_queries': dnsmasq_log_queries,
|
||||
})
|
||||
errors = validate.validate_config(core)
|
||||
if errors:
|
||||
for msg in errors:
|
||||
flash(msg, 'error')
|
||||
return redirect(_VIEW)
|
||||
save_core(core)
|
||||
|
||||
flash(queued_msg('core apply'), 'success')
|
||||
return redirect(_VIEW)
|
||||
|
||||
|
||||
@bp.route('/action/general_cardpendingchanges_save', methods=['POST'])
|
||||
@require_level('administrator')
|
||||
def general_cardpendingchanges_save():
|
||||
|
|
@ -51,7 +18,7 @@ def general_cardpendingchanges_save():
|
|||
return redirect(_VIEW)
|
||||
|
||||
core = load_core()
|
||||
core.setdefault('general', {})['apply_on_save'] = 'apply_on_save' in request.form
|
||||
core.setdefault('network_interfaces', {})['apply_on_save'] = 'apply_on_save' in request.form
|
||||
save_core(core)
|
||||
|
||||
flash(queued_msg('core apply'), 'success')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue