mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Login from hoyolab account page to get stoken
This commit is contained in:
@@ -33,13 +33,13 @@
|
||||
MaxLength="9"
|
||||
x:Name="UidInput"
|
||||
Margin="0,0,16,0"
|
||||
PlaceholderText="Please input your user id here."
|
||||
PlaceholderText="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>дͨ<EFBFBD><EFBFBD>֤ID"
|
||||
HorizontalAlignment="Right"/>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
RelativePanel.RightOf="UidInput"
|
||||
Click="CookieButtonClick"
|
||||
Content="{shcm:ResourceString Name=ViewPageLoginMihoyoUserLoggedInAction}"/>
|
||||
Click="CookieButtonClick"
|
||||
Content="{shcm:ResourceString Name=ViewPageLoginMihoyoUserLoggedInAction}"/>
|
||||
</Grid>
|
||||
|
||||
<WebView2
|
||||
|
||||
@@ -35,7 +35,7 @@ internal sealed partial class LoginHoyoverseUserPage : Microsoft.UI.Xaml.Control
|
||||
try
|
||||
{
|
||||
await WebView.EnsureCoreWebView2Async();
|
||||
|
||||
|
||||
|
||||
CoreWebView2CookieManager manager = WebView.CoreWebView2.CookieManager;
|
||||
IReadOnlyList<CoreWebView2Cookie> cookies = await manager.GetCookiesAsync("https://account.hoyolab.com");
|
||||
@@ -57,11 +57,15 @@ internal sealed partial class LoginHoyoverseUserPage : Microsoft.UI.Xaml.Control
|
||||
CoreWebView2CookieManager manager = WebView.CoreWebView2.CookieManager;
|
||||
IReadOnlyList<CoreWebView2Cookie> cookies = await manager.GetCookiesAsync("https://account.hoyolab.com");
|
||||
|
||||
IInfoBarService infoBarService = Ioc.Default.GetRequiredService<IInfoBarService>();
|
||||
|
||||
// Get user id from text input, login_uid is missed in cookie
|
||||
string uid = UidInput.Text;
|
||||
|
||||
if (uid.Length != 9)
|
||||
{
|
||||
await ThreadHelper.SwitchToMainThreadAsync();
|
||||
infoBarService.Warning($"<22><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>֤ ID!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,7 +93,6 @@ internal sealed partial class LoginHoyoverseUserPage : Microsoft.UI.Xaml.Control
|
||||
.ConfigureAwait(false);
|
||||
|
||||
Ioc.Default.GetRequiredService<INavigationService>().GoBack();
|
||||
IInfoBarService infoBarService = Ioc.Default.GetRequiredService<IInfoBarService>();
|
||||
|
||||
switch (result)
|
||||
{
|
||||
@@ -104,7 +107,7 @@ internal sealed partial class LoginHoyoverseUserPage : Microsoft.UI.Xaml.Control
|
||||
infoBarService.Success($"<22>û<EFBFBD> [{nickname}] <20><><EFBFBD>ӳɹ<D3B3>");
|
||||
break;
|
||||
case UserOptionResult.Incomplete:
|
||||
infoBarService.Information($"<22><> Cookie <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> user id <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>");
|
||||
infoBarService.Information($"<22><> Cookie <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>");
|
||||
break;
|
||||
case UserOptionResult.Invalid:
|
||||
infoBarService.Information($"<22><> Cookie <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>");
|
||||
|
||||
Reference in New Issue
Block a user