diff --git a/GUI.py b/GUI.py
index 2fd8900..4e0cb98 100644
--- a/GUI.py
+++ b/GUI.py
@@ -75,13 +75,13 @@ def backgrounds():
return render_template("backgrounds.html", file="backgrounds.json")
-@app.route("/background/add", methods=["POST"])
-def background_add():
- # Get form values
- youtube_uri = request.form.get("youtube_uri").strip()
- filename = request.form.get("filename").strip()
- citation = request.form.get("citation").strip()
- position = request.form.get("position").strip()
+@app.route("/background/add", methods=["POST"])
+def background_add():
+ # Get form values
+ youtube_uri = request.form.get("youtube_uri", "").strip()
+ filename = request.form.get("filename", "").strip()
+ citation = request.form.get("citation", "").strip()
+ position = request.form.get("position", "").strip()
gui.add_background(youtube_uri, filename, citation, position)
diff --git a/GUI/backgrounds.html b/GUI/backgrounds.html
index ed7957e..29d68a6 100644
--- a/GUI/backgrounds.html
+++ b/GUI/backgrounds.html
@@ -108,6 +108,15 @@
let keys = [];
let youtube_urls = [];
+ function h(str) {
+ return String(str ?? '')
+ .replace(/&/g, '&')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''')
+ .replace(//g, '>');
+ }
+
async function loadBackgrounds() {
try {
const response = await fetch("backgrounds.json");
@@ -134,8 +143,8 @@
allowfullscreen>
-
${key}
-
${value[2]}
+
${h(key)}
+
${h(value[2])}