This commit is contained in:
tidusjar 2017-10-03 22:56:18 +01:00
commit 764ef17725
2 changed files with 11 additions and 7 deletions

View file

@ -44,16 +44,11 @@ namespace Ombi.Schedule.Jobs.Ombi
}
public async Task<bool> UpdateAvailable(string branch, string currentVersion)
{
try
{
var updates = await OmbiService.GetUpdates(branch);
var serverVersion = updates.UpdateVersionString;
return !serverVersion.Equals(currentVersion, StringComparison.CurrentCultureIgnoreCase);
}
catch (Exception e)
{
Logger.LogError(e, "Attempted to check if there was an update");
}
}
public async Task Update(PerformContext c)

View file

@ -41,12 +41,21 @@ namespace Ombi.Controllers
[HttpGet("update")]
public async Task<bool> CheckForUpdate()
{
try
{
var productArray = _updater.GetVersion();
var version = productArray[0];
var branch = productArray[1];
var updateAvailable = await _updater.UpdateAvailable(branch, version);
return updateAvailable;
}
catch (Exception e)
{
return false;
}
}
[HttpGet("updateCached")]