From a1ea0a07d17fd0c057f68a38e9d153a2c910aa35 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Mon, 13 Jun 2022 21:58:05 -0500 Subject: [PATCH] small cleanup and improvements to standardization --- src/core/config.py | 6 +++--- src/core/routes/pages/OIDC_Register.py | 5 ----- src/core/utils/Logger.py | 2 +- src/core/utils/MessageHandler.py | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/core/config.py b/src/core/config.py index bab849c..e0fc33d 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -19,7 +19,7 @@ REDIRECT_LINK = "http%3A%2F%2Flocalhost%3A6969%2F" class FileGroups: videos = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm') office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf') - images = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga') + images = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga', '.webp') text = ('.txt', '.text', '.sh', '.cfg', '.conf') music = ('.psf', '.mp3', '.ogg', '.flac', '.m4a') pdf = ('.pdf') @@ -38,7 +38,7 @@ class Config(object): LOGIN_PATH = "FLASK_LOGIN" # Value can be OIDC or FLASK_LOGIN OIDC_TOKEN_TYPE_HINT = 'access_token' APP_REDIRECT_URI = REDIRECT_LINK - OIDC_CLIENT_SECRETS = ROOT_FILE_PTH + '/client_secrets.json' + OIDC_CLIENT_SECRETS = f'{ROOT_FILE_PTH}/client_secrets.json' OIDC_ID_TOKEN_COOKIE_SECURE = True OIDC_REQUIRE_VERIFIED_EMAIL = True OIDC_USER_INFO_ENABLED = True @@ -47,7 +47,7 @@ class Config(object): 'https://localhost:443/auth/realms/apps' ] - STATIC_FPTH = ROOT_FILE_PTH + "/static" + STATIC_FPTH = f"{ROOT_FILE_PTH}/static" FILEGROUPS = FileGroups VEXTENSION = FileGroups.videos OEXTENSION = FileGroups.office diff --git a/src/core/routes/pages/OIDC_Register.py b/src/core/routes/pages/OIDC_Register.py index a5b02cd..8fa115d 100644 --- a/src/core/routes/pages/OIDC_Register.py +++ b/src/core/routes/pages/OIDC_Register.py @@ -20,11 +20,6 @@ def oidc_register(): if _form.validate_on_submit(): # TODO: Create... # NOTE: Do a requests api here maybe?? - - # hashed_password = bcrypt.generate_password_hash(_form.password.data).decode("utf-8") - # user = User(username=_form.username.data, password=hashed_password) - # db.session.add(user) - # db.session.commit() flash("Account created successfully!", "success") return redirect("/login") diff --git a/src/core/utils/Logger.py b/src/core/utils/Logger.py index fed0b0e..9b0b8e1 100644 --- a/src/core/utils/Logger.py +++ b/src/core/utils/Logger.py @@ -46,7 +46,7 @@ class Logger: if createFile: folder = "logs" - file = folder + "/flask-application.log" + file = f"{folder}/flask-application.log" if not os.path.exists(folder): os.mkdir(folder) diff --git a/src/core/utils/MessageHandler.py b/src/core/utils/MessageHandler.py index f6538f2..9bf6368 100644 --- a/src/core/utils/MessageHandler.py +++ b/src/core/utils/MessageHandler.py @@ -10,5 +10,5 @@ class MessageHandler: print("MessageHandler initialized...") - def createMessageJSON(self, type, text): + def create_JSON_message(self, type, text): return '{"message": { "type": "' + type + '", "text": "' + text + '" } }'