From 0e6fd73ee8b6eda6a4db1e452ca4098c5db40d9b Mon Sep 17 00:00:00 2001 From: nono Date: Wed, 4 May 2022 21:22:01 +0200 Subject: [PATCH] Added webcam, changed rate limits, added template reload --- src/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 9599dd9..fbffff9 100644 --- a/src/main.py +++ b/src/main.py @@ -51,6 +51,7 @@ app.secret_key = configuration_file["secrets"]["flask_secret_key"] app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER app.config['ALLOWED_EXTENSIONS'] = ALLOWED_EXTENSIONS app.config['MAX_CONTENT_LENGTH'] = 3 * 1000 * 1000 # Maximum 3Mb for a file upload +app.config['TEMPLATES_AUTO_RELOAD'] = True # Printer connection # Uses the class defined in the printer.py file @@ -64,7 +65,7 @@ web = Web(app, printer) limiter = Limiter( app, key_func=get_remote_address, - default_limits=["200 per day", "50 per hour"] + default_limits=["1500 per day", "500 per hour"] ) @app.route('/') @@ -73,6 +74,12 @@ def index(): app.logger.debug("Loading index") return render_template('index.html') +@app.route('/webcam') +@limiter.limit("1/second", override_defaults=False) +def webcam(): + app.logger.debug("Loading webcam interface") + return render_template('webcam.html') + # API routes # The api has the following methods # api/print/{sms,img,letter,qr,barcode}