#103: Remove WAV support (#105)

* #103: Adding checks to prevent .wav files from being uploaded:

* #103: Added method to create song and moving some code around

* #103: Fixed build issue

* tsk-103: Cleanup of temporary files

* tsk-103: Formatting changes

* tsk-103: Minor changes

* tsk-103: Fixing build issue

* tsk-103: Refactored enum

* CORE-23734: Refactoring

* tsk-103: Confirmed functionality is working

* Removed commented code

* Removed commented code
This commit was merged in pull request #105.
This commit is contained in:
KD
2025-02-16 17:24:50 -05:00
committed by GitHub
parent a89580ac70
commit fd3ce9f96a
33 changed files with 242 additions and 99 deletions
+19 -14
View File
@@ -53,7 +53,7 @@ public class TokenManager : BaseManager
_logger.Info("Serializing token object into JSON");
var tokenObject = JsonConvert.SerializeObject(tokenRequest);
request.AddParameter("application/json; charset=utf-8",
request.AddParameter("application/json; charset=utf-8",
tokenObject, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
@@ -74,7 +74,7 @@ public class TokenManager : BaseManager
public LoginResult LoginSymmetric(User user)
{
var tokenResult = new TokenTierOne{ TokenType = "JWT" };
var tokenResult = new TokenTierOne { TokenType = "JWT" };
var payload = Payload();
payload.Add(new Claim("user_id", user.Id.ToString(), ClaimValueTypes.Integer));
@@ -91,7 +91,7 @@ public class TokenManager : BaseManager
Expires = DateTime.UtcNow.AddHours(1),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature),
Issuer = _config["Jwt:Issuer"], // Add this line
Audience = _config["Jwt:Audience"]
Audience = _config["Jwt:Audience"]
};
tokenResult.AccessToken = tokenHandler.WriteToken(tokenHandler.CreateToken(tokenDescriptor));
@@ -112,8 +112,11 @@ public class TokenManager : BaseManager
{
return new LoginResult
{
UserId = user.Id, Username = user.Username, Token = token.AccessToken,
TokenType = token.TokenType, Expiration = token.Expiration,
UserId = user.Id,
Username = user.Username,
Token = token.AccessToken,
TokenType = token.TokenType,
Expiration = token.Expiration,
Message = SUCCESSFUL_TOKEN_MESSAGE
};
}
@@ -162,13 +165,13 @@ public class TokenManager : BaseManager
"download:songs",
"read:song_details",
"upload:songs",
"delete:songs",
"read:albums",
"delete:songs",
"read:albums",
"read:artists",
"update:songs",
"stream:songs",
"read:genre",
"read:year",
"update:songs",
"stream:songs",
"read:genre",
"read:year",
"download:cover_art"
};
@@ -217,15 +220,17 @@ public class TokenManager : BaseManager
{
return await System.IO.File.ReadAllTextAsync(filepath);
}
private TokenRequest RetrieveTokenRequest()
{
_logger.Info("Retrieving token object");
return new TokenRequest
{
ClientId = _clientId, ClientSecret = _clientSecret,
Audience = _audience, GrantType = _grantType
ClientId = _clientId,
ClientSecret = _clientSecret,
Audience = _audience,
GrantType = _grantType
};
}