diff --git a/YandexMusicResolver/Config/YandexCredentials.cs b/YandexMusicResolver/Config/YandexCredentials.cs new file mode 100644 index 0000000..41c8086 --- /dev/null +++ b/YandexMusicResolver/Config/YandexCredentials.cs @@ -0,0 +1,26 @@ +namespace YandexMusicResolver.Config; + +/// +/// Class for storing credentials for +/// +public class YandexCredentials { + /// + /// Login for authorizing in Yandex + /// + public string? Login { get; set; } + + /// + /// Password for authorizing in Yandex + /// + public string? Password { get; set; } + + /// + /// Token for authorizing in Yandex + /// + public string? Token { get; set; } + + /// + /// Is anonymous access allowed + /// + public bool AllowAnonymous { get; set; } +} diff --git a/YandexMusicResolver/Config/YandexCredentialsProvider.cs b/YandexMusicResolver/Config/YandexCredentialsProvider.cs index 474e8ab..1cf2493 100644 --- a/YandexMusicResolver/Config/YandexCredentialsProvider.cs +++ b/YandexMusicResolver/Config/YandexCredentialsProvider.cs @@ -38,9 +38,12 @@ public YandexCredentialsProvider(IYandexMusicAuthService yandexMusicAuthService, /// /// Initializes a new with anonymizes access /// - public YandexCredentialsProvider(IYandexMusicAuthService yandexMusicAuthService) { + public YandexCredentialsProvider(IYandexMusicAuthService yandexMusicAuthService, YandexCredentials credentials) { _yandexMusicAuthService = yandexMusicAuthService; - AllowAnonymous = true; + _login = credentials.Login; + _password = credentials.Login; + _token = credentials.Token; + AllowAnonymous = credentials.AllowAnonymous; } /// diff --git a/YandexMusicResolver/YandexMusicResolver.csproj b/YandexMusicResolver/YandexMusicResolver.csproj index 2ae8d5a..6355289 100644 --- a/YandexMusicResolver/YandexMusicResolver.csproj +++ b/YandexMusicResolver/YandexMusicResolver.csproj @@ -12,17 +12,10 @@ A library aimed at searching, resolving and getting direct links to tracks, playlists or albums in Yandex.Music. Can work without authorization. Git https://github.com/SKProCH/YandexMusicResolver - 5.0.1 + 5.1.0 MIT -- Removed all `IYandexConfig` infrastructure. Use `IYandexCredentialProvider` or implement your own. -- Remove YandexMusicAuth class, use IYandexMusicAuthService or implement your own. -- All List replaced with IReadOnlyCollections in API -- Make `YandexMusicTrack` ID long instead of string -- Migrate to System.Text.Json and IHttpClientFactory (still can be used with just HttpClient) -- Remove Proxy specifying. Set proxy in IHttpClientFactory or HttpClient. -- Target framework lowered to netstandard2.0 -- Change type of IYandexMusicDirectUrlLoader.GetDirectUrl TrackId parameter to long +- Add YandexCredentials class for YandexCredentialsProvider README.md icon.png @@ -37,7 +30,7 @@ - +