aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Startup.Common
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-01-03 14:01:05 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-01-08 21:00:25 -0500
commit1b50cd00ec7b81a8c571a8a50ca46c286fac2295 (patch)
tree839e31432c68da1cee220989d5e7dab3308a23b4 /MediaBrowser.Server.Startup.Common
parented66d1a80cd6d057b687823c14c455e5779f8e57 (diff)
update github updater
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
-rw-r--r--MediaBrowser.Server.Startup.Common/ApplicationHost.cs53
1 files changed, 24 insertions, 29 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
index 2f03e13f8f..7403ec9201 100644
--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
@@ -207,7 +207,7 @@ namespace MediaBrowser.Server.Startup.Common
private IPlaylistManager PlaylistManager { get; set; }
private readonly StartupOptions _startupOptions;
- private readonly string _remotePackageName;
+ private readonly string _releaseAssetFilename;
internal INativeApp NativeApp { get; set; }
private Timer _ipAddressCacheTimer;
@@ -219,18 +219,18 @@ namespace MediaBrowser.Server.Startup.Common
/// <param name="logManager">The log manager.</param>
/// <param name="options">The options.</param>
/// <param name="fileSystem">The file system.</param>
- /// <param name="remotePackageName">Name of the remote package.</param>
+ /// <param name="releaseAssetFilename">The release asset filename.</param>
/// <param name="nativeApp">The native application.</param>
public ApplicationHost(ServerApplicationPaths applicationPaths,
ILogManager logManager,
StartupOptions options,
IFileSystem fileSystem,
- string remotePackageName,
+ string releaseAssetFilename,
INativeApp nativeApp)
: base(applicationPaths, logManager, fileSystem)
{
_startupOptions = options;
- _remotePackageName = remotePackageName;
+ _releaseAssetFilename = releaseAssetFilename;
NativeApp = nativeApp;
SetBaseExceptionMessage();
@@ -1301,36 +1301,31 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task{CheckForUpdateResult}.</returns>
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
- if (ConfigurationManager.CommonConfiguration.SystemUpdateLevel != PackageVersionClass.Dev)
- {
- var includePreRelease = ConfigurationManager.CommonConfiguration.SystemUpdateLevel != PackageVersionClass.Release;
-
- var cacheLength = TimeSpan.FromHours(1);
+ var includePreRelease = false;
+ var cacheLength = TimeSpan.FromHours(12);
+ var excludeSuffixes = new List<string>();
- return await new GithubUpdater(HttpClient, JsonSerializer, cacheLength)
- .CheckForUpdateResult("MediaBrowser", "Emby", ApplicationVersion, includePreRelease, "emby.windows.zip", "MBServer", "Mbserver.zip", cancellationToken).ConfigureAwait(false);
+ if (ConfigurationManager.CommonConfiguration.SystemUpdateLevel == PackageVersionClass.Release)
+ {
+ // Shouldn't actually be needed due to the prerelease filter
+ excludeSuffixes.Add("-beta");
+ excludeSuffixes.Add("-dev");
}
-
- var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
-
- var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, _remotePackageName, null, ApplicationVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
-
- var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);
-
- var isUpdateAvailable = versionObject != null && versionObject > ApplicationVersion;
-
- var result = versionObject != null ?
- new CheckForUpdateResult { AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version } :
- new CheckForUpdateResult { AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false };
-
- HasUpdateAvailable = result.IsUpdateAvailable;
-
- if (result.IsUpdateAvailable)
+ else if (ConfigurationManager.CommonConfiguration.SystemUpdateLevel == PackageVersionClass.Beta)
+ {
+ excludeSuffixes.Add("-dev");
+ cacheLength = TimeSpan.FromHours(1);
+ includePreRelease = true;
+ }
+ else if (ConfigurationManager.CommonConfiguration.SystemUpdateLevel == PackageVersionClass.Dev)
{
- Logger.Info("New application version is available: {0}", result.AvailableVersion);
+ excludeSuffixes.Add("-dev");
+ cacheLength = TimeSpan.FromMinutes(5);
+ includePreRelease = true;
}
- return result;
+ return await new GithubUpdater(HttpClient, JsonSerializer, cacheLength)
+ .CheckForUpdateResult("MediaBrowser", "Emby", ApplicationVersion, includePreRelease, excludeSuffixes.ToArray(), _releaseAssetFilename, "MBServer", "Mbserver.zip", cancellationToken).ConfigureAwait(false);
}
/// <summary>