Add form for editing ipsets
This commit is contained in:
parent
a5df435931
commit
5add39a8a7
7 changed files with 88 additions and 4 deletions
|
@ -44,7 +44,11 @@ def edit(index):
|
|||
db.write('rules', rules)
|
||||
system.run(system.save_config)
|
||||
|
||||
return flask.render_template('rules/edit.html', index=index, rule=db.load('rules')[index])
|
||||
with db.locked():
|
||||
ipsets = db.read('ipsets')
|
||||
for network, data in db.read('networks').items():
|
||||
ipsets[network] = {'ip': data.get('ip', []), 'ip6': data.get('ip6', [])}
|
||||
return flask.render_template('rules/edit.html', index=index, rule=db.load('rules')[index], ipsets=ipsets)
|
||||
except IndexError as e:
|
||||
return flask.Response(f'invalid rule: {index}', status=400, mimetype='text/plain')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue