The Free Software Media System - Server Backend & API
update dialogs
Luke Pulverenti906546ca5e5a
diff --git a/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs b/MediaBrowser.Common.Implementations/Updates/GithubUpdater.csindex 6281ab3edb..84c08439ee 100644--- a/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs+++ b/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs@@ -14,16 +14,14 @@ namespace MediaBrowser.Common.Implementations.Updates{private readonly IHttpClient _httpClient;private readonly IJsonSerializer _jsonSerializer;- private TimeSpan _cacheLength;- public GithubUpdater(IHttpClient httpClient, IJsonSerializer jsonSerializer, TimeSpan cacheLength)+ public GithubUpdater(IHttpClient httpClient, IJsonSerializer jsonSerializer){_httpClient = httpClient;_jsonSerializer = jsonSerializer;- _cacheLength = cacheLength;}- public async Task<CheckForUpdateResult> CheckForUpdateResult(string organzation, string repository, Version minVersion, PackageVersionClass updateLevel, string assetFilename, string packageName, string targetFilename, CancellationToken cancellationToken)+ public async Task<CheckForUpdateResult> CheckForUpdateResult(string organzation, string repository, Version minVersion, PackageVersionClass updateLevel, string assetFilename, string packageName, string targetFilename, TimeSpan cacheLength, CancellationToken cancellationToken){var url = string.Format("https://api.github.com/repos/{0}/{1}/releases", organzation, repository);@@ -35,10 +33,10 @@ namespace MediaBrowser.Common.Implementations.UpdatesUserAgent = "Emby/3.0"};- if (_cacheLength.Ticks > 0)+ if (cacheLength.Ticks > 0){options.CacheMode = CacheMode.Unconditional;- options.CacheLength = _cacheLength;+ options.CacheLength = cacheLength;}using (var stream = await _httpClient.Get(options).ConfigureAwait(false))@@ -110,12 +108,6 @@ namespace MediaBrowser.Common.Implementations.UpdatesUserAgent = "Emby/3.0"};- if (_cacheLength.Ticks > 0)- {- options.CacheMode = CacheMode.Unconditional;- options.CacheLength = _cacheLength;- }-using (var stream = await _httpClient.Get(options).ConfigureAwait(false)){var obj = _jsonSerializer.DeserializeFromStream<RootObject[]>(stream);diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex 7cac875902..1a5ebedc2a 100644--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -194,14 +194,22 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listingsreturn station;}- if (string.IsNullOrWhiteSpace(channelName))+ if (!string.IsNullOrWhiteSpace(channelName)){- return null;- }+ channelName = NormalizeName(channelName);- channelName = NormalizeName(channelName);+ var result = channelPair.Values.FirstOrDefault(i => string.Equals(NormalizeName(i.callsign ?? string.Empty), channelName, StringComparison.OrdinalIgnoreCase));- return channelPair.Values.FirstOrDefault(i => string.Equals(NormalizeName(i.callsign ?? string.Empty), channelName, StringComparison.OrdinalIgnoreCase));+ if (result != null)+ {+ return result;+ }+ }++ if (!string.IsNullOrWhiteSpace(channelNumber))+ {+ return channelPair.Values.FirstOrDefault(i => string.Equals(NormalizeName(i.stationID ?? string.Empty), channelNumber, StringComparison.OrdinalIgnoreCase));+ }}return null;diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.csindex 07659fdfc6..703d8242f6 100644--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs@@ -1345,8 +1345,8 @@ namespace MediaBrowser.Server.Startup.CommoncacheLength = TimeSpan.FromMinutes(5);}- var result = await new GithubUpdater(HttpClient, JsonSerializer, cacheLength).CheckForUpdateResult("MediaBrowser", "Emby", ApplicationVersion, updateLevel, _releaseAssetFilename,- "MBServer", "Mbserver.zip", cancellationToken).ConfigureAwait(false);+ var result = await new GithubUpdater(HttpClient, JsonSerializer).CheckForUpdateResult("MediaBrowser", "Emby", ApplicationVersion, updateLevel, _releaseAssetFilename,+ "MBServer", "Mbserver.zip", cacheLength, cancellationToken).ConfigureAwait(false);HasUpdateAvailable = result.IsUpdateAvailable;diff --git a/MediaBrowser.Server.Startup.Common/Migrations/UpdateLevelMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/UpdateLevelMigration.csindex d5fe9707c8..4afd5bd344 100644--- a/MediaBrowser.Server.Startup.Common/Migrations/UpdateLevelMigration.cs+++ b/MediaBrowser.Server.Startup.Common/Migrations/UpdateLevelMigration.cs@@ -52,7 +52,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrationsprivate async Task CheckVersion(Version currentVersion, PackageVersionClass currentUpdateLevel, CancellationToken cancellationToken){- var releases = await new GithubUpdater(_httpClient, _jsonSerializer, TimeSpan.FromMinutes(3))+ var releases = await new GithubUpdater(_httpClient, _jsonSerializer).GetLatestReleases("MediaBrowser", "Emby", _releaseAssetFilename, cancellationToken).ConfigureAwait(false);var newUpdateLevel = GetNewUpdateLevel(currentVersion, currentUpdateLevel, releases);diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.csindex 200e2d3ae1..b08b82de53 100644--- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs+++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs@@ -217,7 +217,7 @@ namespace MediaBrowser.ServerApplication.Nativereturn false;}- return MessageBox.Show(MainStartup._splash, "Emby has detected that Windows Firewall has been configured in a way that may prevent your other devices from accessing Emby Server. Click OK to remove this rule, or cancel to proceed anyway.", "Windows Firewall", MessageBoxButtons.OKCancel) == DialogResult.OK;+ return MessageBox.Show(MainStartup._splash, "Emby has detected that a rule has been added to Windows Firewall that may prevent your other devices from accessing Emby Server. Click OK to remove this rule, or cancel to proceed anyway.", "Windows Firewall", MessageBoxButtons.OKCancel) == DialogResult.OK;}public bool PortsRequireAuthorization(string applicationPath)diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.csindex aec4632ae8..2f8b348791 100644--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs@@ -58,11 +58,6 @@ namespace MediaBrowser.WebDashboard.Api{}- [Route("/web/staticfiles", "GET")]- public class GetCacheFiles- {- }-/// <summary>/// Class GetDashboardResource/// </summary>@@ -145,37 +140,6 @@ namespace MediaBrowser.WebDashboard.Apireturn ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml("dummy.html", page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false));}- public object Get(GetCacheFiles request)- {- var allFiles = GetCacheFileList();-- return ResultFactory.GetOptimizedResult(Request, _jsonSerializer.SerializeToString(allFiles));- }-- private List<string> GetCacheFileList()- {- var creator = GetPackageCreator();- var directory = creator.DashboardUIPath;-- var skipExtensions = GetDeployIgnoreExtensions();- var skipNames = GetDeployIgnoreFilenames();-- return- Directory.GetFiles(directory, "*", SearchOption.AllDirectories)- .Where(i => !skipExtensions.Contains(Path.GetExtension(i) ?? string.Empty, StringComparer.OrdinalIgnoreCase))- .Where(i => !skipNames.Any(s =>- {- if (s.Item2)- {- return string.Equals(s.Item1, Path.GetFileName(i), StringComparison.OrdinalIgnoreCase);- }-- return (Path.GetFileName(i) ?? string.Empty).IndexOf(s.Item1, StringComparison.OrdinalIgnoreCase) != -1;- }))- .Select(i => i.Replace(directory, string.Empty, StringComparison.OrdinalIgnoreCase).Replace("\\", "/").TrimStart('/') + "?v=" + _appHost.ApplicationVersion.ToString())- .ToList();- }-/// <summary>/// Gets the specified request./// </summary>@@ -369,8 +333,6 @@ namespace MediaBrowser.WebDashboard.Apivar appVersion = _appHost.ApplicationVersion.ToString();- File.WriteAllText(Path.Combine(path, "staticfiles"), _jsonSerializer.SerializeToString(GetCacheFileList()));-var mode = request.Mode;// Try to trim the output size a bit