modified: app.py

new file:   static/css/theme-dark.css
	new file:   static/css/theme-light.css
	modified:   templates/index.html
	modified:   templates/login.html
	modified:   templates/settings.html
This commit is contained in:
SimolZimol
2024-09-03 11:18:01 +02:00
parent 911ecfa9ca
commit 00c958c34d
6 changed files with 33 additions and 2 deletions

9
app.py
View File

@@ -71,7 +71,7 @@ def get_db_connection():
@app.route("/")
def index():
if "username" in session:
return render_template("index.html", bot_running=bot_status())
return render_template("index.html", bot_running=bot_status(), theme=session.get('theme', 'light'))
return redirect(url_for("login"))
@app.route("/login", methods=["GET", "POST"])
@@ -111,20 +111,25 @@ def settings():
if request.method == "POST":
introduction = request.form.get("introduction")
asknotes_introduction = request.form.get("asknotes_introduction")
theme = request.form.get("theme")
# Speichern der Intros
save_text_file(INTRO_FILE, introduction)
save_text_file(ASKNOTES_INTRO_FILE, asknotes_introduction)
# Speichern des ausgewählten Themes in der Session
session['theme'] = theme
return redirect(url_for("settings"))
# Laden der aktuellen Inhalte aus den Textdateien
introduction = load_text_file(INTRO_FILE)
asknotes_introduction = load_text_file(ASKNOTES_INTRO_FILE)
return render_template("settings.html", introduction=introduction, asknotes_introduction=asknotes_introduction)
return render_template("settings.html", introduction=introduction, asknotes_introduction=asknotes_introduction, theme=session.get('theme', 'light'))
return redirect(url_for("login"))
@app.route("/users")
def users():
"""Zeigt eine Liste aller Benutzer aus der Datenbank an."""