The Free Software Media System - Server Backend & API
update connect
Luke Pulverenti1d70f5469f68
diff --git a/MediaBrowser.Api/ConnectService.cs b/MediaBrowser.Api/ConnectService.csindex 3a863316ba..5a2c04ab6b 100644--- a/MediaBrowser.Api/ConnectService.cs+++ b/MediaBrowser.Api/ConnectService.cs@@ -70,7 +70,7 @@ namespace MediaBrowser.Apipublic void Delete(DeleteConnectLink request){- var task = _connectManager.RemoveLink(request.Id);+ var task = _connectManager.RemoveConnect(request.Id);Task.WaitAll(task);}diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.csindex 8b53954884..fa6f88cc41 100644--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs@@ -1591,7 +1591,9 @@ namespace MediaBrowser.Api.Playbackstate.InputFileSize = mediaSource.Size;state.InputBitrate = mediaSource.Bitrate;- if (item is Video)+ var video = item as Video;++ if (video != null){state.IsInputVideo = true;@@ -1608,6 +1610,11 @@ namespace MediaBrowser.Api.Playback{state.InputTimestamp = mediaSource.Timestamp.Value;}++ if (video.IsShortcut)+ {+ state.MediaPath = File.ReadAllText(video.Path);+ }}state.RunTimeTicks = mediaSource.RunTimeTicks;diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.csindex 10595d926c..a30ecf7d6a 100644--- a/MediaBrowser.Api/UserService.cs+++ b/MediaBrowser.Api/UserService.cs@@ -290,6 +290,7 @@ namespace MediaBrowser.Api}await _sessionMananger.RevokeUserTokens(user.Id.ToString("N")).ConfigureAwait(false);+await _userManager.DeleteUser(user).ConfigureAwait(false);}diff --git a/MediaBrowser.Controller/Connect/IConnectManager.cs b/MediaBrowser.Controller/Connect/IConnectManager.csindex afb61cb239..8bd0332c01 100644--- a/MediaBrowser.Controller/Connect/IConnectManager.cs+++ b/MediaBrowser.Controller/Connect/IConnectManager.cs@@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Connect/// </summary>/// <param name="userId">The user identifier.</param>/// <returns>Task.</returns>- Task RemoveLink(string userId);+ Task RemoveConnect(string userId);/// <summary>/// Invites the user.diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.csindex e0682c9ee9..2275cbad42 100644--- a/MediaBrowser.Controller/Entities/User.cs+++ b/MediaBrowser.Controller/Entities/User.cs@@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Entitiespublic string ConnectUserName { get; set; }public string ConnectUserId { get; set; }- public UserLinkType ConnectLinkType { get; set; }+ public UserLinkType? ConnectLinkType { get; set; }public string ConnectAccessKey { get; set; }/// <summary>diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.csindex 59649de7f8..dc9769d53f 100644--- a/MediaBrowser.Controller/Entities/Video.cs+++ b/MediaBrowser.Controller/Entities/Video.cs@@ -128,6 +128,7 @@ namespace MediaBrowser.Controller.Entitiespublic bool HasSubtitles { get; set; }public bool IsPlaceHolder { get; set; }+ public bool IsShortcut { get; set; }/// <summary>/// Gets or sets the tags.diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.csindex 3efdbea768..39ec2b85d1 100644--- a/MediaBrowser.Controller/Library/IUserManager.cs+++ b/MediaBrowser.Controller/Library/IUserManager.cs@@ -55,16 +55,16 @@ namespace MediaBrowser.Controller.Library/// <param name="id">The identifier.</param>/// <returns>User.</returns>User GetUserById(string id);-+/// <summary>/// Authenticates a User and returns a result indicating whether or not it succeeded/// </summary>/// <param name="username">The username.</param>- /// <param name="password">The password.</param>+ /// <param name="passwordSha1">The password sha1.</param>/// <param name="remoteEndPoint">The remote end point.</param>/// <returns>Task{System.Boolean}.</returns>/// <exception cref="System.ArgumentNullException">user</exception>- Task<bool> AuthenticateUser(string username, string password, string remoteEndPoint);+ Task<bool> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint);/// <summary>/// Refreshes metadata for each userdiff --git a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.csindex 038d8d48bf..5725c64828 100644--- a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs+++ b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs@@ -38,19 +38,24 @@ namespace MediaBrowser.Controller.Resolvers// http://wiki.xbmc.org/index.php?title=Media_stubsvar isPlaceHolder = EntityResolutionHelper.IsVideoPlaceHolder(args.Path);- if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder)- {- var extension = Path.GetExtension(args.Path);+ var extension = Path.GetExtension(args.Path);++ var isShortcut = string.Equals(extension, ".strm", StringComparison.OrdinalIgnoreCase);+ if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder || isShortcut)+ {var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?VideoType.Iso : VideoType.VideoFile;+ var path = args.Path;+var video = new TVideoType{VideoType = type,Path = args.Path,IsInMixedFolder = true,- IsPlaceHolder = isPlaceHolder+ IsPlaceHolder = isPlaceHolder,+ IsShortcut = isShortcut};if (isPlaceHolder)diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.csindex b88e9d411a..007c634b6e 100644--- a/MediaBrowser.Model/Dto/UserDto.cs+++ b/MediaBrowser.Model/Dto/UserDto.cs@@ -34,7 +34,7 @@ namespace MediaBrowser.Model.Dto/// Gets or sets the type of the connect link./// </summary>/// <value>The type of the connect link.</value>- public UserLinkType ConnectLinkType { get; set; }+ public UserLinkType? ConnectLinkType { get; set; }/// <summary>/// Gets or sets the id.diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.csindex 35e6befbb8..2fdbe67404 100644--- a/MediaBrowser.Providers/Manager/MetadataService.cs+++ b/MediaBrowser.Providers/Manager/MetadataService.cs@@ -146,7 +146,7 @@ namespace MediaBrowser.Providers.ManagerupdateType = updateType | result.UpdateType;refreshResult.AddStatus(result.Status, result.ErrorMessage);refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow);- refreshResult.AddImageProvidersRefreshed(result.Providers);+ refreshResult.AddMetadataProvidersRefreshed(result.Providers);MergeIdentities(itemOfType, id);}@@ -479,7 +479,7 @@ namespace MediaBrowser.Providers.Manager}catch (Exception ex){- refreshResult.Status = ProviderRefreshStatus.CompletedWithErrors;+ refreshResult.Status = ProviderRefreshStatus.Failure;refreshResult.ErrorMessage = ex.Message;Logger.ErrorException("Error in {0}", ex, provider.Name);}diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.csindex ad5fad34ae..cc161803ab 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs@@ -132,7 +132,7 @@ namespace MediaBrowser.Providers.MediaInforeturn _cachedTask;}- if (item.IsPlaceHolder)+ if (item.IsPlaceHolder || item.IsShortcut){return _cachedTask;}diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.csindex 7d0677ae1c..78a294e5f0 100644--- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs@@ -121,7 +121,9 @@ namespace MediaBrowser.Providers.MediaInfopublic bool Supports(IHasImages item){- return item.LocationType == LocationType.FileSystem && item is Video;+ var video = item as Video;++ return item.LocationType == LocationType.FileSystem && video != null && !video.IsPlaceHolder && !video.IsShortcut;}public int Orderdiff --git a/MediaBrowser.Server.Implementations/Connect/ConnectData.cs b/MediaBrowser.Server.Implementations/Connect/ConnectData.csindex e26fdc6076..87d59f3566 100644--- a/MediaBrowser.Server.Implementations/Connect/ConnectData.cs+++ b/MediaBrowser.Server.Implementations/Connect/ConnectData.cs@@ -1,4 +1,5 @@using MediaBrowser.Model.Connect;+using System;using System.Collections.Generic;namespace MediaBrowser.Server.Implementations.Connect@@ -22,6 +23,12 @@ namespace MediaBrowser.Server.Implementations.Connect/// <value>The authorizations.</value>public List<ConnectAuthorization> PendingAuthorizations { get; set; }+ /// <summary>+ /// Gets or sets the last authorizations refresh.+ /// </summary>+ /// <value>The last authorizations refresh.</value>+ public DateTime LastAuthorizationsRefresh { get; set; }+public ConnectData(){PendingAuthorizations = new List<ConnectAuthorization>();diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.csindex 92b769f3b9..40d9119798 100644--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs@@ -168,9 +168,7 @@ namespace MediaBrowser.Server.Implementations.Connectawait CreateServerRegistration(wanApiAddress).ConfigureAwait(false);}- await RefreshAuthorizationsInternal(CancellationToken.None).ConfigureAwait(false);-- await RefreshUserInfosInternal(CancellationToken.None).ConfigureAwait(false);+ await RefreshAuthorizationsInternal(true, CancellationToken.None).ConfigureAwait(false);}catch (Exception ex){@@ -335,7 +333,7 @@ namespace MediaBrowser.Server.Implementations.Connectif (!string.IsNullOrWhiteSpace(user.ConnectUserId)){- await RemoveLink(user, connectUser.Id).ConfigureAwait(false);+ await RemoveConnect(user, connectUser.Id).ConfigureAwait(false);}var url = GetConnectUrl("ServerAuthorizations");@@ -377,15 +375,15 @@ namespace MediaBrowser.Server.Implementations.Connectawait user.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);- user.Configuration.SyncConnectImage = user.ConnectLinkType == UserLinkType.Guest;- user.Configuration.SyncConnectName = user.ConnectLinkType == UserLinkType.Guest;+ user.Configuration.SyncConnectImage = false;+ user.Configuration.SyncConnectName = false;_userManager.UpdateConfiguration(user, user.Configuration);- await RefreshAuthorizationsInternal(CancellationToken.None).ConfigureAwait(false);+ await RefreshAuthorizationsInternal(false, CancellationToken.None).ConfigureAwait(false);return result;}-+public async Task<UserLinkResult> InviteUser(string sendingUserId, string connectUsername){await _operationLock.WaitAsync().ConfigureAwait(false);@@ -452,19 +450,19 @@ namespace MediaBrowser.Server.Implementations.Connectresult.IsPending = string.Equals(response.AcceptStatus, "waiting", StringComparison.OrdinalIgnoreCase);}- await RefreshAuthorizationsInternal(CancellationToken.None).ConfigureAwait(false);+ await RefreshAuthorizationsInternal(false, CancellationToken.None).ConfigureAwait(false);return result;}-- public Task RemoveLink(string userId)++ public Task RemoveConnect(string userId){var user = GetUser(userId);- return RemoveLink(user, user.ConnectUserId);+ return RemoveConnect(user, user.ConnectUserId);}- private async Task RemoveLink(User user, string connectUserId)+ private async Task RemoveConnect(User user, string connectUserId){if (!string.IsNullOrWhiteSpace(connectUserId)){@@ -474,7 +472,7 @@ namespace MediaBrowser.Server.Implementations.Connectuser.ConnectAccessKey = null;user.ConnectUserName = null;user.ConnectUserId = null;- user.ConnectLinkType = UserLinkType.LinkedUser;+ user.ConnectLinkType = null;await user.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);}@@ -513,7 +511,8 @@ namespace MediaBrowser.Server.Implementations.ConnectEmail = response.Email,Id = response.Id,Name = response.Name,- IsActive = response.IsActive+ IsActive = response.IsActive,+ ImageUrl = response.ImageUrl};}}@@ -529,7 +528,7 @@ namespace MediaBrowser.Server.Implementations.Connecttry{- await RefreshAuthorizationsInternal(cancellationToken).ConfigureAwait(false);+ await RefreshAuthorizationsInternal(true, cancellationToken).ConfigureAwait(false);}finally{@@ -537,7 +536,7 @@ namespace MediaBrowser.Server.Implementations.Connect}}- private async Task RefreshAuthorizationsInternal(CancellationToken cancellationToken)+ private async Task RefreshAuthorizationsInternal(bool refreshImages, CancellationToken cancellationToken){var url = GetConnectUrl("ServerAuthorizations");@@ -557,7 +556,7 @@ namespace MediaBrowser.Server.Implementations.Connect{var list = _json.DeserializeFromStream<List<ServerUserAuthorizationResponse>>(stream);- await RefreshAuthorizations(list).ConfigureAwait(false);+ await RefreshAuthorizations(list, refreshImages).ConfigureAwait(false);}}catch (Exception ex)@@ -566,7 +565,8 @@ namespace MediaBrowser.Server.Implementations.Connect}}- private async Task RefreshAuthorizations(List<ServerUserAuthorizationResponse> list)+ private readonly SemaphoreSlim _connectImageSemaphore = new SemaphoreSlim(5, 5);+ private async Task RefreshAuthorizations(List<ServerUserAuthorizationResponse> list, bool refreshImages){var users = _userManager.Users.ToList();@@ -583,13 +583,14 @@ namespace MediaBrowser.Server.Implementations.Connectuser.ConnectUserId = null;user.ConnectAccessKey = null;user.ConnectUserName = null;+ user.ConnectLinkType = null;await _userManager.UpdateUser(user).ConfigureAwait(false);- if (user.ConnectLinkType == UserLinkType.Guest)+ if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest){_logger.Debug("Deleting guest user {0}", user.Name);- //await _userManager.DeleteUser(user).ConfigureAwait(false);+ await _userManager.DeleteUser(user).ConfigureAwait(false);}}else@@ -611,7 +612,6 @@ namespace MediaBrowser.Server.Implementations.Connectvar pending = new List<ConnectAuthorization>();- // TODO: Handle newly added guests that we don't know aboutforeach (var connectEntry in list){if (string.Equals(connectEntry.UserType, "guest", StringComparison.OrdinalIgnoreCase))@@ -623,18 +623,29 @@ namespace MediaBrowser.Server.Implementations.Connectif (user == null){// Add user- //user.Configuration.SyncConnectImage = user.ConnectLinkType == UserLinkType.Guest;- //user.Configuration.SyncConnectName = user.ConnectLinkType == UserLinkType.Guest;+ user = await _userManager.CreateUser(connectEntry.UserName).ConfigureAwait(false);++ user.ConnectUserName = connectEntry.UserName;+ user.ConnectUserId = connectEntry.UserId;+ user.ConnectLinkType = UserLinkType.Guest;+ user.ConnectAccessKey = connectEntry.AccessToken;++ await _userManager.UpdateUser(user).ConfigureAwait(false);++ user.Configuration.SyncConnectImage = true;+ user.Configuration.SyncConnectName = true;++ _userManager.UpdateConfiguration(user, user.Configuration);}}else if (string.Equals(connectEntry.AcceptStatus, "waiting", StringComparison.OrdinalIgnoreCase)){pending.Add(new ConnectAuthorization{- ConnectUserId = connectEntry.UserId,- ImageUrl = connectEntry.UserImageUrl,- UserName = connectEntry.UserName,- Id = connectEntry.Id+ ConnectUserId = connectEntry.UserId,+ ImageUrl = connectEntry.UserImageUrl,+ UserName = connectEntry.UserName,+ Id = connectEntry.Id});}}@@ -642,54 +653,40 @@ namespace MediaBrowser.Server.Implementations.Connect_data.PendingAuthorizations = pending;CacheData();- }- public async Task RefreshUserInfos(CancellationToken cancellationToken)- {- await _operationLock.WaitAsync(cancellationToken).ConfigureAwait(false);-- try- {- await RefreshUserInfosInternal(cancellationToken).ConfigureAwait(false);- }- finally- {- _operationLock.Release();- }+ await RefreshGuestNames(list, refreshImages).ConfigureAwait(false);}- private readonly SemaphoreSlim _connectImageSemaphore = new SemaphoreSlim(5, 5);-- private async Task RefreshUserInfosInternal(CancellationToken cancellationToken)+ private async Task RefreshGuestNames(List<ServerUserAuthorizationResponse> list, bool refreshImages){var users = _userManager.Users.Where(i => !string.IsNullOrEmpty(i.ConnectUserId) &&(i.Configuration.SyncConnectImage || i.Configuration.SyncConnectName))- .ToList();+ .ToList();foreach (var user in users){- cancellationToken.ThrowIfCancellationRequested();+ var authorization = list.FirstOrDefault(i => string.Equals(i.UserId, user.ConnectUserId, StringComparison.Ordinal));- var connectUser = await GetConnectUser(new ConnectUserQuery+ if (authorization == null){- Id = user.ConnectUserId-- }, cancellationToken).ConfigureAwait(false);+ _logger.Warn("Unable to find connect authorization record for user {0}", user.Name);+ continue;+ }if (user.Configuration.SyncConnectName){- var changed = !string.Equals(connectUser.Name, user.Name, StringComparison.OrdinalIgnoreCase);+ var changed = !string.Equals(authorization.UserName, user.Name, StringComparison.OrdinalIgnoreCase);if (changed){- await user.Rename(connectUser.Name).ConfigureAwait(false);+ await user.Rename(authorization.UserName).ConfigureAwait(false);}}if (user.Configuration.SyncConnectImage){- var imageUrl = connectUser.ImageUrl;+ var imageUrl = authorization.UserImageUrl;if (!string.IsNullOrWhiteSpace(imageUrl)){@@ -699,12 +696,11 @@ namespace MediaBrowser.Server.Implementations.Connect{changed = true;}- else+ else if (refreshImages){using (var response = await _httpClient.SendAsync(new HttpRequestOptions{Url = imageUrl,- CancellationToken = cancellationToken,BufferContent = false}, "HEAD").ConfigureAwait(false))@@ -720,13 +716,13 @@ namespace MediaBrowser.Server.Implementations.Connectif (changed){- await _providerManager.SaveImage(user, imageUrl, _connectImageSemaphore, ImageType.Primary, null, cancellationToken).ConfigureAwait(false);-+ await _providerManager.SaveImage(user, imageUrl, _connectImageSemaphore, ImageType.Primary, null, CancellationToken.None).ConfigureAwait(false);+await user.RefreshMetadata(new MetadataRefreshOptions{ForceSave = true,- }, cancellationToken).ConfigureAwait(false);+ }, CancellationToken.None).ConfigureAwait(false);}}}@@ -735,6 +731,25 @@ namespace MediaBrowser.Server.Implementations.Connectpublic async Task<List<ConnectAuthorization>> GetPendingGuests(){+ var time = DateTime.UtcNow - _data.LastAuthorizationsRefresh;++ if (time.TotalMinutes >= 5)+ {+ await _operationLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);++ try+ {+ await RefreshAuthorizationsInternal(false, CancellationToken.None).ConfigureAwait(false);++ _data.LastAuthorizationsRefresh = DateTime.UtcNow;+ CacheData();+ }+ finally+ {+ _operationLock.Release();+ }+ }+return _data.PendingAuthorizations.ToList();}@@ -760,7 +775,7 @@ namespace MediaBrowser.Server.Implementations.Connectawait CancelAuthorizationByConnectUserId(connectUserId).ConfigureAwait(false);- await RefreshAuthorizationsInternal(CancellationToken.None).ConfigureAwait(false);+ await RefreshAuthorizationsInternal(false, CancellationToken.None).ConfigureAwait(false);}private async Task CancelAuthorizationByConnectUserId(string connectUserId)diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.csindex 16a1dc516b..e76bc4f80f 100644--- a/MediaBrowser.Server.Implementations/Library/UserManager.cs+++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs@@ -2,6 +2,7 @@using MediaBrowser.Common.Extensions;using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;+using MediaBrowser.Controller.Connect;using MediaBrowser.Controller.Drawing;using MediaBrowser.Controller.Dto;using MediaBrowser.Controller.Entities;@@ -61,6 +62,7 @@ namespace MediaBrowser.Server.Implementations.Libraryprivate readonly Func<IImageProcessor> _imageProcessorFactory;private readonly Func<IDtoService> _dtoServiceFactory;+ private readonly Func<IConnectManager> _connectFactory;/// <summary>/// Initializes a new instance of the <see cref="UserManager" /> class.@@ -68,7 +70,7 @@ namespace MediaBrowser.Server.Implementations.Library/// <param name="logger">The logger.</param>/// <param name="configurationManager">The configuration manager.</param>/// <param name="userRepository">The user repository.</param>- public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory)+ public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, Func<IConnectManager> connectFactory){_logger = logger;UserRepository = userRepository;@@ -76,6 +78,7 @@ namespace MediaBrowser.Server.Implementations.Library_networkManager = networkManager;_imageProcessorFactory = imageProcessorFactory;_dtoServiceFactory = dtoServiceFactory;+ _connectFactory = connectFactory;ConfigurationManager = configurationManager;Users = new List<User>();}@@ -143,7 +146,7 @@ namespace MediaBrowser.Server.Implementations.LibraryUsers = await LoadUsers().ConfigureAwait(false);}- public async Task<bool> AuthenticateUser(string username, string password, string remoteEndPoint)+ public async Task<bool> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint){if (string.IsNullOrWhiteSpace(username)){@@ -157,11 +160,11 @@ namespace MediaBrowser.Server.Implementations.Librarythrow new AuthenticationException(string.Format("The {0} account is currently disabled. Please consult with your administrator.", user.Name));}- var success = string.Equals(GetPasswordHash(user), password.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);+ var success = string.Equals(GetPasswordHash(user), passwordSha1.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);if (!success && _networkManager.IsInLocalNetwork(remoteEndPoint) && user.Configuration.EnableLocalPassword){- success = string.Equals(GetLocalPasswordHash(user), password.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);+ success = string.Equals(GetLocalPasswordHash(user), passwordSha1.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);}// Update LastActivityDate and LastLoginDate, then save@@ -433,6 +436,11 @@ namespace MediaBrowser.Server.Implementations.Librarythrow new ArgumentNullException("user");}+ if (user.ConnectLinkType.HasValue)+ {+ await _connectFactory().RemoveConnect(user.Id.ToString("N")).ConfigureAwait(false);+ }+var allUsers = Users.ToList();if (allUsers.FirstOrDefault(u => u.Id == user.Id) == null)@@ -514,10 +522,12 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>User.</returns>private User InstantiateNewUser(string name){+ var idSalt = ("MBUser" + name);+return new User{Name = name,- Id = ("MBUser" + name).GetMD5(),+ Id = idSalt.GetMD5(),DateCreated = DateTime.UtcNow,DateModified = DateTime.UtcNow,UsesIdForConfigurationPath = truediff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.jsonindex c1e9ff5cd6..ec275c8dc1 100644--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json@@ -606,7 +606,7 @@"TabDevices": "Devices","DeviceLastUsedByUserName": "Last used by {0}","HeaderDeleteDevice": "Delete Device",- "DeleteDeviceConfirmation": "Are you sure you with to delete this device? It will reappear the next time a user signs in with it.",+ "DeleteDeviceConfirmation": "Are you sure you wish to delete this device? It will reappear the next time a user signs in with it.","LabelEnableCameraUploadFor": "Enable camera upload for:","HeaderSelectUploadPath": "Select Upload Path","LabelEnableCameraUploadForHelp": "Uploads will occur automatically in the background when signed into Media Browser."diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.jsonindex e576180c47..c104d27388 100644--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json@@ -1229,7 +1229,10 @@"LabelCustomDeviceDisplayName": "Display name:","LabelCustomDeviceDisplayNameHelp": "Supply a custom display name or leave empty to use the name reported by the device.","HeaderInviteUser": "Invite User",- "LabelConnectInviteHelp": "This is the username or email used to sign in to the Media Browser website.",+ "LabelConnectInviteUserHelp": "This is the username or email that your friend uses to sign in to the Media Browser website.","HeaderInviteUserHelp": "Sharing your media with friends is easier than ever before with Media Browser Connect.",- "ButtonSendInvitation": "Send Invitation"+ "ButtonSendInvitation": "Send Invitation",+ "HeaderGuests": "Guests",+ "HeaderLocalUsers": "Local Users",+ "HeaderPendingInvitations": "Pending Invitations"}diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.csindex 2c9319e39e..2c873f9266 100644--- a/MediaBrowser.ServerApplication/ApplicationHost.cs+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs@@ -412,7 +412,7 @@ namespace MediaBrowser.ServerApplication//SyncRepository = await GetSyncRepository().ConfigureAwait(false);//RegisterSingleInstance(SyncRepository);- UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService);+ UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager);RegisterSingleInstance(UserManager);LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager);