Fixed an issue that potentially causes as issue when siging into plex #865

pull/1529/head
tidusjar 7 years ago
parent a269d16bc4
commit 80bf8f6014

@ -50,17 +50,23 @@ namespace Ombi.Controllers.External
{ {
var server = await PlexApi.GetServer(result.user.authentication_token); var server = await PlexApi.GetServer(result.user.authentication_token);
var servers = server.Server.FirstOrDefault(); var servers = server.Server.FirstOrDefault();
if (servers == null)
{
_log.LogWarning("Looks like we can't find any Plex Servers");
}
settings.Enable = true; settings.Enable = true;
settings.Servers = new List<PlexServers> { new PlexServers{ settings.Servers = new List<PlexServers> {
PlexAuthToken = result.user.authentication_token, new PlexServers
Id = new Random().Next(), {
Ip = servers.LocalAddresses.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(), PlexAuthToken = result.user.authentication_token,
MachineIdentifier = servers.MachineIdentifier, Id = new Random().Next(),
Port = int.Parse(servers.Port), Ip = servers?.LocalAddresses?.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries)?.FirstOrDefault() ?? string.Empty,
Ssl = servers.Scheme != "http", MachineIdentifier = servers?.MachineIdentifier ?? string.Empty,
Name = $"Server 1", Port = int.Parse(servers?.Port ?? "0"),
} Ssl = (servers?.Scheme ?? "http") != "http",
Name = "Server 1",
}
}; };
//var serverNumber = 0; //var serverNumber = 0;
//foreach (var s in servers) //foreach (var s in servers)

Loading…
Cancel
Save