[CHANGE] Fixed storing account/channel

This commit is contained in:
max
2025-09-22 14:53:41 +02:00
parent 1903cb2938
commit a7baeb0d73
7 changed files with 78 additions and 16 deletions

View File

@@ -105,8 +105,23 @@ public class ClientService(IServiceScopeFactory scopeFactory, ILogger<ClientServ
LogEvent("Failed to store client no ID!", LogSeverity.Warning);
return ResultError.Fail("Client does not have an ID, cannot save to library database!");
}
List<HttpCookieEntity> httpCookies = [];
httpCookies.AddRange(client.CookieContainer.GetAllCookies()
.ToList()
.Select(cookie => new HttpCookieEntity
{
ClientId = client.Id,
Name = cookie.Name,
Value = cookie.Value,
Domain = cookie.Domain,
Path = cookie.Path,
Secure = cookie.Secure,
HttpOnly = cookie.HttpOnly,
ExpiresUtc = cookie.Expires
}));
var saveResult = await _libraryService.SaveClientAsync(new ClientAccountEntity { Id = client.Id, UserAgent = client.UserAgent }, cancellationToken);
var saveResult = await _libraryService.SaveClientAsync(new ClientAccountEntity { Id = client.Id, UserAgent = client.UserAgent, HttpCookies = httpCookies }, cancellationToken);
return saveResult;
}
}