[CHANGE] Rework && adding channel fetching

This commit is contained in:
max
2025-09-06 20:40:46 +02:00
parent d0eca248bb
commit c528ad9bb3
10 changed files with 145 additions and 100 deletions

View File

@@ -20,11 +20,11 @@
</tr>
<tr>
<td>Account name:</td>
<td>@Client.AccountName</td>
<td>@Client.External.Information.AccountName</td>
</tr>
<tr>
<td>Account handle:</td>
<td>@Client.AccountHandle</td>
<td>@Client.External.Information.AccountHandle</td>
</tr>
<tr>
<td>User agent:</td>
@@ -33,26 +33,26 @@
<tr>
<td>Logged in:</td>
<td style="@($"color: {(Client.ClientState?.LoggedIn ?? false ? "green" : "red")}")">@Client.ClientState?.LoggedIn</td>
<td style="@($"color: {(Client.External.State?.LoggedIn ?? false ? "green" : "red")}")">@Client.External.State?.LoggedIn</td>
</tr>
<tr>
<td>InnerTube API key:</td>
<td>@Client.ClientState?.InnertubeApiKey</td>
<td>@Client.External.State?.InnertubeApiKey</td>
</tr>
<tr>
<td>InnerTube client version:</td>
<td>@Client.ClientState?.InnerTubeClientVersion</td>
<td>@Client.External.State?.InnerTubeClientVersion</td>
</tr>
<tr>
<td>Language:</td>
<td>@Client.ClientState?.InnerTubeContext?.InnerTubeClient?.HLanguage</td>
<td>@Client.External.State?.InnerTubeContext?.InnerTubeClient?.HLanguage</td>
</tr>
</tbody>
</MudSimpleTable>
@if (!string.IsNullOrWhiteSpace(Client.AccountImage))
@*@if (!string.IsNullOrWhiteSpace(Client.AccountImage))
{
<MudImage Src="@Client.AccountImage" Elevation="0" ObjectFit="ObjectFit.Contain"/>
}
}*@
</MudStack>
<MudPaper Elevation="0" Outlined Class="pa-2">

View File

@@ -100,7 +100,7 @@ namespace Manager.App.Components.Dialogs
private bool CanSave()
{
if (Client.ClientState == null)
if (Client.External.State == null)
{
return false;
}
@@ -110,7 +110,7 @@ namespace Manager.App.Components.Dialogs
return false;
}
return Client.SapisidCookie != null && Client.ClientState.LoggedIn;
return Client.SapisidCookie != null && Client.External.State.LoggedIn;
}
private async Task ValidateAccount()

View File

@@ -1,6 +1,3 @@
using System.Net;
using DotBased.Monads;
using Manager.Data.Entities.LibraryContext;
using Manager.YouTube;
namespace Manager.App.Services.System;
@@ -20,32 +17,4 @@ public class ClientManager : BackgroundService
{
// Clear up
}
public async Task<Result<YouTubeClient>> LoadClient(ClientAccountEntity accountEntity)
{
if (_cancellationToken.IsCancellationRequested)
{
return ResultError.Fail("Service is shutting down.");
}
var container = new CookieContainer();
if (accountEntity.HttpCookies.Count != 0)
{
var cookieColl = new CookieCollection();
foreach (var cookieEntity in accountEntity.HttpCookies)
{
cookieColl.Add(new Cookie(cookieEntity.Name, cookieEntity.Value, cookieEntity.Domain));
}
container.Add(cookieColl);
}
var ytClient = new YouTubeClient();
//ytClient.CookieContainer = container;
ytClient.UserAgent = accountEntity.UserAgent;
await ytClient.BuildClientAsync();
return ytClient;
}
}