Fix: Backend score parsing (points vs score) and Frontend songselect ID fallback

This commit is contained in:
2026-01-17 21:03:09 +08:00
parent bb3ad834b2
commit 45d6b1d9de
2 changed files with 10 additions and 2 deletions

8
app.py
View File

@@ -789,7 +789,13 @@ def route_api_leaderboard_submit():
else: else:
score_obj = score_data score_obj = score_data
score_value = int(score_obj.get('score', 0)) # Check for 'score' first, then 'points'
# Frontend usually sends 'points'
score_val = score_obj.get('score')
if score_val is None:
score_val = score_obj.get('points')
score_value = int(score_val or 0)
except: except:
return api_error('invalid_score_format') return api_error('invalid_score_format')

View File

@@ -3335,7 +3335,9 @@ class SongSelect {
}); });
} }
toLeaderboard() { toLeaderboard() {
var songId = this.songs[this.selectedSong].id var song = this.songs[this.selectedSong]
var songId = song.id || song.hash
// Allow leaderboard for any song with an ID (numeric or hash) // Allow leaderboard for any song with an ID (numeric or hash)
if (!songId) { if (!songId) {
return return