Skip to content

Commit

Permalink
add ALLOW_UPLOADS to vidzyconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramminCat committed Aug 20, 2024
1 parent 70a0bcc commit 881e732
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 48 deletions.
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from flask_wtf.csrf import CSRFProtect
import math
import nh3
import vidzyconfig

inproduction = False
productionpath = os.path.expanduser('~/mysite')
Expand Down Expand Up @@ -792,6 +793,10 @@ def upload_file():
if not "username" in session:
return "<script>window.location.href='/login';</script>"

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:
Expand Down
2 changes: 2 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@

MINIFY_HTML = os.environ.get("MINIFY_HTML")
HOST = os.environ.get("HOST")

ALLOW_UPLOADS = os.environ.get("ALLOW_UPLOADS")
48 changes: 0 additions & 48 deletions templates/admin_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ <h3>Shorts (last 50)</h3>
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: [
{
Expand All @@ -189,53 +188,6 @@ <h3>Shorts (last 50)</h3>
}
}
});

/*
// 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
},
}
});
*/
</script>

</body>
Expand Down
3 changes: 3 additions & 0 deletions vidzyconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config = {
"ALLOW_UPLOADS": True
}

0 comments on commit 881e732

Please sign in to comment.