43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using Manager.App.Models.System;
|
|
using Manager.YouTube.Util.Cipher;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using MudBlazor;
|
|
|
|
namespace Manager.App.Components.Application.Dev;
|
|
|
|
public partial class CipherDev : ComponentBase
|
|
{
|
|
private YouTubeClientItem? _selectedClient;
|
|
|
|
private async Task ExecCipher(MouseEventArgs obj)
|
|
{
|
|
if (_selectedClient == null)
|
|
{
|
|
Snackbar.Add("No client selected", Severity.Warning);
|
|
return;
|
|
}
|
|
|
|
var ytClientResult = await ClientService.LoadClientByIdAsync(_selectedClient.Id);
|
|
if (!ytClientResult.IsSuccess)
|
|
{
|
|
Snackbar.Add(ytClientResult.Error?.Description ?? "Failed to get the client!", Severity.Error);
|
|
return;
|
|
}
|
|
|
|
var ytClient = ytClientResult.Value;
|
|
if (ytClient.State == null)
|
|
{
|
|
Snackbar.Add("Client state is null!", Severity.Warning);
|
|
return;
|
|
}
|
|
|
|
var decoder = await CipherManager.GetDecoderAsync(ytClient.State, ytClient);
|
|
}
|
|
|
|
private async Task<IEnumerable<YouTubeClientItem>> SearchClientsAsync(string? search, CancellationToken cancellationToken)
|
|
{
|
|
var searchResults = await ClientService.GetClientsAsync(search, cancellationToken: cancellationToken);
|
|
return !searchResults.IsSuccess ? [] : searchResults.Value;
|
|
}
|
|
} |