Development
This commit is contained in:
parent
8c2f10330d
commit
867911f276
3 changed files with 21 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from flask import Blueprint, redirect, flash
|
import os
|
||||||
|
from flask import Blueprint, redirect, flash, send_file, abort
|
||||||
from auth import require_level
|
from auth import require_level
|
||||||
from config_utils import CONFIGS_DIR
|
from config_utils import CONFIGS_DIR
|
||||||
|
|
||||||
|
|
@ -16,3 +17,11 @@ def clear_ddns_log():
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
flash(f'Could not clear log: {ex}', 'error')
|
flash(f'Could not clear log: {ex}', 'error')
|
||||||
return redirect('/view/view_ddns')
|
return redirect('/view/view_ddns')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/action/download_ddns_log', methods=['GET'])
|
||||||
|
@require_level('administrator')
|
||||||
|
def download_ddns_log():
|
||||||
|
if not os.path.isfile(LOG_FILE):
|
||||||
|
abort(404)
|
||||||
|
return send_file(LOG_FILE, as_attachment=True, download_name='ddns.log', mimetype='text/plain')
|
||||||
|
|
|
||||||
|
|
@ -1074,6 +1074,9 @@ def _render_item(item, tokens, inherited_req=None):
|
||||||
extra = f' data-filter-col="{e(filter_col)}"' if filter_col else ''
|
extra = f' data-filter-col="{e(filter_col)}"' if filter_col else ''
|
||||||
return f'<select name="{name}" class="form-select"{extra}>{options}</select>'
|
return f'<select name="{name}" class="form-select"{extra}>{options}</select>'
|
||||||
|
|
||||||
|
if t == 'spacer':
|
||||||
|
return '<span style="flex:1"></span>'
|
||||||
|
|
||||||
if t == 'button_row':
|
if t == 'button_row':
|
||||||
inner = render_items(item.get('items', []), tokens, req)
|
inner = render_items(item.get('items', []), tokens, req)
|
||||||
return f'<div class="button-row">{inner}</div>'
|
return f'<div class="button-row">{inner}</div>'
|
||||||
|
|
|
||||||
|
|
@ -529,6 +529,14 @@
|
||||||
"action": "/action/clear_ddns_log",
|
"action": "/action/clear_ddns_log",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
"text": "Clear Log"
|
"text": "Clear Log"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "spacer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "button_ghost",
|
||||||
|
"action": "/action/download_ddns_log",
|
||||||
|
"text": "Download Log"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue