fix: formatting, refs NOISSUE
This commit is contained in:
parent
2e876ad628
commit
5b72e25636
@ -17,7 +17,7 @@ public class User
|
|||||||
return (string.IsNullOrEmpty(NickName) ? Name : NickName).ToString();
|
return (string.IsNullOrEmpty(NickName) ? Name : NickName).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<Song> LikedSongs { get; set; }
|
public required List<Song> LikedSongs { get; set; }
|
||||||
|
|
||||||
public string? SpotifyAuthAccessToken { get; set; }
|
public string? SpotifyAuthAccessToken { get; set; }
|
||||||
public int? SpotifyAuthExpiresAfterSeconds { get; set; }
|
public int? SpotifyAuthExpiresAfterSeconds { get; set; }
|
||||||
|
@ -21,7 +21,8 @@ public class IndexModel : PageModel
|
|||||||
|
|
||||||
public User CurrentUser
|
public User CurrentUser
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_currentUser == null)
|
if (_currentUser == null)
|
||||||
{
|
{
|
||||||
var userName = this.User.Identity.Name;
|
var userName = this.User.Identity.Name;
|
||||||
|
@ -79,7 +79,8 @@ public class SongSubmissionModel : PageModel
|
|||||||
|
|
||||||
public User CurrentUser
|
public User CurrentUser
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_currentUser == null)
|
if (_currentUser == null)
|
||||||
{
|
{
|
||||||
var userName = this.User.Identity.Name;
|
var userName = this.User.Identity.Name;
|
||||||
|
@ -291,7 +291,8 @@ app.MapControllerRoute(
|
|||||||
name: "logout",
|
name: "logout",
|
||||||
pattern: "{controller=Auth}/{action=Logout}"
|
pattern: "{controller=Auth}/{action=Logout}"
|
||||||
);
|
);
|
||||||
app.MapGet("SpotifyLogin", async (HttpRequest request, HttpResponse response) => {
|
app.MapGet("SpotifyLogin", async (HttpRequest request, HttpResponse response) =>
|
||||||
|
{
|
||||||
var spotifyClient = app.Services.GetService<SpotifyApiClient>();
|
var spotifyClient = app.Services.GetService<SpotifyApiClient>();
|
||||||
var code = request.Query["code"];
|
var code = request.Query["code"];
|
||||||
var oAuthResponse = await new OAuthClient().RequestToken(
|
var oAuthResponse = await new OAuthClient().RequestToken(
|
||||||
|
@ -15,8 +15,10 @@ public class Base64UrlImageBuilder
|
|||||||
|
|
||||||
private string _fileContents = string.Empty;
|
private string _fileContents = string.Empty;
|
||||||
|
|
||||||
public string FileContents {
|
public string FileContents
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _fileContents;
|
return _fileContents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,31 +87,31 @@ public class NavidromeValidator : SongValidatorBase
|
|||||||
public class NavidromeShareInfoData
|
public class NavidromeShareInfoData
|
||||||
{
|
{
|
||||||
[JsonPropertyName("id")]
|
[JsonPropertyName("id")]
|
||||||
public string Id { get; set; }
|
public required string Id { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("description")]
|
[JsonPropertyName("description")]
|
||||||
public string Description { get; set; }
|
public required string Description { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("downloadable")]
|
[JsonPropertyName("downloadable")]
|
||||||
public bool Downloadable { get; set; }
|
public bool Downloadable { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("tracks")]
|
[JsonPropertyName("tracks")]
|
||||||
public List<NavidromeTrackInfoData> Tracks { get; set; }
|
public required List<NavidromeTrackInfoData> Tracks { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NavidromeTrackInfoData
|
public class NavidromeTrackInfoData
|
||||||
{
|
{
|
||||||
[JsonPropertyName("id")]
|
[JsonPropertyName("id")]
|
||||||
public string Id { get; set; }
|
public required string Id { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("title")]
|
[JsonPropertyName("title")]
|
||||||
public string Title { get; set; }
|
public required string Title { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("artist")]
|
[JsonPropertyName("artist")]
|
||||||
public string Artist { get; set; }
|
public required string Artist { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("album")]
|
[JsonPropertyName("album")]
|
||||||
public string Album { get; set; }
|
public required string Album { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("updatedAt")]
|
[JsonPropertyName("updatedAt")]
|
||||||
public DateTime UpdatedAt { get; set; }
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
public class SpotifyApiClient
|
public class SpotifyApiClient
|
||||||
{
|
{
|
||||||
private SpotifyClient _spotifyClient;
|
private SpotifyClient _spotifyClient;
|
||||||
private SpotifyClient _userAuthorizedSpotifyClient;
|
private SpotifyClient? _userAuthorizedSpotifyClient;
|
||||||
private ILogger<SpotifyApiClient> _logger;
|
private ILogger<SpotifyApiClient> _logger;
|
||||||
|
|
||||||
public SpotifyApiClient(ILogger<SpotifyApiClient> logger)
|
public SpotifyApiClient(ILogger<SpotifyApiClient> logger)
|
||||||
@ -33,7 +33,8 @@ public class SpotifyApiClient
|
|||||||
.WithAuthenticator(new AuthorizationCodeAuthenticator(
|
.WithAuthenticator(new AuthorizationCodeAuthenticator(
|
||||||
AppConfiguration.Instance.SpotifyClientId,
|
AppConfiguration.Instance.SpotifyClientId,
|
||||||
AppConfiguration.Instance.SpotifyClientSecret,
|
AppConfiguration.Instance.SpotifyClientSecret,
|
||||||
new AuthorizationCodeTokenResponse() {
|
new AuthorizationCodeTokenResponse()
|
||||||
|
{
|
||||||
RefreshToken = refreshResponse.RefreshToken,
|
RefreshToken = refreshResponse.RefreshToken,
|
||||||
AccessToken = refreshResponse.AccessToken,
|
AccessToken = refreshResponse.AccessToken,
|
||||||
TokenType = refreshResponse.TokenType,
|
TokenType = refreshResponse.TokenType,
|
||||||
@ -46,8 +47,10 @@ public class SpotifyApiClient
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpotifyClient UserAuthorizedSpotifyClient {
|
private SpotifyClient UserAuthorizedSpotifyClient
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
if (_userAuthorizedSpotifyClient == null)
|
if (_userAuthorizedSpotifyClient == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Cannot perform Spotify API call without user authorization. Authorize Spotify access from your user page first!");
|
throw new Exception("Cannot perform Spotify API call without user authorization. Authorize Spotify access from your user page first!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user