diff --git a/main.py b/main.py index be287dcc2e92fa1c89fd98aa815317c46937821c..05fbf3f34584f51ce18e65117fe33c00a7f3ee31 100644 --- a/main.py +++ b/main.py @@ -23,10 +23,10 @@ try: if(os.environ["show_build_date"] == "1"): #If you want to see the builddate you can enable this enviorement variable builddate = ", Build date: " + open("builddate.txt", "r").read() except: - pass #This normaly only happens, if the script runs without a container for testing. + pass #This exception is only to pass it while testing try: - if(os.environ["production"] == "1"): #If you disable production the flask testserver will be used, because it makes more debug output + if(os.environ["production"] == "1"): #If you use this in production, please set this to 1, because the Flask Testserver is not very secure production = True else: production = False @@ -57,16 +57,16 @@ def table_check(): def makeQR(text): #This function is used to create a QR code and encode it base64, if you make a new shortlink - qr = qrcode.QRCode( + qr = qrcode.QRCode( #QR generation variables version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=1, ) - qr.add_data(text) - qr.make(fit=True) + qr.add_data(text) #The URL is in the text variable + qr.make(fit=True) #Generate the QR - img = qr.make_image(fill_color="black", back_color="white") + img = qr.make_image(fill_color="black", back_color="white") #Encode the WR as base 64 with BytesIO() as buffer: img.save(buffer, 'jpeg') return base64.b64encode(buffer.getvalue()).decode()