new options in devices

This commit is contained in:
Mateusz Gruszczyński 2025-02-24 14:26:50 +01:00
parent 977e969464
commit 1d25b1f2f6

6
app.py
View File

@ -60,6 +60,7 @@ class Device(db.Model):
use_ssl = db.Column(db.Boolean, default=False) # Czy używać SSL?
ssl_insecure = db.Column(db.Boolean, default=False) # Jeśli True nie weryfikować certyfikatu SSL
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
class Settings(db.Model):
id = db.Column(db.Integer, primary_key=True)
pushover_user_key = db.Column(db.String(255))
@ -475,7 +476,6 @@ def add_device():
return redirect(url_for('devices'))
return render_template('add_device.html')
# Szczegóły urządzenia
@app.route('/device/<int:device_id>')
@login_required
@ -539,9 +539,7 @@ def settings():
# Aktualizacja retencji logów
retention = request.form.get('log_retention_days')
user_settings.log_retention_days = int(retention) if retention else 30
db.session.commit()
try:
scheduler.reschedule_job("check_all_devices", trigger="interval", seconds=user_settings.check_interval)
app.logger.debug(f"Scheduler rescheduled with new interval: {user_settings.check_interval} seconds")
@ -552,7 +550,6 @@ def settings():
return redirect(url_for('settings'))
return render_template('settings.html', settings=user_settings)
@app.route('/device/<int:device_id>/edit', methods=['GET', 'POST'])
@login_required
def edit_device(device_id):
@ -756,7 +753,6 @@ def update_selected_devices():
return redirect(url_for('devices'))
# Zamknięcie harmonogramu przy zatrzymaniu aplikacji
atexit.register(lambda: scheduler.shutdown())
if __name__ == '__main__':