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

Shorts (last 50)

new Chart(document.getElementById("videosChart"), { type: 'bar', data: { - //labels: ["2024-08-16", "2024-08-17", "2024-08-18", "2024-08-19", "2024-08-20"], labels: [{% for key, value in videos_on_date_uploaded.items() %}"{{key}}",{% endfor %}], datasets: [ { @@ -189,53 +188,6 @@

Shorts (last 50)

} } }); - -/* -// Line chart -new Chart(document.getElementById("videosChart"), { - type: 'line', - data: { - labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"], - datasets: [{ - data: [1,2,4], - label: "Alberta", - borderColor: "#3e95cd", - fill: false - }, { - data: [1,2,5], - label: "BC", - borderColor: "#8e5ea2", - fill: false - }, { - data: [1,2,8], - label: "Manitoba", - borderColor: "#3cba9f", - fill: false - }, { - data: [1,2,10], - label: "New Brunswick", - borderColor: "#e8c3b9", - fill: false - }, { - data: [1,2,16], - label: "NL", - borderColor: "#c45850", - fill: false - } - ] - }, - options: { - title: { - display: true, - text: 'Positive Cases of COVID in provinces of Canada' - }, - hover: { - mode: 'index', - intersect: true - }, - } -}); -*/ diff --git a/vidzyconfig.py b/vidzyconfig.py new file mode 100644 index 0000000..54609a9 --- /dev/null +++ b/vidzyconfig.py @@ -0,0 +1,3 @@ +config = { + "ALLOW_UPLOADS": True +} \ No newline at end of file