From 10cfb3c43c06e39b61929fea1d398801e555274b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 14 Feb 2015 14:36:40 -0500 Subject: [PATCH] sync updates --- MediaBrowser.Api/UserService.cs | 4 +-- .../Networking/BaseNetworkManager.cs | 29 ++++++++++--------- .../Library/IUserManager.cs | 3 +- MediaBrowser.Model/Dto/UserDto.cs | 6 ++++ .../Library/UserManager.cs | 6 ++-- .../Library/UserViewManager.cs | 3 +- .../FFMpeg/FFMpegDownloadInfo.cs | 11 +------ SharedVersion.cs | 4 +-- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs index c34924f3cc..c17f333481 100644 --- a/MediaBrowser.Api/UserService.cs +++ b/MediaBrowser.Api/UserService.cs @@ -365,9 +365,7 @@ namespace MediaBrowser.Api throw new ResourceNotFoundException("User not found"); } - var auth = AuthorizationContext.GetAuthorizationInfo(Request); - - var result = _userManager.GetOfflineUserDto(user, auth.DeviceId); + var result = _userManager.GetOfflineUserDto(user); return ToOptimizedResult(result); } diff --git a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs index 6deda12932..1762ed5754 100644 --- a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs +++ b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs @@ -169,24 +169,27 @@ namespace MediaBrowser.Common.Implementations.Networking IPAddress address; if (resolveHost && !IPAddress.TryParse(endpoint, out address)) { - var host = new Uri(endpoint).DnsSafeHost; - - Logger.Debug("Resolving host {0}", host); - - try + Uri uri; + if (Uri.TryCreate(endpoint, UriKind.RelativeOrAbsolute, out uri)) { - address = GetIpAddresses(host).FirstOrDefault(); + var host = uri.DnsSafeHost; + Logger.Debug("Resolving host {0}", host); - if (address != null) + try { - Logger.Debug("{0} resolved to {1}", host, address); + address = GetIpAddresses(host).FirstOrDefault(); - return IsInLocalNetworkInternal(address.ToString(), false); + if (address != null) + { + Logger.Debug("{0} resolved to {1}", host, address); + + return IsInLocalNetworkInternal(address.ToString(), false); + } + } + catch (Exception ex) + { + Logger.ErrorException("Error resovling hostname {0}", ex, host); } - } - catch (Exception ex) - { - Logger.ErrorException("Error resovling hostname {0}", ex, host); } } diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index 97a3cced9a..8119e5afbb 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -121,9 +121,8 @@ namespace MediaBrowser.Controller.Library /// Gets the offline user dto. /// /// The user. - /// The device identifier. /// UserDto. - UserDto GetOfflineUserDto(User user, string deviceId); + UserDto GetOfflineUserDto(User user); /// /// Resets the easy password. diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.cs index c66b34150d..fc5d2f134a 100644 --- a/MediaBrowser.Model/Dto/UserDto.cs +++ b/MediaBrowser.Model/Dto/UserDto.cs @@ -61,6 +61,12 @@ namespace MediaBrowser.Model.Dto /// /// The offline password. public string OfflinePassword { get; set; } + + /// + /// Gets or sets the offline password salt. + /// + /// The offline password salt. + public string OfflinePasswordSalt { get; set; } /// /// Gets or sets the primary image tag. diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 8858abc102..59fecc857c 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -402,15 +402,17 @@ namespace MediaBrowser.Server.Implementations.Library return dto; } - public UserDto GetOfflineUserDto(User user, string deviceId) + public UserDto GetOfflineUserDto(User user) { var dto = GetUserDto(user); var offlinePasswordHash = GetLocalPasswordHash(user); dto.HasPassword = !IsPasswordEmpty(offlinePasswordHash); + dto.OfflinePasswordSalt = Guid.NewGuid().ToString("N"); + // Hash the pin with the device Id to create a unique result for this device - dto.OfflinePassword = GetSha1String((offlinePasswordHash + deviceId).ToLower()); + dto.OfflinePassword = GetSha1String((offlinePasswordHash + dto.OfflinePasswordSalt).ToLower()); dto.ServerName = _appHost.FriendlyName; diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs index 2ec9e8a4fb..9ef5a856e9 100644 --- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs @@ -86,7 +86,8 @@ namespace MediaBrowser.Server.Implementations.Library list.Add(await GetUserView(CollectionType.Movies, string.Empty, cancellationToken).ConfigureAwait(false)); } - if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase))) + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase)) + || _config.Configuration.EnableLegacyCollections) { list.Add(await GetUserView(CollectionType.Games, string.Empty, cancellationToken).ConfigureAwait(false)); } diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs index 2f01463104..cabb8dc839 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs @@ -33,16 +33,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case OperatingSystem.Linux: info.ArchiveType = "7z"; - - switch (environment.SystemArchitecture) - { - case Architecture.X86_X64: - info.Version = "20150124"; - break; - case Architecture.X86: - info.Version = "20150124"; - break; - } + info.Version = "20150124"; break; case OperatingSystem.Osx: diff --git a/SharedVersion.cs b/SharedVersion.cs index 6bd1f59679..97fa02a8ac 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; -//[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5518.4")] +[assembly: AssemblyVersion("3.0.*")] +//[assembly: AssemblyVersion("3.0.5518.4")]