mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
RSS feed changes - Hashtags & Categories
This commit is contained in:
parent
c2c02f1b73
commit
e6f5ac6fe4
|
@ -44,6 +44,25 @@ public class Build : BuildDetails
|
|||
[Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Search_Version))]
|
||||
public ProjectFamily Family { get; private set; }
|
||||
|
||||
public string[] RssCategories
|
||||
{
|
||||
get
|
||||
{
|
||||
var categories = new List<string>
|
||||
{
|
||||
Family.ToString(),
|
||||
"Windows"
|
||||
};
|
||||
|
||||
if ((int)Family >= BuildRepository.CURRENT_RELEASE)
|
||||
{
|
||||
categories.Add("WindowsInsiders");
|
||||
}
|
||||
|
||||
return categories.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceDetailsFiltered
|
||||
{
|
||||
get
|
||||
|
|
|
@ -11,6 +11,10 @@ namespace BuildFeed.Model
|
|||
{
|
||||
public partial class BuildRepository
|
||||
{
|
||||
public const int CURRENT_LONG_TERM = (int)ProjectFamily.Redstone;
|
||||
public const int CURRENT_RELEASE = (int)ProjectFamily.Feature2;
|
||||
public const int CURRENT_XBOX = (int)ProjectFamily.Redstone3;
|
||||
|
||||
private const string BUILD_COLLECTION_NAME = "builds";
|
||||
private static readonly BsonDocument sortByAddedDate = new BsonDocument(nameof(Build.Added), -1);
|
||||
private static readonly BsonDocument sortByCompileDate = new BsonDocument(nameof(Build.BuildTime), -1);
|
||||
|
@ -158,10 +162,6 @@ public async Task<List<Build>> SelectBuildsByOrder(int limit = -1, int skip = 0)
|
|||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<Dictionary<ProjectFamily, FrontPage>> SelectFrontPage()
|
||||
{
|
||||
const int currentLongTerm = (int)ProjectFamily.Redstone;
|
||||
const int currentFamily = (int)ProjectFamily.Feature2;
|
||||
const int currentXbox = (int)ProjectFamily.Redstone3;
|
||||
|
||||
var families = new Dictionary<ProjectFamily, FrontPage>();
|
||||
|
||||
var query = _buildCollection.Aggregate()
|
||||
|
@ -175,14 +175,14 @@ public async Task<Dictionary<ProjectFamily, FrontPage>> SelectFrontPage()
|
|||
{
|
||||
nameof(Build.Family), new BsonDocument
|
||||
{
|
||||
{"$gte", currentFamily}
|
||||
{ "$gte", CURRENT_RELEASE }
|
||||
}
|
||||
}
|
||||
},
|
||||
new BsonDocument
|
||||
{
|
||||
{
|
||||
nameof(Build.Family), currentLongTerm
|
||||
nameof(Build.Family), CURRENT_LONG_TERM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,27 +254,27 @@ public async Task<Dictionary<ProjectFamily, FrontPage>> SelectFrontPage()
|
|||
.OrderByDescending(b => b.BuildTime)
|
||||
.FirstOrDefault(),
|
||||
CurrentInsider = results
|
||||
.Where(g => g.Key.Family == family &&
|
||||
!g.Key.LabUrl.Contains("xbox") &&
|
||||
(g.Key.SourceType == TypeOfSource.PublicRelease ||
|
||||
g.Key.SourceType == TypeOfSource.UpdateGDR))
|
||||
.Where(g => g.Key.Family == family
|
||||
&& !g.Key.LabUrl.Contains("xbox")
|
||||
&& (g.Key.SourceType == TypeOfSource.PublicRelease
|
||||
|| g.Key.SourceType == TypeOfSource.UpdateGDR))
|
||||
.SelectMany(g => g.Items)
|
||||
.OrderByDescending(b => b.BuildTime)
|
||||
.FirstOrDefault(),
|
||||
CurrentRelease = results
|
||||
.Where(g => g.Key.Family == family &&
|
||||
g.Key.LabUrl.Contains("_release") &&
|
||||
!g.Key.LabUrl.Contains("xbox") &&
|
||||
(g.Key.SourceType == TypeOfSource.PublicRelease ||
|
||||
g.Key.SourceType == TypeOfSource.UpdateGDR))
|
||||
.Where(g => g.Key.Family == family
|
||||
&& g.Key.LabUrl.Contains("_release")
|
||||
&& !g.Key.LabUrl.Contains("xbox")
|
||||
&& (g.Key.SourceType == TypeOfSource.PublicRelease
|
||||
|| g.Key.SourceType == TypeOfSource.UpdateGDR))
|
||||
.SelectMany(g => g.Items)
|
||||
.OrderByDescending(b => b.BuildTime)
|
||||
.FirstOrDefault(),
|
||||
CurrentXbox =
|
||||
results.Where(g
|
||||
=> (int)g.Key.Family >= currentXbox &&
|
||||
g.Key.Family == family &&
|
||||
g.Key.LabUrl.Contains("xbox"))
|
||||
=> (int)g.Key.Family >= CURRENT_XBOX
|
||||
&& g.Key.Family == family
|
||||
&& g.Key.LabUrl.Contains("xbox"))
|
||||
.SelectMany(g => g.Items)
|
||||
.OrderByDescending(b => b.BuildTime)
|
||||
.FirstOrDefault()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -22,9 +21,9 @@ public RssController()
|
|||
[Route("rss/compiled")]
|
||||
public async Task<ActionResult> Index()
|
||||
{
|
||||
List<Build> builds = await _bModel.SelectBuildsByCompileDate(RSS_SIZE);
|
||||
var builds = await _bModel.SelectBuildsByCompileDate(RSS_SIZE);
|
||||
|
||||
Feed feed = new Feed
|
||||
var feed = new Feed
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Compiled",
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
|
@ -32,12 +31,11 @@ public async Task<ActionResult> Index()
|
|||
select new Item
|
||||
{
|
||||
Title = build.AlternateBuildString,
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories =
|
||||
{
|
||||
build.Family.ToString()
|
||||
},
|
||||
Link = new Uri(
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink =
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories = build.RssCategories,
|
||||
PublishDate = DateTime.SpecifyKind(build.BuildTime.GetValueOrDefault(), DateTimeKind.Utc)
|
||||
}).ToList()
|
||||
};
|
||||
|
@ -53,9 +51,9 @@ public async Task<ActionResult> Index()
|
|||
[Route("rss/added")]
|
||||
public async Task<ActionResult> Added()
|
||||
{
|
||||
List<Build> builds = await _bModel.SelectBuildsByAddedDate(RSS_SIZE);
|
||||
var builds = await _bModel.SelectBuildsByAddedDate(RSS_SIZE);
|
||||
|
||||
Feed feed = new Feed
|
||||
var feed = new Feed
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Added",
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
|
@ -63,12 +61,11 @@ public async Task<ActionResult> Added()
|
|||
select new Item
|
||||
{
|
||||
Title = build.AlternateBuildString,
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories =
|
||||
{
|
||||
build.Family.ToString()
|
||||
},
|
||||
Link = new Uri(
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink =
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories = build.RssCategories,
|
||||
PublishDate = DateTime.SpecifyKind(build.Added, DateTimeKind.Utc)
|
||||
}).ToList()
|
||||
};
|
||||
|
@ -84,9 +81,9 @@ public async Task<ActionResult> Added()
|
|||
[Route("rss/leaked")]
|
||||
public async Task<ActionResult> Leaked()
|
||||
{
|
||||
List<Build> builds = await _bModel.SelectBuildsByLeakedDate(RSS_SIZE);
|
||||
var builds = await _bModel.SelectBuildsByLeakedDate(RSS_SIZE);
|
||||
|
||||
Feed feed = new Feed
|
||||
var feed = new Feed
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Leaked",
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
|
@ -94,12 +91,11 @@ public async Task<ActionResult> Leaked()
|
|||
select new Item
|
||||
{
|
||||
Title = build.AlternateBuildString,
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories =
|
||||
{
|
||||
build.Family.ToString()
|
||||
},
|
||||
Link = new Uri(
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink =
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories = build.RssCategories,
|
||||
PublishDate = DateTime.SpecifyKind(build.LeakDate.GetValueOrDefault(), DateTimeKind.Utc)
|
||||
}).ToList()
|
||||
};
|
||||
|
@ -115,9 +111,9 @@ public async Task<ActionResult> Leaked()
|
|||
[Route("rss/version")]
|
||||
public async Task<ActionResult> Version()
|
||||
{
|
||||
List<Build> builds = await _bModel.SelectBuildsByOrder(RSS_SIZE);
|
||||
var builds = await _bModel.SelectBuildsByOrder(RSS_SIZE);
|
||||
|
||||
Feed feed = new Feed
|
||||
var feed = new Feed
|
||||
{
|
||||
Title = "BuildFeed RSS - Highest Version",
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
|
@ -125,12 +121,11 @@ public async Task<ActionResult> Version()
|
|||
select new Item
|
||||
{
|
||||
Title = build.AlternateBuildString,
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories =
|
||||
{
|
||||
build.Family.ToString()
|
||||
}
|
||||
Link = new Uri(
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink =
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories = build.RssCategories
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
|
@ -145,9 +140,9 @@ public async Task<ActionResult> Version()
|
|||
[Route("rss/lab/{lab}")]
|
||||
public async Task<ActionResult> Lab(string lab)
|
||||
{
|
||||
List<Build> builds = await _bModel.SelectLab(lab, RSS_SIZE);
|
||||
var builds = await _bModel.SelectLab(lab, RSS_SIZE);
|
||||
|
||||
Feed feed = new Feed
|
||||
var feed = new Feed
|
||||
{
|
||||
Title = $"BuildFeed RSS - {lab} Lab",
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
|
@ -155,12 +150,11 @@ public async Task<ActionResult> Lab(string lab)
|
|||
select new Item
|
||||
{
|
||||
Title = build.AlternateBuildString,
|
||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories =
|
||||
{
|
||||
build.Family.ToString()
|
||||
}
|
||||
Link = new Uri(
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||
Permalink =
|
||||
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||
Categories = build.RssCategories
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user