diff --git a/TIDALDL-UI-PRO/Pages/LoginViewModel.cs b/TIDALDL-UI-PRO/Pages/LoginViewModel.cs index afdb097..6d5a2de 100644 --- a/TIDALDL-UI-PRO/Pages/LoginViewModel.cs +++ b/TIDALDL-UI-PRO/Pages/LoginViewModel.cs @@ -47,19 +47,36 @@ public async void Login() //token (string token1, string token2) = await GetToken(); - //Login + //Login (lossless key \ video key) (string msg, LoginKey key) = await Client.Login(Settings.Username, Settings.Password, token1, PROXY); - (string msg2, LoginKey key2) = await Client.Login(Settings.Accesstoken, PROXY); (string msg3, LoginKey key3) = await Client.Login(Settings.Username, Settings.Password, token2, PROXY); if (msg.IsNotBlank() || key == null) { Growl.Error("Login Err! " + msg, Global.TOKEN_LOGIN); goto RETURN_POINT; } - if( key2 != null && key.UserID != key2.UserID) + + //Auto get accesstoken(master key) + string printSuccess = null; + string printWarning = null; + (string msg2, LoginKey key2) = Client.GetAccessTokenFromTidalDesktop(key.UserID); + if (key2 != null && msg2.IsBlank() && key2.AccessToken != Settings.Accesstoken) { - Growl.Error("User mismatch! Please use your own accesstoken.", Global.TOKEN_LOGIN); - goto RETURN_POINT; + (msg2, key2) = await Client.Login(key2.AccessToken, PROXY); + if (msg2.IsBlank() && key2 != null) + { + printSuccess = "Auto get accesstoken success!"; + Settings.Accesstoken = key2.AccessToken; + } + } + else + key2 = null; + + if (key2 == null && Settings.Accesstoken.IsNotBlank()) + { + (msg2, key2) = await Client.Login(Settings.Accesstoken, PROXY); + if (msg2.IsNotBlank() || key2 == null) + printWarning = "Accesstoken is not valid! " + msg; } if (!Settings.Remember) @@ -73,6 +90,11 @@ public async void Login() Global.AccessKey = key2; Manager.ShowWindow(VMMain); + if (printSuccess.IsNotBlank()) + Growl.Success(printSuccess, Global.TOKEN_MAIN); + else if (printWarning.IsNotBlank()) + Growl.Warning(printWarning, Global.TOKEN_MAIN); + RequestClose(); RETURN_POINT: diff --git a/TIDALDL-UI-PRO/Pages/SettingsViewModel.cs b/TIDALDL-UI-PRO/Pages/SettingsViewModel.cs index 2bc1d9d..7f05c9a 100644 --- a/TIDALDL-UI-PRO/Pages/SettingsViewModel.cs +++ b/TIDALDL-UI-PRO/Pages/SettingsViewModel.cs @@ -56,6 +56,13 @@ public async void Confim() Global.AccessKey = key; } } + else + { + UserSettings user = UserSettings.Read(); + user.Accesstoken = null; + user.Save(); + Global.AccessKey = null; + } Settings.Change(Settings, Global.Settings); diff --git a/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs b/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs index 8aeabb2..d3195ce 100644 --- a/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs +++ b/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0.3")] -[assembly: AssemblyFileVersion("1.2.0.3")] +[assembly: AssemblyVersion("1.2.0.4")] +[assembly: AssemblyFileVersion("1.2.0.4")] diff --git a/TIDALDL-UI-PRO/Properties/Geometries.xaml b/TIDALDL-UI-PRO/Properties/Geometries.xaml index 9694d28..546d5cf 100644 --- a/TIDALDL-UI-PRO/Properties/Geometries.xaml +++ b/TIDALDL-UI-PRO/Properties/Geometries.xaml @@ -40,7 +40,7 @@ M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z M16.23,18L12,15.45L7.77,18L8.89,13.19L5.16,9.96L10.08,9.54L12,5L13.92,9.53L18.84,9.95L15.11,13.18L16.23,18M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z - M 31.6667,19L 44.3333,19L 57,31.6667L 57,44.3333L 44.3333,57L 31.6667,57L 19,44.3333L 19,31.6667L 31.6667,19 Z M 26.4762,45.0454L 30.9546,49.5238L 38,42.4783L 45.0454,49.5238L 49.5237,45.0454L 42.4783,38L 49.5238,30.9546L 45.0454,26.4763L 38,33.5217L 30.9546,26.4762L 26.4762,30.9546L 33.5217,38L 26.4762,45.0454 Z + M363 179l-77 77l77 77l-30 30l-77 -77l-77 77l-30 -30l77 -77l-77 -77l30 -30l77 77l77 -77zM256 469c118 0 213 -95 213 -213s-95 -213 -213 -213s-213 95 -213 213s95 213 213 213z M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2M18 11H13L14.81 9.19A3.94 3.94 0 0 0 12 8A4 4 0 1 0 15.86 13H17.91A6 6 0 1 1 12 6A5.91 5.91 0 0 1 16.22 7.78L18 6Z M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M17,7H14.5L13.5,6H10.5L9.5,7H7V9H17V7M9,18H15A1,1 0 0,0 16,17V10H8V17A1,1 0 0,0 9,18Z \ No newline at end of file diff --git a/TIDALDL-UI-PRO/UPDATE_LOG.md b/TIDALDL-UI-PRO/UPDATE_LOG.md index ed93dfa..57d916c 100644 --- a/TIDALDL-UI-PRO/UPDATE_LOG.md +++ b/TIDALDL-UI-PRO/UPDATE_LOG.md @@ -1,5 +1,7 @@ - [ ] Auto update - [ ] Multi-language + +#### v1.2.0.4 - [x] Auto get the accessToken from tidal-desktop - [x] Allow to cancel and retry download-task