🐛 Fix Spotify OIDC

This commit is contained in:
2025-11-02 16:00:02 +08:00
parent 6817ab6b56
commit 74f8221be4
2 changed files with 5 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ public class SpotifyPresenceService(
/// <summary> /// <summary>
/// Updates the Spotify presence activity for a specific user /// Updates the Spotify presence activity for a specific user
/// </summary> /// </summary>
public async Task UpdateSpotifyPresenceAsync(SnAccount account) private async Task UpdateSpotifyPresenceAsync(SnAccount account)
{ {
var connection = await db.AccountConnections var connection = await db.AccountConnections
.FirstOrDefaultAsync(c => c.AccountId == account.Id && c.Provider == "spotify"); .FirstOrDefaultAsync(c => c.AccountId == account.Id && c.Provider == "spotify");
@@ -104,7 +104,7 @@ public class SpotifyPresenceService(
); );
} }
private async Task<SnPresenceActivity> ParseAndCreatePresenceActivityAsync(Guid accountId, string currentlyPlayingJson) private static Task<SnPresenceActivity> ParseAndCreatePresenceActivityAsync(Guid accountId, string currentlyPlayingJson)
{ {
var document = JsonDocument.Parse(currentlyPlayingJson); var document = JsonDocument.Parse(currentlyPlayingJson);
var root = document.RootElement; var root = document.RootElement;
@@ -178,7 +178,7 @@ public class SpotifyPresenceService(
contextUrl = contextExternalUrls.GetProperty("spotify").GetString(); contextUrl = contextExternalUrls.GetProperty("spotify").GetString();
} }
return new SnPresenceActivity return Task.FromResult(new SnPresenceActivity
{ {
AccountId = accountId, AccountId = accountId,
Type = PresenceType.Music, Type = PresenceType.Music,
@@ -204,6 +204,6 @@ public class SpotifyPresenceService(
["spotify_track_url"] = trackUrl, ["spotify_track_url"] = trackUrl,
["updated_at"] = SystemClock.Instance.GetCurrentInstant() ["updated_at"] = SystemClock.Instance.GetCurrentInstant()
} }
}; });
} }
} }

View File

@@ -29,7 +29,7 @@ public class SpotifyOidcService(
{ "client_id", config.ClientId }, { "client_id", config.ClientId },
{ "redirect_uri", config.RedirectUri }, { "redirect_uri", config.RedirectUri },
{ "response_type", "code" }, { "response_type", "code" },
{ "scope", "user-read-private user-read-current-playing user-read-email" }, { "scope", "user-read-private user-read-email user-read-currently-playing" },
{ "state", state }, { "state", state },
}; };