diff --git a/routes.py b/routes.py index f90ecfb..cf85796 100644 --- a/routes.py +++ b/routes.py @@ -9,6 +9,7 @@ import os import time from functools import wraps from db import init_db, get_db, close_db, create_participant, now +from datetime import datetime, timezone bp = Blueprint("main", __name__) @@ -23,10 +24,22 @@ def load_songs_list(): with open(BASE_DIR / "data" / "songs.json", encoding="utf-8") as f: return json.load(f) +@bp.route("/datenschutz") +def datenschutz(): + return render_template("datenschutz.html") + +@bp.route("/agree-dse", methods=["POST"]) +def agree_dse(): + session["dse_agreed"] = True + session["dse_agreed_at"] = datetime.now(timezone.utc).isoformat() + return redirect(url_for("main.index")) + @bp.route("/login") def login(): if "name" in session: return redirect(url_for("main.index")) + elif "dse_agreed" not in session: + return redirect(url_for("main.datenschutz")) return render_template("login.html") @@ -39,7 +52,7 @@ def index(): session.clear() # neuer Teilnehmer = frischer Stand session["name"] = name session["pid"] = create_participant(name) - return redirect(url_for("main.test")) + #return redirect(url_for("main.test")) if "pid" not in session: return redirect(url_for("main.login")) return render_template("index.html") @@ -50,12 +63,16 @@ def index(): def test(): if "name" not in session: return redirect(url_for("main.index")) + elif "dse_agreed" not in session: + return redirect(url_for("main.datenschutz")) return render_template("test.html", name=session["name"]) @bp.route("/api/getRandomSong") def api_getRandomSong(): if "name" not in session: return jsonify({"error": "no session detected"}), 401 + elif "dse_agreed" not in session: + return jsonify({"error": "no agreement on privacy policy detected"}), 401 done = session.get("done", []) #print(done) @@ -90,6 +107,8 @@ def api_getRandomSong(): def api_rate(): if "pid" not in session or "current" not in session: return jsonify({"error": "no session detected"}), 401 + elif "dse_agreed" not in session: + return redirect(url_for("main.datenschutz")) data = request.get_json(silent=True) or {} choice = data.get("choice") @@ -113,8 +132,12 @@ def api_rate(): done.append(cur["id"]) session["done"] = done session.pop("current", None) + + truth = cur["truth"] + if not current_app.debug: + truth = False - return jsonify({"saved": True}) + return jsonify({"saved": True, "solution": {"truth": truth, "choice": choice}}) def admin_required(view): diff --git a/static/style/style.css b/static/style/style.css index a0378dc..623ab8b 100644 --- a/static/style/style.css +++ b/static/style/style.css @@ -46,6 +46,15 @@ header { flex-wrap: wrap; } +footer { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background: var(--surface); + border-top: 1px solid var(--border); +} + .brand { font-weight: 600; font-size: 1.1rem; diff --git a/static/style/test.css b/static/style/test.css index 09bea3f..9c46989 100644 --- a/static/style/test.css +++ b/static/style/test.css @@ -80,4 +80,67 @@ .rating .choices { grid-template-columns: 1fr 1fr; } .rating .choice-none { grid-column: 1 / -1; } .rating button[type="submit"] { width: 100%; } +} + +.result { + margin-top: 1.5rem; + padding: 1.25rem 0.5rem 0.5rem; /* oben 1.25rem, sonst 0.5rem */ + border-radius: calc(0.5rem + 6px); /* padding + button radius */ + border: 1px solid transparent; +} + +.result.invisible { + display: none; +} + +.result.wrong { + background-color: #fde8e8; + border-color: #f5b5b5; + color: #9b1c1c; +} + +.result.right { + background-color: #e3f6e8; + border-color: #a6dbb4; + color: #166534; +} + +@media (prefers-color-scheme: dark) { + .result.wrong { + background-color: #3b1c1c; + border-color: #7f3434; + color: #fca5a5; + } + + .result.right { + background-color: #12301d; + border-color: #2f6b45; + color: #86efac; + } +} + +.result fieldset { + margin: 0 0 1rem; + padding: 0; + border: 0; + min-width: 0; +} + +.result legend { + padding: 0; + margin-bottom: .75rem; + font-size: 1.05rem; + font-weight: 600; +} + +.result button[type="submit"] { + min-height: 2.75rem; + padding: 0 1.75rem; + font-weight: 600; +} + +.result button[type="submit"]:disabled { opacity: .5; cursor: default; } + +@media (max-width: 480px) { + .result button[type="submit"] { width: 100%; } } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 6aa1f11..2226fc6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -27,5 +27,6 @@
{% block content %}{% endblock %}
+ \ No newline at end of file diff --git a/templates/datenschutz.html b/templates/datenschutz.html new file mode 100644 index 0000000..26f6bb0 --- /dev/null +++ b/templates/datenschutz.html @@ -0,0 +1,55 @@ +{% extends "base.html" %} +{% block content %} + +

Datenschutzerklärung

+ +

Kurz

+ + + +

Rechtlich vollständig

+ +

+ Verantwortlicher: Robin Schanbacher, Friedrich-List-Straße 7, 72127 Kusterdingen, robin@schanbros.de +

+

+ Verarbeitete Daten: +

+

+

+ Zweck: Analyse, wie stark Aufnahmen komprimiert werden sollten, damit sie Speicherplatz sparen, aber trotzdem in guter Qualität vorhanden sind. +

+

+ Rechtsgrundlage: Ihre Einwilligung (Art. 6 Abs. 1 lit. a DSGVO). Diese können Sie jederzeit mit Wirkung für die Zukunft widerrufen. +

+

+ Einsicht in die Daten: Admin (Verantwortlicher) und der verantwortlicher Tontechniker (Artur Schanbacher, Friedrich-List-Straße 7, 72127 Kusterdingen, arutras@gmail.com). Der Tontechniker darf Teile der allgemeinen Auswertung an Dritte weitergeben, jedoch nur in anonymisierter bzw. zusammengefasster Form, ohne Namen oder Rückschluss auf einzelne Personen. +

+

+ Speicherdauer: Nach Abschluss der Auswertung werden die Daten anonymisiert (Namen entfernt) und können dauerhaft archiviert werden. +

+

+ Hosting: Die Anwendung läuft auf einem eigenen Server. +

+

+ Ihre Rechte: Auskunft, Berichtigung, Löschung, Einschränkung, Widerspruch und Datenübertragbarkeit sowie Widerruf der Einwilligung (mit Wirkung für die Zukunft; bis dahin bleibt die Verarbeitung rechtmäßig). Eine formlose E-Mail an den Verantwortlichen genügt. Die Löschung erfolgt innerhalb von drei Tagen. Sie haben außerdem das Recht, sich bei einer Aufsichtsbehörde zu beschweren, z. B. beim Landesbeauftragten für den Datenschutz und die Informationsfreiheit Baden-Württemberg. +

+

+ Die Teilnahme ist freiwillig. Ohne Einwilligung und Angabe eines Namens ist eine Teilnahme am Test jedoch nicht möglich. +

+ +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index eaf8c55..f7bf7b1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,6 +1,63 @@ {% extends "base.html" %} {% block content %} + + + +

Beispiel und Beweis

+ +
+

+ +
+ + +
+ +
+ + +
+ +
+ + 0:00 / 0:00 + +

Leertaste startet und pausiert. [A] wechselt auf A, [B] auf B. [T] wechselt zwischen A und B.

+
+
+ + + + + +
+ +

Informationen

+ + +
diff --git a/templates/test.html b/templates/test.html index 63134ef..c466995 100644 --- a/templates/test.html +++ b/templates/test.html @@ -47,15 +47,24 @@ - + + +