diff --git a/fetchRAPLA.py b/fetchRAPLA.py index c039fb4..ead790f 100644 --- a/fetchRAPLA.py +++ b/fetchRAPLA.py @@ -93,13 +93,13 @@ def getRaplas(): return sorted(kursl), sorted(filel), sorted(urll) -@scheduler.task("interval", id="refreshRapla", minutes=30) +@scheduler.task("interval", id="refreshRapla", minutes=5) def refreshRapla(): """ - Aktualisiert alle 30 Minuten alle gespeicherten Raplas. + Aktualisiert alle 5 Minuten alle gespeicherten Raplas. """ filel = getRaplas()[1] urll = getRaplas()[2] for i in range(len(filel)): - urlretrieve(urll[i], "calendars/"+filel[i]) - print("Update die Kalender...") + print("Update Rapla: " + filel[i][:-5]) + urlretrieve(urll[i], "calendars/" + filel[i]) \ No newline at end of file diff --git a/init.py b/init.py index ada7a21..9d67306 100644 --- a/init.py +++ b/init.py @@ -1,7 +1,7 @@ from flask import Flask from flask_login import LoginManager, UserMixin from flask_sqlalchemy import SQLAlchemy -from talisman import Talisman +from flask_talisman import Talisman from get_mysql import get_mysql import atexit from flask_apscheduler import APScheduler @@ -71,7 +71,9 @@ class Meals(db.Model): scheduler = APScheduler() app = create() -Talisman(app, content_security_policy={"default-src": ["*.paulmartin.cloud", '\'self\'']}) +def_src = ["*.paulmartin.cloud", '\'self\''] +Talisman(app, content_security_policy={"default-src": def_src, "script-src": def_src # + ["'unsafe-inline'"] + }) scheduler.init_app(app) scheduler.start() scheduler.api_enabled = True diff --git a/routing.py b/routing.py index 2c3f329..4cde145 100644 --- a/routing.py +++ b/routing.py @@ -7,6 +7,7 @@ from werkzeug.security import generate_password_hash, check_password_hash import hashlib import datetime import time +import random import fetchDUALIS import fetchRAPLA @@ -36,7 +37,7 @@ def welcome(): return redirect(url_for("getKurs", next=url_for(request.endpoint))) sel = request.args.get("sel") if not sel: - sel="theorie" + sel = "theorie" kurs = current_user.kurs name = current_user.name if sel == "theorie": @@ -151,7 +152,8 @@ def getKurs(): kurs = fetchDUALIS.getKurs(d.token, cookie) if kurs != 0: if not fetchRAPLA.getIcal(kurs): - return render_template('kurs.html', detected=(kurs, e), s="s", theorie="hidden", praxis="hidden", file=False) + return render_template('kurs.html', detected=(kurs, e), s="s", theorie="hidden", praxis="hidden", + file=False) current_user.kurs = kurs db.session.commit() else: @@ -163,7 +165,7 @@ def getKurs(): else: e = True kurs = "" - return render_template('kurs.html', detected=(kurs, e), s="s", theorie="hidden", praxis="hidden", file=True) + return render_template('kurs.html', detected=(kurs, e), s="s", theorie="hidden", praxis="hidden", file=True) @app.route("/set-up/semester") @@ -176,7 +178,7 @@ def getSemester(): t = Dualis.query.filter_by(uid=current_user.id).first().token c = request.cookies.get("cnsc") - return render_template("semester.html", semester=fetchDUALIS.getSem(t, c), s="s", theorie="hidden", praxis="hidden") + return render_template("semester.html", semester=fetchDUALIS.getSem(t, c), s="s", theorie="hidden", praxis="hidden") @app.route("/set-up/semester", methods=["POST"]) @@ -203,7 +205,7 @@ def chooseRaplas(): :return HTML: """ r = getRaplas() - return render_template("rapla.html", raplas=r, s="s", theorie="hidden", praxis="hidden") + return render_template("rapla.html", raplas=r, s="s", theorie="hidden", praxis="hidden") @app.route("/set-up/rapla", methods=["POST"]) diff --git a/static/dropdown.js b/static/dropdown.js new file mode 100644 index 0000000..8d21b8e --- /dev/null +++ b/static/dropdown.js @@ -0,0 +1,7 @@ +document.addEventListener("DOMContentLoaded", function(event) { + const dropdown = document.getElementById("dropdown"); + dropdown.addEventListener("change", function() { + dropdown.submit(); + }); +}); + diff --git a/templates/index.html b/templates/index.html index 4d3e4a5..5e41350 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,7 +3,10 @@