From 881e732be8d4f3108df9fe7196c260befee9cda2 Mon Sep 17 00:00:00 2001 From: snowcatridge10 <72707293+ProgramminCat@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:00:09 -0400 Subject: [PATCH] add ALLOW_UPLOADS to vidzyconfig --- app.py | 5 ++++ settings.py | 2 ++ templates/admin_panel.html | 48 -------------------------------------- vidzyconfig.py | 3 +++ 4 files changed, 10 insertions(+), 48 deletions(-) create mode 100644 vidzyconfig.py diff --git a/app.py b/app.py index 0728bb0..feb4c3b 100644 --- a/app.py +++ b/app.py @@ -14,6 +14,7 @@ from flask_wtf.csrf import CSRFProtect import math import nh3 +import vidzyconfig inproduction = False productionpath = os.path.expanduser('~/mysite') @@ -792,6 +793,10 @@ def upload_file(): if not "username" in session: return "" + if "ALLOW_UPLOADS" in vidzyconfig.config: + if vidzyconfig.config["ALLOW_UPLOADS"] == False: + return "This instance does not allow uploading videos" + if request.method == 'POST': # check if the post request has the file part if 'file' not in request.files: diff --git a/settings.py b/settings.py index 5e6fad6..17c6ec5 100644 --- a/settings.py +++ b/settings.py @@ -19,3 +19,5 @@ MINIFY_HTML = os.environ.get("MINIFY_HTML") HOST = os.environ.get("HOST") + +ALLOW_UPLOADS = os.environ.get("ALLOW_UPLOADS") \ No newline at end of file diff --git a/templates/admin_panel.html b/templates/admin_panel.html index 8bcd350..9b58637 100644 --- a/templates/admin_panel.html +++ b/templates/admin_panel.html @@ -162,7 +162,6 @@