testdeep123 commited on
Commit
474dae4
·
verified ·
1 Parent(s): 2b24f3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -436,8 +436,17 @@ def index():
436
 
437
  @app.route("/api/status")
438
  def status():
 
439
  with app_state['lock']:
440
- return jsonify(dict(app_state))
 
 
 
 
 
 
 
 
441
 
442
  @app.route("/api/start-backup", methods=["POST"])
443
  def start_backup():
 
436
 
437
  @app.route("/api/status")
438
  def status():
439
+ # THE ONLY CHANGE IS IN THIS FUNCTION
440
  with app_state['lock']:
441
+ # Create a new dictionary with only the JSON-serializable items.
442
+ # This prevents the "TypeError: Object of type lock is not JSON serializable"
443
+ serializable_state = {
444
+ "status": app_state["status"],
445
+ "logs": app_state["logs"],
446
+ "last_backup_time": app_state["last_backup_time"],
447
+ "schedule_interval": app_state["schedule_interval"],
448
+ }
449
+ return jsonify(serializable_state)
450
 
451
  @app.route("/api/start-backup", methods=["POST"])
452
  def start_backup():