diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index a3a013096c..2ca44b7ea2 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -160,7 +160,7 @@ namespace Emby.Dlna.PlayTo uuid = location.GetMD5().ToString("N", CultureInfo.InvariantCulture); } - var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion, uuid, null, uri.OriginalString, null); + var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersionString, uuid, null, uri.OriginalString, null); var controller = sessionInfo.SessionControllers.OfType().FirstOrDefault(); diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f7fe2bd638..5b255a0d3d 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -410,13 +410,17 @@ namespace Emby.Server.Implementations _validAddressResults.Clear(); } - public string ApplicationVersion { get; } = typeof(ApplicationHost).Assembly.GetName().Version.ToString(3); + /// + public Version ApplicationVersion { get; } = typeof(ApplicationHost).Assembly.GetName().Version; + + /// + public string ApplicationVersionString { get; } = typeof(ApplicationHost).Assembly.GetName().Version.ToString(3); /// /// Gets the current application user agent. /// /// The application user agent. - public string ApplicationUserAgent => Name.Replace(' ', '-') + "/" + ApplicationVersion; + public string ApplicationUserAgent => Name.Replace(' ', '-') + "/" + ApplicationVersionString; /// /// Gets the email address for use within a comment section of a user agent field. @@ -1425,7 +1429,7 @@ namespace Emby.Server.Implementations { HasPendingRestart = HasPendingRestart, IsShuttingDown = IsShuttingDown, - Version = ApplicationVersion, + Version = ApplicationVersionString, WebSocketPortNumber = HttpPort, CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(), Id = SystemId, @@ -1465,7 +1469,7 @@ namespace Emby.Server.Implementations return new PublicSystemInfo { - Version = ApplicationVersion, + Version = ApplicationVersionString, ProductName = ApplicationProductName, Id = SystemId, OperatingSystem = OperatingSystem.Id.ToString(), diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs index 7afeba9dd7..fe8deae595 100644 --- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs @@ -1,24 +1,23 @@ -using MediaBrowser.Common.Updates; -using MediaBrowser.Model.Net; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.Progress; +using MediaBrowser.Common.Updates; +using MediaBrowser.Model.Net; using MediaBrowser.Model.Tasks; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.ScheduledTasks { /// - /// Plugin Update Task + /// Plugin Update Task. /// public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask { /// - /// The _logger + /// The _logger. /// private readonly ILogger _logger; @@ -31,7 +30,7 @@ namespace Emby.Server.Implementations.ScheduledTasks } /// - /// Creates the triggers that define when the task will run + /// Creates the triggers that define when the task will run. /// /// IEnumerable{BaseTaskTrigger}. public IEnumerable GetDefaultTriggers() @@ -44,16 +43,16 @@ namespace Emby.Server.Implementations.ScheduledTasks } /// - /// Update installed plugins + /// Update installed plugins. /// /// The cancellation token. /// The progress. - /// Task. + /// . public async Task Execute(CancellationToken cancellationToken, IProgress progress) { progress.Report(0); - var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(typeof(PluginUpdateTask).Assembly.GetName().Version, true, cancellationToken).ConfigureAwait(false)).ToList(); + var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(cancellationToken).ConfigureAwait(false)).ToList(); progress.Report(10); @@ -94,18 +93,25 @@ namespace Emby.Server.Implementations.ScheduledTasks progress.Report(100); } + /// public string Name => "Check for plugin updates"; + /// public string Description => "Downloads and installs updates for plugins that are configured to update automatically."; + /// public string Category => "Application"; + /// public string Key => "PluginUpdates"; + /// public bool IsHidden => false; + /// public bool IsEnabled => true; + /// public bool IsLogged => true; } } diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 0c0c77cda1..28c3f0e9d7 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -107,26 +107,8 @@ namespace Emby.Server.Implementations.Updates _zipClient = zipClient; } - /// - /// Gets all available packages. - /// - /// Task{List{PackageInfo}}. - public async Task> GetAvailablePackages( - CancellationToken cancellationToken, - bool withRegistration = true, - string packageType = null, - Version applicationVersion = null) - { - var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); - return FilterPackages(packages, packageType, applicationVersion); - } - - /// - /// Gets all available packages. - /// - /// The cancellation token. - /// Task{List{PackageInfo}}. - public async Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken) + /// + public async Task> GetAvailablePackages(CancellationToken cancellationToken = default) { using (var response = await _httpClient.SendAsync( new HttpRequestOptions @@ -134,178 +116,89 @@ namespace Emby.Server.Implementations.Updates Url = "https://repo.jellyfin.org/releases/plugin/manifest.json", CancellationToken = cancellationToken, CacheMode = CacheMode.Unconditional, - CacheLength = GetCacheLength() + CacheLength = TimeSpan.FromMinutes(3) }, HttpMethod.Get).ConfigureAwait(false)) using (Stream stream = response.Content) { - return FilterPackages(await _jsonSerializer.DeserializeFromStreamAsync(stream).ConfigureAwait(false)); + return await _jsonSerializer.DeserializeFromStreamAsync>( + stream).ConfigureAwait(false); } } - private static TimeSpan GetCacheLength() + /// + public IEnumerable FilterPackages( + IEnumerable availablePackages, + string name = null, + Guid guid = default) { - return TimeSpan.FromMinutes(3); - } - - protected List FilterPackages(IEnumerable packages) - { - var list = new List(); - - foreach (var package in packages) + if (name != null) { - var versions = new List(); - foreach (var version in package.versions) - { - if (string.IsNullOrEmpty(version.sourceUrl)) - { - continue; - } - - versions.Add(version); - } - - package.versions = versions - .OrderByDescending(x => x.Version) - .ToArray(); - - if (package.versions.Length == 0) - { - continue; - } - - list.Add(package); + availablePackages = availablePackages.Where(x => x.name.Equals(name, StringComparison.OrdinalIgnoreCase)); } - // Remove packages with no versions - return list; - } - - protected List FilterPackages(IEnumerable packages, string packageType, Version applicationVersion) - { - var packagesList = FilterPackages(packages); - - var returnList = new List(); - - var filterOnPackageType = !string.IsNullOrEmpty(packageType); - - foreach (var p in packagesList) + if (guid != Guid.Empty) { - if (filterOnPackageType && !string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)) - { - continue; - } - - // If an app version was supplied, filter the versions for each package to only include supported versions - if (applicationVersion != null) - { - p.versions = p.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray(); - } - - if (p.versions.Length == 0) - { - continue; - } - - returnList.Add(p); + var strGuid = guid.ToString("N", CultureInfo.InvariantCulture); + availablePackages = availablePackages.Where(x => x.guid.Equals(strGuid, StringComparison.OrdinalIgnoreCase)); } - return returnList; + return availablePackages; } - /// - /// Determines whether [is package version up to date] [the specified package version info]. - /// - /// The package version info. - /// The current server version. - /// true if [is package version up to date] [the specified package version info]; otherwise, false. - private static bool IsPackageVersionUpToDate(PackageVersionInfo packageVersionInfo, Version currentServerVersion) + /// + public IEnumerable GetCompatibleVersions( + IEnumerable availableVersions, + Version minVersion = null, + PackageVersionClass classification = PackageVersionClass.Release) { - if (string.IsNullOrEmpty(packageVersionInfo.requiredVersionStr)) + var appVer = _applicationHost.ApplicationVersion; + availableVersions = availableVersions.Where(x => Version.Parse(x.requiredVersionStr) <= appVer); + + if (minVersion != null) { - return true; + availableVersions = availableVersions.Where(x => x.Version >= minVersion); } - return Version.TryParse(packageVersionInfo.requiredVersionStr, out var requiredVersion) && currentServerVersion >= requiredVersion; + return availableVersions; } - /// - /// Gets the package. - /// - /// The name. - /// The assembly guid - /// The classification. - /// The version. - /// Task{PackageVersionInfo}. - public async Task GetPackage(string name, string guid, PackageVersionClass classification, Version version) + /// + public IEnumerable GetCompatibleVersions( + IEnumerable availablePackages, + string name = null, + Guid guid = default, + Version minVersion = null, + PackageVersionClass classification = PackageVersionClass.Release) { - var packages = await GetAvailablePackages(CancellationToken.None, false).ConfigureAwait(false); - - var package = packages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase)) - ?? packages.FirstOrDefault(p => p.name.Equals(name, StringComparison.OrdinalIgnoreCase)); + var package = FilterPackages(availablePackages, name, guid).FirstOrDefault(); + // Package not found. if (package == null) { return null; } - return package.versions.FirstOrDefault(v => v.Version == version && v.classification == classification); + return GetCompatibleVersions( + package.versions, + minVersion, + classification); } - /// - /// Gets the latest compatible version. - /// - /// The name. - /// The assembly guid if this is a plug-in - /// The current server version. - /// The classification. - /// Task{PackageVersionInfo}. - public async Task GetLatestCompatibleVersion(string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release) + /// + public async Task> GetAvailablePluginUpdates(CancellationToken cancellationToken = default) { - var packages = await GetAvailablePackages(CancellationToken.None, false).ConfigureAwait(false); - - return GetLatestCompatibleVersion(packages, name, guid, currentServerVersion, classification); - } - - /// - /// Gets the latest compatible version. - /// - /// The available packages. - /// The name. - /// The current server version. - /// The classification. - /// PackageVersionInfo. - public PackageVersionInfo GetLatestCompatibleVersion(IEnumerable availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release) - { - var package = availablePackages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase)) - ?? availablePackages.FirstOrDefault(p => p.name.Equals(name, StringComparison.OrdinalIgnoreCase)); - - return package?.versions - .OrderByDescending(x => x.Version) - .FirstOrDefault(v => v.classification <= classification && IsPackageVersionUpToDate(v, currentServerVersion)); - } - - /// - /// Gets the available plugin updates. - /// - /// The current server version. - /// if set to true [with auto update enabled]. - /// The cancellation token. - /// Task{IEnumerable{PackageVersionInfo}}. - public async Task> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken) - { - var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); + var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false); var systemUpdateLevel = _applicationHost.SystemUpdateLevel; // Figure out what needs to be installed - return _applicationHost.Plugins.Select(p => + return _applicationHost.Plugins.Select(x => { - var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, systemUpdateLevel); - - return latestPluginInfo != null && latestPluginInfo.Version > p.Version ? latestPluginInfo : null; - }).Where(i => i != null) - .Where(p => !string.IsNullOrEmpty(p.sourceUrl) && !CompletedInstallations.Any(i => string.Equals(i.AssemblyGuid, p.guid, StringComparison.OrdinalIgnoreCase))); + var compatibleversions = GetCompatibleVersions(catalog, x.Name, x.Id, x.Version, systemUpdateLevel); + return compatibleversions.FirstOrDefault(y => y.Version > x.Version); + }).Where(x => x != null) + .Where(x => !CompletedInstallations.Any(y => string.Equals(y.AssemblyGuid, x.guid, StringComparison.OrdinalIgnoreCase))); } /// @@ -391,7 +284,7 @@ namespace Emby.Server.Implementations.Updates finally { // Dispose the progress object and remove the installation from the in-progress list - tuple.Item2.Dispose(); + tuple.innerCancellationTokenSource.Dispose(); } } @@ -537,18 +430,19 @@ namespace Emby.Server.Implementations.Updates { lock (_currentInstallations) { - var install = _currentInstallations.Find(x => x.Item1.Id == id); + var install = _currentInstallations.Find(x => x.info.Id == id); if (install == default((InstallationInfo, CancellationTokenSource))) { return false; } - install.Item2.Cancel(); + install.token.Cancel(); _currentInstallations.Remove(install); return true; } } + /// public void Dispose() { Dispose(true); @@ -567,7 +461,7 @@ namespace Emby.Server.Implementations.Updates { foreach (var tuple in _currentInstallations) { - tuple.Item2.Dispose(); + tuple.token.Dispose(); } _currentInstallations.Clear(); diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index baa6f7bb97..61bddb4138 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.Progress; using MediaBrowser.Common.Updates; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Services; @@ -139,7 +139,7 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetPackage request) { - var packages = _installationManager.GetAvailablePackages(CancellationToken.None, applicationVersion: typeof(PackageService).Assembly.GetName().Version).Result; + var packages = _installationManager.GetAvailablePackages().Result; var result = packages.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase)) ?? packages.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); @@ -154,7 +154,7 @@ namespace MediaBrowser.Api /// System.Object. public async Task Get(GetPackages request) { - IEnumerable packages = await _installationManager.GetAvailablePackages(CancellationToken.None, false, request.PackageType, typeof(PackageService).Assembly.GetName().Version).ConfigureAwait(false); + IEnumerable packages = await _installationManager.GetAvailablePackages().ConfigureAwait(false); if (!string.IsNullOrEmpty(request.TargetSystems)) { @@ -163,11 +163,6 @@ namespace MediaBrowser.Api packages = packages.Where(p => apps.Contains(p.targetSystem)); } - if (request.IsPremium.HasValue) - { - packages = packages.Where(p => p.isPremium == request.IsPremium.Value); - } - if (request.IsAdult.HasValue) { packages = packages.Where(p => p.adult == request.IsAdult.Value); @@ -188,13 +183,21 @@ namespace MediaBrowser.Api /// public async Task Post(InstallPackage request) { - var package = string.IsNullOrEmpty(request.Version) ? - await _installationManager.GetLatestCompatibleVersion(request.Name, request.AssemblyGuid, typeof(PackageService).Assembly.GetName().Version, request.UpdateClass).ConfigureAwait(false) : - await _installationManager.GetPackage(request.Name, request.AssemblyGuid, request.UpdateClass, Version.Parse(request.Version)).ConfigureAwait(false); + var packages = await _installationManager.GetAvailablePackages().ConfigureAwait(false); + var package = _installationManager.GetCompatibleVersions( + packages, + request.Name, + new Guid(request.AssemblyGuid), + string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version), + request.UpdateClass).FirstOrDefault(); if (package == null) { - throw new ResourceNotFoundException(string.Format("Package not found: {0}", request.Name)); + throw new ResourceNotFoundException( + string.Format( + CultureInfo.InvariantCulture, + "Package not found: {0}", + request.Name)); } await _installationManager.InstallPackage(package); diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index 76392e27c9..6caf3b4809 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -321,7 +321,7 @@ namespace MediaBrowser.Api.Session DateCreated = DateTime.UtcNow, DeviceId = _appHost.SystemId, DeviceName = _appHost.FriendlyName, - AppVersion = _appHost.ApplicationVersion + AppVersion = _appHost.ApplicationVersionString }); } diff --git a/MediaBrowser.Common/Cryptography/PasswordHash.cs b/MediaBrowser.Common/Cryptography/PasswordHash.cs index dca31cd926..c1c154b94f 100644 --- a/MediaBrowser.Common/Cryptography/PasswordHash.cs +++ b/MediaBrowser.Common/Cryptography/PasswordHash.cs @@ -97,19 +97,12 @@ namespace MediaBrowser.Common.Cryptography } } - byte[] hash; - byte[] salt; // Check if the string also contains a salt - if (splitted.Length - index == 2) - { - salt = FromHexString(splitted[index++]); - hash = FromHexString(splitted[index++]); - } - else - { - salt = Array.Empty(); - hash = FromHexString(splitted[index++]); - } + byte[] salt = splitted.Length - index == 2 + ? FromHexString(splitted[index++]) + : Array.Empty(); + + byte[] hash = FromHexString(splitted[index]); return new PasswordHash(id, hash, salt, parameters); } diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index c8da100f64..6668e98aa5 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -67,7 +67,13 @@ namespace MediaBrowser.Common /// Gets the application version. /// /// The application version. - string ApplicationVersion { get; } + Version ApplicationVersion { get; } + + /// + /// Gets the application version. + /// + /// The application version. + string ApplicationVersionString { get; } /// /// Gets the application user agent. diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index b3367f71d0..ce4829c134 100644 --- a/MediaBrowser.Common/Updates/IInstallationManager.cs +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -17,11 +17,6 @@ namespace MediaBrowser.Common.Updates event EventHandler PackageInstallationFailed; event EventHandler PackageInstallationCancelled; - /// - /// The completed installations - /// - IEnumerable CompletedInstallations { get; } - /// /// Occurs when [plugin uninstalled]. /// @@ -37,63 +32,64 @@ namespace MediaBrowser.Common.Updates /// event EventHandler> PluginInstalled; + /// + /// The completed installations + /// + IEnumerable CompletedInstallations { get; } + /// /// Gets all available packages. /// /// The cancellation token. - /// if set to true [with registration]. - /// Type of the package. - /// The application version. - /// Task{List{PackageInfo}}. - Task> GetAvailablePackages(CancellationToken cancellationToken, - bool withRegistration = true, string packageType = null, Version applicationVersion = null); + /// Task{IReadOnlyList{PackageInfo}}. + Task> GetAvailablePackages(CancellationToken cancellationToken = default); /// - /// Gets all available packages from a static resource. + /// Returns all plugins matching the requirements. /// - /// The cancellation token. - /// Task{List{PackageInfo}}. - Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); + /// The available packages. + /// The name of the plugin. + /// The id of the plugin. + /// All plugins matching the requirements. + IEnumerable FilterPackages( + IEnumerable availablePackages, + string name = null, + Guid guid = default); /// - /// Gets the package. + /// Returns all compatible versions ordered from newest to oldest. /// - /// The name. - /// The assembly guid - /// The classification. - /// The version. - /// Task{PackageVersionInfo}. - Task GetPackage(string name, string guid, PackageVersionClass classification, Version version); + /// The available version of the plugin. + /// The minimum required version of the plugin. + /// The classification of updates. + /// All compatible versions ordered from newest to oldest. + IEnumerable GetCompatibleVersions( + IEnumerable availableVersions, + Version minVersion = null, + PackageVersionClass classification = PackageVersionClass.Release); /// - /// Gets the latest compatible version. - /// - /// The name. - /// The assembly guid - /// The current server version. - /// The classification. - /// Task{PackageVersionInfo}. - Task GetLatestCompatibleVersion(string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release); - - /// - /// Gets the latest compatible version. + /// Returns all compatible versions ordered from newest to oldest. /// /// The available packages. /// The name. - /// The assembly guid - /// The current server version. + /// The guid of the plugin. + /// The minimum required version of the plugin. /// The classification. - /// PackageVersionInfo. - PackageVersionInfo GetLatestCompatibleVersion(IEnumerable availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release); + /// All compatible versions ordered from newest to oldest. + IEnumerable GetCompatibleVersions( + IEnumerable availablePackages, + string name = null, + Guid guid = default, + Version minVersion = null, + PackageVersionClass classification = PackageVersionClass.Release); /// - /// Gets the available plugin updates. + /// Returns the available plugin updates. /// - /// The current server version. - /// if set to true [with auto update enabled]. /// The cancellation token. - /// Task{IEnumerable{PackageVersionInfo}}. - Task> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken); + /// Tthe available plugin updates. + Task> GetAvailablePluginUpdates(CancellationToken cancellationToken = default); /// /// Installs the package. diff --git a/MediaBrowser.Model/Updates/PackageInfo.cs b/MediaBrowser.Model/Updates/PackageInfo.cs index ff4ed26d31..5dd9c65918 100644 --- a/MediaBrowser.Model/Updates/PackageInfo.cs +++ b/MediaBrowser.Model/Updates/PackageInfo.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace MediaBrowser.Model.Updates { @@ -150,7 +151,7 @@ namespace MediaBrowser.Model.Updates /// Gets or sets the versions. /// /// The versions. - public PackageVersionInfo[] versions { get; set; } + public IReadOnlyList versions { get; set; } /// /// Gets or sets a value indicating whether [enable in application store]. diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbUtils.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbUtils.cs index 112cbf800a..dd5ebf2704 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbUtils.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbUtils.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel; using MediaBrowser.Model.Entities; namespace MediaBrowser.Providers.TV.TheTVDB { diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index d2ffd5efcd..fadf32b28f 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -205,7 +205,7 @@ namespace MediaBrowser.WebDashboard.Api return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => Task.FromResult(stream)); } - return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersion, null)); + return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersionString, null)); } throw new ResourceNotFoundException(); @@ -342,7 +342,7 @@ namespace MediaBrowser.WebDashboard.Api cacheDuration = TimeSpan.FromDays(365); } - var cacheKey = (_appHost.ApplicationVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); + var cacheKey = (_appHost.ApplicationVersionString + (localizationCulture ?? string.Empty) + path).GetMD5(); // html gets modified on the fly if (contentType.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)) @@ -364,7 +364,7 @@ namespace MediaBrowser.WebDashboard.Api private Task GetResourceStream(string basePath, string virtualPath, string localizationCulture) { return GetPackageCreator(basePath) - .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationVersion); + .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationVersionString); } private PackageCreator GetPackageCreator(string basePath) @@ -400,7 +400,7 @@ namespace MediaBrowser.WebDashboard.Api CopyDirectory(inputPath, targetPath); } - var appVersion = _appHost.ApplicationVersion; + var appVersion = _appHost.ApplicationVersionString; await DumpHtml(packageCreator, inputPath, targetPath, mode, appVersion);