modified: app.py

modified:   locales/de-DE.json
	modified:   locales/en-EN.json
	modified:   templates/playlists.html
This commit is contained in:
SimolZimol
2025-05-19 20:03:12 +02:00
parent fffa175d3c
commit f347515081
4 changed files with 15 additions and 4 deletions

10
app.py
View File

@@ -103,6 +103,12 @@ def callback():
code = request.args.get('code')
token_info = sp_oauth.get_access_token(code)
session["token_info"] = token_info
# Hole User-Infos und speichere sie in der Session
sp = spotipy.Spotify(auth=token_info['access_token'])
user = sp.current_user()
session["user"] = user
return redirect("/playlists")
@app.route("/playlists")
@@ -266,8 +272,8 @@ def toggle_playback():
@app.route('/logout')
def logout():
session.pop('user', None)
return redirect(url_for('index'))
session.clear()
return redirect(url_for('home'))
@app.route('/')
def index():

View File

@@ -36,5 +36,6 @@
"artist": "Künstler",
"album": "Album",
"year": "Jahr",
"open_on_spotify": "Auf Spotify öffnen"
"open_on_spotify": "Auf Spotify öffnen",
"logout": "Abmelden"
}

View File

@@ -36,5 +36,6 @@
"artist": "Artist",
"album": "Album",
"year": "Year",
"open_on_spotify": "Open on Spotify"
"open_on_spotify": "Open on Spotify",
"logout": "Logout"
}

View File

@@ -54,6 +54,9 @@
</style>
</head>
<body>
<a href="{{ url_for('logout') }}" class="logout-btn" style="position:absolute;top:20px;right:30px;">
{{ translations['logout'] if translations['logout'] else 'Logout' }}
</a>
<div class="playlist-container">
<h2>{{ translations['choose_playlist'] }}</h2>
<ul>