diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-04-16 15:28:00 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-04-16 15:28:00 -0400 |
| commit | f3f3da0d8be8b7e6c956982b525283ae4b86876e (patch) | |
| tree | b49edf8c7291886f46569437349e1075b30c66f5 /MediaBrowser.Server.Implementations/Connect | |
| parent | b0839ffd2c10cb7a8ec0837f897db61ddd3a7c01 (diff) | |
| parent | 18dbdb194b6db75c1acb5457e9797d8b37150c07 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
Diffstat (limited to 'MediaBrowser.Server.Implementations/Connect')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Connect/ConnectManager.cs | 38 |
2 files changed, 31 insertions, 9 deletions
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index 1b951374e..ea12e332d 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -10,10 +10,8 @@ using System.IO; using System.Net; using System.Net.Sockets; using System.Text; -using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Threading; namespace MediaBrowser.Server.Implementations.Connect diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index ac0d2c569..f3d545492 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -24,6 +24,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Common.Extensions; namespace MediaBrowser.Server.Implementations.Connect { @@ -62,6 +63,17 @@ namespace MediaBrowser.Server.Implementations.Connect { var address = _config.Configuration.WanDdns; + if (!string.IsNullOrWhiteSpace(address)) + { + try + { + address = new Uri(address).Host; + } + catch + { + } + } + if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null) { if (DiscoveredWanIpAddress.AddressFamily == AddressFamily.InterNetworkV6) @@ -237,8 +249,8 @@ namespace MediaBrowser.Server.Implementations.Connect var postData = new Dictionary<string, string> { - {"name", _appHost.FriendlyName}, - {"url", wanApiAddress}, + {"name", _appHost.FriendlyName}, + {"url", wanApiAddress}, {"systemId", _appHost.SystemId} }; @@ -544,9 +556,22 @@ namespace MediaBrowser.Server.Implementations.Connect } catch (HttpException ex) { - if (!ex.StatusCode.HasValue || - ex.StatusCode.Value != HttpStatusCode.NotFound || - !Validator.EmailIsValid(connectUsername)) + if (!ex.StatusCode.HasValue) + { + throw; + } + + // If they entered a username, then whatever the error is just throw it, for example, user not found + if (!Validator.EmailIsValid(connectUsername)) + { + if (ex.StatusCode.Value == HttpStatusCode.NotFound) + { + throw new ResourceNotFoundException(); + } + throw; + } + + if (ex.StatusCode.Value != HttpStatusCode.NotFound) { throw; } @@ -891,8 +916,7 @@ namespace MediaBrowser.Server.Implementations.Connect private async Task RefreshGuestNames(List<ServerUserAuthorizationResponse> list, bool refreshImages) { var users = _userManager.Users - .Where(i => !string.IsNullOrEmpty(i.ConnectUserId) && - (i.ConnectLinkType.HasValue && i.ConnectLinkType.Value == UserLinkType.Guest)) + .Where(i => !string.IsNullOrEmpty(i.ConnectUserId) && i.ConnectLinkType.HasValue && i.ConnectLinkType.Value == UserLinkType.Guest) .ToList(); foreach (var user in users) |
