Multi-printers #32

Open
n07070 wants to merge 80 commits from multi-printers into master
pull from: multi-printers
Showing only changes of commit dd27581358 - Show all commits
+13 -2
View File
@@ -127,7 +127,7 @@ except Exception as e:
# The rate limit # The rate limit
limiter = Limiter( limiter = Limiter(
get_remote_address, app=app, default_limits=["1500 per day", "500 per hour"] get_remote_address, app=app, default_limits=["86460 per day", "3660 per hour"]
) )
@@ -150,6 +150,17 @@ def webcam():
app.logger.debug("Loading webcam interface") app.logger.debug("Loading webcam interface")
return render_template("webcam.html") return render_template("webcam.html")
# General routes
@app.route("/queue")
@limiter.limit("1/second", override_defaults=False)
def queue():
"""Return the web interface index"""
app.logger.debug("Loading queue")
current_queue = print_queue.get_queue_state()
app.logger.debug(current_queue)
completed_queue = print_queue.get_queue_completed()
return render_template("queue.html", tasks=current_queue, completed_tasks=completed_queue, worker_state=worker.current_state())
# Form treatement # Form treatement
@app.route("/web/print/sms", methods=["POST"]) @app.route("/web/print/sms", methods=["POST"])
@@ -379,7 +390,7 @@ def camera_picture():
@app.route("/api/queue", methods=["GET"]) @app.route("/api/queue", methods=["GET"])
@limiter.limit("6/minute", override_defaults=False) @limiter.limit("60/minute", override_defaults=False)
n07070 marked this conversation as resolved Outdated
Outdated
Review

This is not finished yet

This is not finished yet
def api_queue_status(): def api_queue_status():
"""API endpoint for entire queue""" """API endpoint for entire queue"""
return jsonify(web.get_queue_state()) return jsonify(web.get_queue_state())