updated CSS
This commit is contained in:
@@ -67,7 +67,7 @@ def get_logs():
|
||||
|
||||
@app.route('/cleanup', methods=['DELETE'])
|
||||
def cleanup_logs():
|
||||
cutoff_date = datetime.utcnow() - timedelta(hours=24)
|
||||
cutoff_date = datetime.utcnow() - timedelta(hours=app.config.get('CLEANUP_TIME', 24))
|
||||
Log.query.filter(Log.timestamp < cutoff_date).delete()
|
||||
db.session.commit()
|
||||
return jsonify({'status': 'success', 'message': 'Old logs deleted'})
|
||||
@@ -138,7 +138,8 @@ def control_relay(hostname, relay, action):
|
||||
|
||||
@app.route('/settings', methods=['GET'])
|
||||
def settings():
|
||||
return render_template('settings.html')
|
||||
cleanup_time = app.config.get('CLEANUP_TIME', 24)
|
||||
return render_template('settings.html', cleanup_time=cleanup_time)
|
||||
|
||||
@app.route('/set_cleanup_time', methods=['POST'])
|
||||
def set_cleanup_time():
|
||||
@@ -150,6 +151,15 @@ def set_cleanup_time():
|
||||
flash('Invalid cleanup time!', 'danger')
|
||||
return redirect(url_for('settings'))
|
||||
|
||||
@app.route('/run_cleanup_now', methods=['POST'])
|
||||
def run_cleanup_now():
|
||||
with app.app_context():
|
||||
cutoff_date = datetime.utcnow() - timedelta(hours=app.config.get('CLEANUP_TIME', 24))
|
||||
Log.query.filter(Log.timestamp < cutoff_date).delete()
|
||||
db.session.commit()
|
||||
flash('Cleanup executed successfully!', 'success')
|
||||
return redirect(url_for('settings'))
|
||||
|
||||
def post_action_to_server(hostname, action):
|
||||
url = "http://your-server-url.com/action"
|
||||
payload = {
|
||||
|
||||
Reference in New Issue
Block a user