Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ APPLE_KEY_PATH=/run/secrets/apple_key
# Get these from: https://developer.spotify.com/dashboard
# Guide: https://developer.spotify.com/documentation/general/guides/app-settings/#register-your-app
SPOTIFY_CLIENT_ID=
# Redirect URI for Spotify OAuth (must be registered in Spotify app settings)
SPOTIFY_REDIRECT_URI=https://dev.tunebridge.media/spotify/callback


# ============================================================================
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ APPLE_KEY_PATH="${APPLE_KEY_PATH:-}"
# Try to read Spotify client secret from Docker secret
SPOTIFY_CLIENT_ID="${SPOTIFY_CLIENT_ID:-}"
SPOTIFY_CLIENT_SECRET="$(read_secret "spotify_client_secret")"
SPOTIFY_REDIRECT_URI="${SPOTIFY_REDIRECT_URI:-https://${BASEURL}/spotify/callback}"

# Try to read Tidal client secret from Docker secret
TIDAL_CLIENT_ID="${TIDAL_CLIENT_ID:-}"
Expand Down Expand Up @@ -78,6 +79,7 @@ cat > /app/appsettings.json <<EOF
"AppleKeyPath": "$(escape_bs "$APPLE_KEY_PATH")",
"SpotifyClientId": "$SPOTIFY_CLIENT_ID",
"SpotifyClientSecret": "$SPOTIFY_CLIENT_SECRET",
"SpotifyRedirectUri": "$SPOTIFY_REDIRECT_URI",
"TidalClientId": "$TIDAL_CLIENT_ID",
"TidalClientSecret": "$TIDAL_CLIENT_SECRET",
"DiscordToken": "$DISCORD_TOKEN",
Expand Down
5 changes: 5 additions & 0 deletions src/Configuration/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ internal class AppSettings {
/// </summary>
public string SpotifyClientSecret { get; set; } = string.Empty;

/// <summary>
/// The Spotify OAuth redirect URI for user authentication.
/// </summary>
public string SpotifyRedirectUri { get; set; } = string.Empty;

/// <summary>
/// The Tidal API client ID.
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions src/Domain/Models/ApplicationUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,19 @@ public class ApplicationUser : IdentityUser {
/// Start of the current rate limit window.
/// </summary>
public DateTime? RateLimitWindowStart { get; set; }

/// <summary>
/// Spotify OAuth access token for user-specific API access.
/// </summary>
public string? SpotifyAccessToken { get; set; }

/// <summary>
/// Spotify OAuth refresh token for renewing access.
/// </summary>
public string? SpotifyRefreshToken { get; set; }

/// <summary>
/// Timestamp when the Spotify access token expires.
/// </summary>
public DateTime? SpotifyTokenExpiry { get; set; }
}
292 changes: 292 additions & 0 deletions src/Migrations/20251118214906_AddSpotifyOAuthToUser.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions src/Migrations/20251118214906_AddSpotifyOAuthToUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TuneBridge.Migrations
{
/// <inheritdoc />
public partial class AddSpotifyOAuthToUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SpotifyAccessToken",
table: "AspNetUsers",
type: "TEXT",
nullable: true);

migrationBuilder.AddColumn<string>(
name: "SpotifyRefreshToken",
table: "AspNetUsers",
type: "TEXT",
nullable: true);

migrationBuilder.AddColumn<DateTime>(
name: "SpotifyTokenExpiry",
table: "AspNetUsers",
type: "TEXT",
nullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SpotifyAccessToken",
table: "AspNetUsers");

migrationBuilder.DropColumn(
name: "SpotifyRefreshToken",
table: "AspNetUsers");

migrationBuilder.DropColumn(
name: "SpotifyTokenExpiry",
table: "AspNetUsers");
}
}
}
Loading
Loading