17 lines
480 B
Python
17 lines
480 B
Python
from flask import Blueprint, redirect, flash
|
|
from auth import require_level
|
|
|
|
bp = Blueprint('action_clear_ddns_log', __name__)
|
|
|
|
LOG_FILE = '/configs/ddns.log'
|
|
|
|
|
|
@bp.route('/action/clear_ddns_log', methods=['POST'])
|
|
@require_level('administrator')
|
|
def clear_ddns_log():
|
|
try:
|
|
open(LOG_FILE, 'w').close()
|
|
flash('DDNS log cleared.', 'success')
|
|
except Exception as ex:
|
|
flash(f'Could not clear log: {ex}', 'error')
|
|
return redirect('/view/view_ddns')
|