switched to using api tokens instead of login credentials
This commit is contained in:
parent
86f273d12d
commit
226caf4c1e
13 changed files with 215 additions and 85 deletions
|
|
@ -50,15 +50,26 @@ public class ClientService : IClientService
|
|||
|
||||
foreach (var server in servers)
|
||||
{
|
||||
var client = new JellyfinApiClient(server.Url, server.Username, server.Password);
|
||||
var client = new JellyfinApiClient(server.Url, server.ApiToken);
|
||||
|
||||
// try
|
||||
// {
|
||||
// await client.Authenticate();
|
||||
// }
|
||||
// catch (JellyfinApiClientException e)
|
||||
// {
|
||||
// _logger.LogError($"Error authenticating to {server.Url}. Error: {e.Message} Client will not be used");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
try
|
||||
{
|
||||
await client.Authenticate();
|
||||
await client.GetServerInfo(); //test the connection
|
||||
}
|
||||
catch (JellyfinApiClientException e)
|
||||
{
|
||||
|
||||
_logger.LogError($"Error authenticating to {server.Url}. Error: {e.Message} Client will not be used");
|
||||
continue;
|
||||
}
|
||||
|
||||
clients.Add(client);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,13 @@ public class ServerService : IServerService
|
|||
{
|
||||
private readonly IServerRepository _repository;
|
||||
private readonly IClientService _service;
|
||||
private readonly ILogger<ServerService> _logger;
|
||||
|
||||
public ServerService(IServerRepository repository, IClientService service)
|
||||
public ServerService(IServerRepository repository, IClientService service, ILogger<ServerService> logger)
|
||||
{
|
||||
_repository = repository;
|
||||
_service = service;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<ServerDTO[]> GetServers()
|
||||
|
|
@ -24,6 +26,8 @@ public class ServerService : IServerService
|
|||
|
||||
foreach (var client in clients)
|
||||
{
|
||||
_logger.LogInformation($"ID for server {client.InstanceUrl} is {client.ID}");
|
||||
|
||||
var dto = new ServerDTO();
|
||||
var server = servers.First(s => s.Url == client.InstanceUrl);
|
||||
dto.Id = client.ID;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue