Fixed the update check for the master build

pull/2089/head
Jamie 7 years ago
parent 012abc8c08
commit 5a22802663

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -9,6 +10,7 @@ using Octokit;
using Ombi.Api; using Ombi.Api;
using Ombi.Api.Service; using Ombi.Api.Service;
using Ombi.Core.Processor; using Ombi.Core.Processor;
using Ombi.Helpers;
namespace Ombi.Schedule.Processor namespace Ombi.Schedule.Processor
{ {
@ -44,7 +46,8 @@ namespace Ombi.Schedule.Processor
if (masterBranch) if (masterBranch)
{ {
latestRelease = doc.DocumentNode.Descendants("h2") latestRelease = doc.DocumentNode.Descendants("h2")
.FirstOrDefault(x => x.InnerText != "(unreleased)"); .FirstOrDefault(x => x.InnerText == "(unreleased)");
// TODO: Change this to InnterText != "(unreleased)" once we go live and it's not a prerelease
} }
else else
{ {
@ -173,10 +176,13 @@ namespace Ombi.Schedule.Processor
var releases = await client.Repository.Release.GetAll("tidusjar", "ombi"); var releases = await client.Repository.Release.GetAll("tidusjar", "ombi");
var latest = releases.FirstOrDefault(x => x.TagName == releaseTag); var latest = releases.FirstOrDefault(x => x.TagName == releaseTag);
if (latest.Name.Contains("V2", CompareOptions.IgnoreCase))
{
latest = null;
}
if (latest == null) if (latest == null)
{ {
latest = releases.OrderBy(x => x.CreatedAt).FirstOrDefault(); latest = releases.OrderByDescending(x => x.CreatedAt).FirstOrDefault();
} }
foreach (var item in latest.Assets) foreach (var item in latest.Assets)
{ {

Loading…
Cancel
Save