[CHANGE] Get all account info
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
@inject ISnackbar SnackbarService
|
||||
|
||||
<ForcedLoadingOverlay Visible="_isLoading"/>
|
||||
|
||||
<MudDialog>
|
||||
@@ -14,11 +16,11 @@
|
||||
<MudButton Variant="Variant.Outlined" Disabled="@(string.IsNullOrWhiteSpace(_cookieDomain) || string.IsNullOrWhiteSpace(_cookieText))" OnClick="ApplyTextCookies">Apply</MudButton>
|
||||
}
|
||||
|
||||
<MudStack Row Spacing="2" AlignItems="AlignItems.Stretch" Justify="Justify.SpaceEvenly" StretchItems="StretchItems.All">
|
||||
<MudStack Spacing="2" Style="width: 100%">
|
||||
<MudStack Row Spacing="2" AlignItems="AlignItems.Start" Justify="Justify.SpaceEvenly" StretchItems="StretchItems.All">
|
||||
<MudStack Spacing="2">
|
||||
<MudTextField Label="UserAgent" Required @bind-Value="@Client.UserAgent"/>
|
||||
</MudStack>
|
||||
<MudSimpleTable Style="width: 100%" Bordered Dense Elevation="0" Outlined Square Hover>
|
||||
<MudSimpleTable Bordered Dense Elevation="0" Outlined Square Hover>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Account id:</td>
|
||||
@@ -28,6 +30,10 @@
|
||||
<td>Account name:</td>
|
||||
<td>@Client.AccountName</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Account handle:</td>
|
||||
<td>@Client.AccountHandle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>User agent:</td>
|
||||
<td>@Client.UserAgent</td>
|
||||
@@ -51,6 +57,10 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</MudSimpleTable>
|
||||
@if (!string.IsNullOrWhiteSpace(Client.AccountImage))
|
||||
{
|
||||
<MudImage Src="@Client.AccountImage" Elevation="0" ObjectFit="ObjectFit.Contain"/>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
<MudDataGrid Items="Client.CookieContainer.GetAllCookies()" Dense Elevation="0" Outlined>
|
||||
@@ -84,14 +94,6 @@
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<PropertyColumn Title="Expires" Property="x => x.Expires"/>
|
||||
|
||||
<TemplateColumn>
|
||||
<CellTemplate>
|
||||
<MudTooltip Text="Remove">
|
||||
<MudIconButton Size="Size.Small" Icon="@Icons.Material.Filled.Remove" Color="Color.Error" OnClick="@(() => RemoveCookie(context.Item))"/>
|
||||
</MudTooltip>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
</MudDataGrid>
|
||||
</MudStack>
|
||||
|
@@ -29,17 +29,6 @@ namespace Manager.App.Components.Dialogs
|
||||
Client.CookieContainer.Add(new Cookie { Name = "SET_NAME", Domain = ".youtube.com" });
|
||||
}
|
||||
|
||||
private async Task RemoveCookie(Cookie? cookie)
|
||||
{
|
||||
if (cookie == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cookie.Expired = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void ToggleCookieTextImport()
|
||||
{
|
||||
_showCookieTextImport =! _showCookieTextImport;
|
||||
@@ -97,13 +86,27 @@ namespace Manager.App.Components.Dialogs
|
||||
|
||||
private bool CanSave()
|
||||
{
|
||||
return Client.ClientState is { LoggedIn: true };
|
||||
if (Client.ClientState == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Client.Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Client.SapisidCookie != null && Client.ClientState.LoggedIn;
|
||||
}
|
||||
|
||||
private async Task ValidateAccount()
|
||||
{
|
||||
_isLoading = true;
|
||||
await Client.BuildClientAsync();
|
||||
var result = await Client.BuildClientAsync();
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
SnackbarService.Add(result.Error?.Description ?? "Error validating account.", Severity.Error);
|
||||
}
|
||||
_isLoading = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user