|
|
|
@ -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>
|
|
|
|
|