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))]
|
[Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Search_Version))]
|
||||||
public ProjectFamily Family { get; private set; }
|
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
|
public string SourceDetailsFiltered
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -11,6 +11,10 @@ namespace BuildFeed.Model
|
||||||
{
|
{
|
||||||
public partial class BuildRepository
|
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 const string BUILD_COLLECTION_NAME = "builds";
|
||||||
private static readonly BsonDocument sortByAddedDate = new BsonDocument(nameof(Build.Added), -1);
|
private static readonly BsonDocument sortByAddedDate = new BsonDocument(nameof(Build.Added), -1);
|
||||||
private static readonly BsonDocument sortByCompileDate = new BsonDocument(nameof(Build.BuildTime), -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)]
|
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||||
public async Task<Dictionary<ProjectFamily, FrontPage>> SelectFrontPage()
|
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 families = new Dictionary<ProjectFamily, FrontPage>();
|
||||||
|
|
||||||
var query = _buildCollection.Aggregate()
|
var query = _buildCollection.Aggregate()
|
||||||
|
@ -175,14 +175,14 @@ public async Task<Dictionary<ProjectFamily, FrontPage>> SelectFrontPage()
|
||||||
{
|
{
|
||||||
nameof(Build.Family), new BsonDocument
|
nameof(Build.Family), new BsonDocument
|
||||||
{
|
{
|
||||||
{"$gte", currentFamily}
|
{ "$gte", CURRENT_RELEASE }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new BsonDocument
|
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)
|
.OrderByDescending(b => b.BuildTime)
|
||||||
.FirstOrDefault(),
|
.FirstOrDefault(),
|
||||||
CurrentInsider = results
|
CurrentInsider = results
|
||||||
.Where(g => g.Key.Family == family &&
|
.Where(g => g.Key.Family == family
|
||||||
!g.Key.LabUrl.Contains("xbox") &&
|
&& !g.Key.LabUrl.Contains("xbox")
|
||||||
(g.Key.SourceType == TypeOfSource.PublicRelease ||
|
&& (g.Key.SourceType == TypeOfSource.PublicRelease
|
||||||
g.Key.SourceType == TypeOfSource.UpdateGDR))
|
|| g.Key.SourceType == TypeOfSource.UpdateGDR))
|
||||||
.SelectMany(g => g.Items)
|
.SelectMany(g => g.Items)
|
||||||
.OrderByDescending(b => b.BuildTime)
|
.OrderByDescending(b => b.BuildTime)
|
||||||
.FirstOrDefault(),
|
.FirstOrDefault(),
|
||||||
CurrentRelease = results
|
CurrentRelease = results
|
||||||
.Where(g => g.Key.Family == family &&
|
.Where(g => g.Key.Family == family
|
||||||
g.Key.LabUrl.Contains("_release") &&
|
&& g.Key.LabUrl.Contains("_release")
|
||||||
!g.Key.LabUrl.Contains("xbox") &&
|
&& !g.Key.LabUrl.Contains("xbox")
|
||||||
(g.Key.SourceType == TypeOfSource.PublicRelease ||
|
&& (g.Key.SourceType == TypeOfSource.PublicRelease
|
||||||
g.Key.SourceType == TypeOfSource.UpdateGDR))
|
|| g.Key.SourceType == TypeOfSource.UpdateGDR))
|
||||||
.SelectMany(g => g.Items)
|
.SelectMany(g => g.Items)
|
||||||
.OrderByDescending(b => b.BuildTime)
|
.OrderByDescending(b => b.BuildTime)
|
||||||
.FirstOrDefault(),
|
.FirstOrDefault(),
|
||||||
CurrentXbox =
|
CurrentXbox =
|
||||||
results.Where(g
|
results.Where(g
|
||||||
=> (int)g.Key.Family >= currentXbox &&
|
=> (int)g.Key.Family >= CURRENT_XBOX
|
||||||
g.Key.Family == family &&
|
&& g.Key.Family == family
|
||||||
g.Key.LabUrl.Contains("xbox"))
|
&& g.Key.LabUrl.Contains("xbox"))
|
||||||
.SelectMany(g => g.Items)
|
.SelectMany(g => g.Items)
|
||||||
.OrderByDescending(b => b.BuildTime)
|
.OrderByDescending(b => b.BuildTime)
|
||||||
.FirstOrDefault()
|
.FirstOrDefault()
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -22,9 +21,9 @@ public RssController()
|
||||||
[Route("rss/compiled")]
|
[Route("rss/compiled")]
|
||||||
public async Task<ActionResult> Index()
|
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",
|
Title = "BuildFeed RSS - Recently Compiled",
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||||
|
@ -32,12 +31,11 @@ public async Task<ActionResult> Index()
|
||||||
select new Item
|
select new Item
|
||||||
{
|
{
|
||||||
Title = build.AlternateBuildString,
|
Title = build.AlternateBuildString,
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
Link = new Uri(
|
||||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||||
Categories =
|
Permalink =
|
||||||
{
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||||
build.Family.ToString()
|
Categories = build.RssCategories,
|
||||||
},
|
|
||||||
PublishDate = DateTime.SpecifyKind(build.BuildTime.GetValueOrDefault(), DateTimeKind.Utc)
|
PublishDate = DateTime.SpecifyKind(build.BuildTime.GetValueOrDefault(), DateTimeKind.Utc)
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
@ -53,9 +51,9 @@ public async Task<ActionResult> Index()
|
||||||
[Route("rss/added")]
|
[Route("rss/added")]
|
||||||
public async Task<ActionResult> 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",
|
Title = "BuildFeed RSS - Recently Added",
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||||
|
@ -63,12 +61,11 @@ public async Task<ActionResult> Added()
|
||||||
select new Item
|
select new Item
|
||||||
{
|
{
|
||||||
Title = build.AlternateBuildString,
|
Title = build.AlternateBuildString,
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
Link = new Uri(
|
||||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||||
Categories =
|
Permalink =
|
||||||
{
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||||
build.Family.ToString()
|
Categories = build.RssCategories,
|
||||||
},
|
|
||||||
PublishDate = DateTime.SpecifyKind(build.Added, DateTimeKind.Utc)
|
PublishDate = DateTime.SpecifyKind(build.Added, DateTimeKind.Utc)
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
@ -84,9 +81,9 @@ public async Task<ActionResult> Added()
|
||||||
[Route("rss/leaked")]
|
[Route("rss/leaked")]
|
||||||
public async Task<ActionResult> 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",
|
Title = "BuildFeed RSS - Recently Leaked",
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||||
|
@ -94,12 +91,11 @@ public async Task<ActionResult> Leaked()
|
||||||
select new Item
|
select new Item
|
||||||
{
|
{
|
||||||
Title = build.AlternateBuildString,
|
Title = build.AlternateBuildString,
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
Link = new Uri(
|
||||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||||
Categories =
|
Permalink =
|
||||||
{
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||||
build.Family.ToString()
|
Categories = build.RssCategories,
|
||||||
},
|
|
||||||
PublishDate = DateTime.SpecifyKind(build.LeakDate.GetValueOrDefault(), DateTimeKind.Utc)
|
PublishDate = DateTime.SpecifyKind(build.LeakDate.GetValueOrDefault(), DateTimeKind.Utc)
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
@ -115,9 +111,9 @@ public async Task<ActionResult> Leaked()
|
||||||
[Route("rss/version")]
|
[Route("rss/version")]
|
||||||
public async Task<ActionResult> 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",
|
Title = "BuildFeed RSS - Highest Version",
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||||
|
@ -125,12 +121,11 @@ public async Task<ActionResult> Version()
|
||||||
select new Item
|
select new Item
|
||||||
{
|
{
|
||||||
Title = build.AlternateBuildString,
|
Title = build.AlternateBuildString,
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
Link = new Uri(
|
||||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||||
Categories =
|
Permalink =
|
||||||
{
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||||
build.Family.ToString()
|
Categories = build.RssCategories
|
||||||
}
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -145,9 +140,9 @@ public async Task<ActionResult> Version()
|
||||||
[Route("rss/lab/{lab}")]
|
[Route("rss/lab/{lab}")]
|
||||||
public async Task<ActionResult> Lab(string 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",
|
Title = $"BuildFeed RSS - {lab} Lab",
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||||
|
@ -155,12 +150,11 @@ public async Task<ActionResult> Lab(string lab)
|
||||||
select new Item
|
select new Item
|
||||||
{
|
{
|
||||||
Title = build.AlternateBuildString,
|
Title = build.AlternateBuildString,
|
||||||
Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
Link = new Uri(
|
||||||
Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
|
||||||
Categories =
|
Permalink =
|
||||||
{
|
$"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
|
||||||
build.Family.ToString()
|
Categories = build.RssCategories
|
||||||
}
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user