Added webcam, changed rate limits, added template reload

This commit is contained in:
nono 2022-05-04 21:22:01 +02:00
parent 1d40830066
commit 0e6fd73ee8

View File

@ -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}