Development

This commit is contained in:
Matthew Grotke 2026-05-24 03:47:34 -04:00
parent 8c2f10330d
commit 867911f276
3 changed files with 21 additions and 1 deletions

View file

@ -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 config_utils import CONFIGS_DIR
@ -16,3 +17,11 @@ def clear_ddns_log():
except Exception as ex:
flash(f'Could not clear log: {ex}', 'error')
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')

View file

@ -1074,6 +1074,9 @@ def _render_item(item, tokens, inherited_req=None):
extra = f' data-filter-col="{e(filter_col)}"' if filter_col else ''
return f'<select name="{name}" class="form-select"{extra}>{options}</select>'
if t == 'spacer':
return '<span style="flex:1"></span>'
if t == 'button_row':
inner = render_items(item.get('items', []), tokens, req)
return f'<div class="button-row">{inner}</div>'

View file

@ -529,6 +529,14 @@
"action": "/action/clear_ddns_log",
"method": "post",
"text": "Clear Log"
},
{
"type": "spacer"
},
{
"type": "button_ghost",
"action": "/action/download_ddns_log",
"text": "Download Log"
}
]
},