The Free Software Media System - Server Backend & API
update image magick sharp
Luke Pulverenti0d8636d859ce
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.csindex 8119e5afbb..a167cdbed0 100644--- a/MediaBrowser.Controller/Library/IUserManager.cs+++ b/MediaBrowser.Controller/Library/IUserManager.cs@@ -34,6 +34,7 @@ namespace MediaBrowser.Controller.Libraryevent EventHandler<GenericEventArgs<User>> UserCreated;event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;event EventHandler<GenericEventArgs<User>> UserPasswordChanged;+ event EventHandler<GenericEventArgs<User>> UserLockedOut;/// <summary>/// Gets a User by Iddiff --git a/MediaBrowser.Model/Notifications/NotificationType.cs b/MediaBrowser.Model/Notifications/NotificationType.csindex 269e27a4fc..f5e3624f00 100644--- a/MediaBrowser.Model/Notifications/NotificationType.cs+++ b/MediaBrowser.Model/Notifications/NotificationType.cs@@ -19,6 +19,7 @@ namespace MediaBrowser.Model.NotificationsNewLibraryContentMultiple,ServerRestartRequired,TaskFailed,- CameraImageUploaded+ CameraImageUploaded,+ UserLockedOut}}\ No newline at end of filediff --git a/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs b/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.csindex 2fe5d8f742..566f4c5f40 100644--- a/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs+++ b/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs@@ -1,5 +1,6 @@using MediaBrowser.Common.Configuration;using MediaBrowser.Controller.Entities;+using System;using System.IO;using System.Linq;@@ -14,6 +15,11 @@ namespace MediaBrowser.Server.Implementations.Devicespublic override bool IsVisible(User user){+ if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))+ {+ return false;+ }+return GetChildren(user, true).Any() &&base.IsVisible(user);}diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.csindex c484a60dba..180faa6bbe 100644--- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs+++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs@@ -350,9 +350,9 @@ namespace MediaBrowser.Server.Implementations.Drawing}/// <summary>- /// Increment this when indicator drawings change+ /// Increment this when there's a change requiring caches to be invalidated/// </summary>- private const string IndicatorVersion = "2";+ private const string Version = "3";/// <summary>/// Gets the cache file path based on a set of parameters@@ -371,29 +371,19 @@ namespace MediaBrowser.Server.Implementations.Drawingfilename += "f=" + format;- var hasIndicator = false;-if (addPlayedIndicator){filename += "pl=true";- hasIndicator = true;}if (percentPlayed > 0){filename += "p=" + percentPlayed;- hasIndicator = true;}if (unwatchedCount.HasValue){filename += "p=" + unwatchedCount.Value;- hasIndicator = true;- }-- if (hasIndicator)- {- filename += "iv=" + IndicatorVersion;}if (!string.IsNullOrEmpty(backgroundColor))@@ -401,6 +391,8 @@ namespace MediaBrowser.Server.Implementations.Drawingfilename += "b=" + backgroundColor;}+ filename += "v=" + Version;+return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower());}@@ -671,30 +663,6 @@ namespace MediaBrowser.Server.Implementations.Drawingreturn enhancedImagePath;}- private ImageFormat GetFormat(string path)- {- var extension = Path.GetExtension(path);-- if (string.Equals(extension, ".png", StringComparison.OrdinalIgnoreCase))- {- return ImageFormat.Png;- }- if (string.Equals(extension, ".gif", StringComparison.OrdinalIgnoreCase))- {- return ImageFormat.Gif;- }- if (string.Equals(extension, ".webp", StringComparison.OrdinalIgnoreCase))- {- return ImageFormat.Webp;- }- if (string.Equals(extension, ".bmp", StringComparison.OrdinalIgnoreCase))- {- return ImageFormat.Bmp;- }-- return ImageFormat.Jpg;- }-/// <summary>/// Executes the image enhancers./// </summary>diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.csindex 0b06613219..28883e9a21 100644--- a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs+++ b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs@@ -86,6 +86,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints_userManager.UserPasswordChanged += _userManager_UserPasswordChanged;_userManager.UserDeleted += _userManager_UserDeleted;_userManager.UserConfigurationUpdated += _userManager_UserConfigurationUpdated;+ _userManager.UserLockedOut += _userManager_UserLockedOut;//_config.ConfigurationUpdated += _config_ConfigurationUpdated;//_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;@@ -95,6 +96,16 @@ namespace MediaBrowser.Server.Implementations.EntryPoints_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;}+ void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)+ {+ CreateLogEntry(new ActivityLogEntry+ {+ Name = string.Format(_localization.GetLocalizedString("UserLockedOutWithName"), e.Argument.Name),+ Type = "UserLockedOut",+ UserId = e.Argument.Id.ToString("N")+ });+ }+void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e){CreateLogEntry(new ActivityLogEntry@@ -482,6 +493,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints_userManager.UserPasswordChanged -= _userManager_UserPasswordChanged;_userManager.UserDeleted -= _userManager_UserDeleted;_userManager.UserConfigurationUpdated -= _userManager_UserConfigurationUpdated;+ _userManager.UserLockedOut -= _userManager_UserLockedOut;_config.ConfigurationUpdated -= _config_ConfigurationUpdated;_config.NamedConfigurationUpdated -= _config_NamedConfigurationUpdated;diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.csindex 37bca4ddbc..f6a35973b7 100644--- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs+++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs@@ -78,6 +78,22 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications_appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged;_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;_deviceManager.CameraImageUploaded +=_deviceManager_CameraImageUploaded;++ _userManager.UserLockedOut += _userManager_UserLockedOut;+ }++ async void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)+ {+ var type = NotificationType.UserLockedOut.ToString();++ var notification = new NotificationRequest+ {+ NotificationType = type+ };++ notification.Variables["UserName"] = e.Argument.Name;++ await SendNotification(notification).ConfigureAwait(false);}async void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)@@ -235,7 +251,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notificationsreturn;}-var notification = new NotificationRequest{NotificationType = type@@ -471,6 +486,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications_appHost.ApplicationUpdated -= _appHost_ApplicationUpdated;_deviceManager.CameraImageUploaded -= _deviceManager_CameraImageUploaded;+ _userManager.UserLockedOut -= _userManager_UserLockedOut;}private void DisposeLibraryUpdateTimer()diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.csindex 846bad214e..00c6744368 100644--- a/MediaBrowser.Server.Implementations/Library/UserManager.cs+++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs@@ -97,6 +97,7 @@ namespace MediaBrowser.Server.Implementations.Library/// </summary>public event EventHandler<GenericEventArgs<User>> UserUpdated;public event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;+ public event EventHandler<GenericEventArgs<User>> UserLockedOut;/// <summary>/// Called when [user updated].@@ -281,13 +282,25 @@ namespace MediaBrowser.Server.Implementations.Library3 :5;+ var fireLockout = false;+if (newValue >= maxCount){_logger.Debug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture));user.Policy.IsDisabled = true;++ fireLockout = true;}await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false);++ if (fireLockout)+ {+ if (UserLockedOut != null)+ {+ EventHelper.FireEventIfNotNull(UserLockedOut, this, new GenericEventArgs<User>(user), _logger);+ }+ }}}diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.jsonindex 5f221a7bea..2f593efcdc 100644--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json@@ -48,8 +48,10 @@"LabelDashboardSourcePathHelp": "If running the server from source, specify the path to the dashboard-ui folder. All web client files will be served from this location.","ButtonConvertMedia": "Convert media","ButtonOrganize": "Organize",+ "LabelPinCode": "Pin code:","ButtonOk": "Ok","ButtonCancel": "Cancel",+ "ButtonExit": "Exit","ButtonNew": "New","HeaderTV": "TV","HeaderAudio": "Audio",@@ -57,6 +59,12 @@"HeaderPaths": "Paths","CategorySync": "Sync","HeaderEasyPinCode": "Easy Pin Code",+ "HeaderGrownupsOnly": "Grown-ups Only!",+ "DividerOr": "-- or --",+ "HeaderToAccessPleaseEnterEasyPinCode": "To access, please enter your easy pin code",+ "KidsModeAdultInstruction": "Click the lock icon in the bottom right to configure or leave kids mode. Your pin code will be required.",+ "ButtonConfigurePinCode": "Configure pin code",+ "HeaderAdultsReadHere": "Adults Read Here!","RegisterWithPayPal": "Register with PayPal","HeaderSyncRequiresSupporterMembership": "Sync Requires a Supporter Membership","HeaderEnjoyDayTrial": "Enjoy a 14 Day Free Trial",@@ -670,6 +678,7 @@"NotificationOptionNewLibraryContent": "New content added","NotificationOptionNewLibraryContentMultiple": "New content added (multiple)","NotificationOptionCameraImageUploaded": "Camera image uploaded",+ "NotificationOptionUserLockedOut": "User locked out","SendNotificationHelp": "By default, notifications are delivered to the dashboard inbox. Browse the plugin catalog to install additional notification options.","NotificationOptionServerRestartRequired": "Server restart required","LabelNotificationEnabled": "Enable this notification",@@ -1061,6 +1070,7 @@"OptionBox": "Box","OptionBoxRear": "Box rear","OptionDisc": "Disc",+ "OptionIcon": "Icon","OptionLogo": "Logo","OptionMenu": "Menu","OptionScreenshot": "Screenshot",@@ -1105,6 +1115,7 @@"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}","LabelRunningTimeValue": "Running time: {0}","LabelIpAddressValue": "Ip address: {0}",+ "UserLockedOutWithName": "User {0} has been locked out","UserConfigurationUpdatedWithName": "User configuration has been updated for {0}","UserCreatedWithName": "User {0} has been created","UserPasswordChangedWithName": "Password has been changed for user {0}",diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csprojindex fdd53b9072..7833058f44 100644--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj@@ -47,7 +47,7 @@<ItemGroup><Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"><SpecificVersion>False</SpecificVersion>- <HintPath>..\packages\ImageMagickSharp.1.0.0.4\lib\net45\ImageMagickSharp.dll</HintPath>+ <HintPath>..\packages\ImageMagickSharp.1.0.0.5\lib\net45\ImageMagickSharp.dll</HintPath></Reference><Reference Include="MediaBrowser.Naming, Version=1.0.5509.27636, Culture=neutral, processorArchitecture=MSIL"><SpecificVersion>False</SpecificVersion>diff --git a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.csindex d8acbe06c8..a33fe21477 100644--- a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs+++ b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs@@ -143,6 +143,13 @@ namespace MediaBrowser.Server.Implementations.NotificationsType = NotificationType.CameraImageUploaded.ToString(),DefaultTitle = "A new camera image has been uploaded from {DeviceName}.",Variables = new List<string>{"DeviceName"}+ },++ new NotificationTypeInfo+ {+ Type = NotificationType.UserLockedOut.ToString(),+ DefaultTitle = "{UserName} has been locked out.",+ Variables = new List<string>{"UserName"}}};@@ -185,6 +192,10 @@ namespace MediaBrowser.Server.Implementations.Notifications{note.Category = _localization.GetLocalizedString("CategorySync");}+ else if (note.Type.IndexOf("UserLockedOut", StringComparison.OrdinalIgnoreCase) != -1)+ {+ note.Category = _localization.GetLocalizedString("CategoryUser");+ }else{note.Category = _localization.GetLocalizedString("CategorySystem");diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.csindex d02ef9d270..3ffbf5cb90 100644--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs@@ -399,7 +399,7 @@ namespace MediaBrowser.Server.Implementations.SessionClient = clientType,DeviceId = deviceId,ApplicationVersion = appVersion,- Id = Guid.NewGuid().ToString("N")+ Id = key.GetMD5().ToString("N")};sessionInfo.DeviceName = deviceName;@@ -798,6 +798,19 @@ namespace MediaBrowser.Server.Implementations.Sessionreturn session;}+ private SessionInfo GetSessionToRemoteControl(string sessionId)+ {+ // Accept either device id or session id+ var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId));++ if (session == null)+ {+ throw new ResourceNotFoundException(string.Format("Session {0} not found.", sessionId));+ }++ return session;+ }+public Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken){var generalCommand = new GeneralCommand@@ -818,7 +831,7 @@ namespace MediaBrowser.Server.Implementations.Sessionpublic Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken){- var session = GetSession(sessionId);+ var session = GetSessionToRemoteControl(sessionId);var controllingSession = GetSession(controllingSessionId);AssertCanControl(session, controllingSession);@@ -828,7 +841,7 @@ namespace MediaBrowser.Server.Implementations.Sessionpublic Task SendPlayCommand(string controllingSessionId, string sessionId, PlayRequest command, CancellationToken cancellationToken){- var session = GetSession(sessionId);+ var session = GetSessionToRemoteControl(sessionId);var user = session.UserId.HasValue ? _userManager.GetUserById(session.UserId.Value) : null;@@ -955,7 +968,7 @@ namespace MediaBrowser.Server.Implementations.Sessionpublic Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken){- var session = GetSession(sessionId);+ var session = GetSessionToRemoteControl(sessionId);var controllingSession = GetSession(controllingSessionId);AssertCanControl(session, controllingSession);diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.configindex c97792fe00..b83bee17d6 100644--- a/MediaBrowser.Server.Implementations/packages.config+++ b/MediaBrowser.Server.Implementations/packages.config@@ -1,6 +1,6 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="ImageMagickSharp" version="1.0.0.4" targetFramework="net45" />+ <package id="ImageMagickSharp" version="1.0.0.5" targetFramework="net45" /><package id="MediaBrowser.Naming" version="1.0.0.32" targetFramework="net45" /><package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" /><package id="morelinq" version="1.1.0" targetFramework="net45" />diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csprojindex fcda32a330..019f1e9776 100644--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj@@ -62,7 +62,7 @@<ItemGroup><Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"><SpecificVersion>False</SpecificVersion>- <HintPath>..\packages\ImageMagickSharp.1.0.0.4\lib\net45\ImageMagickSharp.dll</HintPath>+ <HintPath>..\packages\ImageMagickSharp.1.0.0.5\lib\net45\ImageMagickSharp.dll</HintPath></Reference><Reference Include="MediaBrowser.IsoMounter"><HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.configindex 5e4e31b864..cf01ed6666 100644--- a/MediaBrowser.ServerApplication/packages.config+++ b/MediaBrowser.ServerApplication/packages.config@@ -1,6 +1,6 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="ImageMagickSharp" version="1.0.0.4" targetFramework="net45" />+ <package id="ImageMagickSharp" version="1.0.0.5" targetFramework="net45" /><package id="MediaBrowser.IsoMounting" version="3.0.69" targetFramework="net45" /><package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" /></packages>\ No newline at end of filediff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.csindex 1e188ceae0..8328cf8ab4 100644--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs@@ -421,6 +421,7 @@ namespace MediaBrowser.WebDashboard.Api"itembynamedetailpage.js","itemdetailpage.js","itemlistpage.js",+ "kids.js","librarypathmapping.js","reports.js","librarysettings.js",diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csprojindex 812deabe11..fa6413b8ba 100644--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj@@ -87,6 +87,9 @@</ProjectReference></ItemGroup><ItemGroup>+ <Content Include="dashboard-ui\css\images\kids\bg.jpg">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </Content><Content Include="dashboard-ui\css\images\server.png"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>@@ -114,6 +117,9 @@<Content Include="dashboard-ui\forgotpasswordpin.html"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>+ <Content Include="dashboard-ui\kids.html">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </Content><Content Include="dashboard-ui\mysync.html"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>@@ -129,6 +135,9 @@<Content Include="dashboard-ui\scripts\forgotpasswordpin.js"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>+ <Content Include="dashboard-ui\scripts\kids.js">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </Content><Content Include="dashboard-ui\scripts\selectserver.js"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>diff --git a/MediaBrowser.sln b/MediaBrowser.slnindex 143a3da41b..f73971374a 100644--- a/MediaBrowser.sln+++ b/MediaBrowser.sln@@ -520,4 +520,7 @@ GlobalGlobalSection(SolutionProperties) = preSolutionHideSolutionNode = FALSEEndGlobalSection+ GlobalSection(Performance) = preSolution+ HasPerformanceSessions = true+ EndGlobalSectionEndGlobal