Compare commits

..

No commits in common. "f48713c4703fc6a1f13479225da1af8244cdab2e" and "dd2a0c027b96bf04edba33041039b7812a0d001d" have entirely different histories.

4 changed files with 1 additions and 41 deletions

View File

@ -41,17 +41,6 @@ public sealed class BlogApiController : ControllerBase
return Ok(allPosts.Select(post => CreatePostObject(post))); return Ok(allPosts.Select(post => CreatePostObject(post)));
} }
[HttpGet("posts/tagged/{tag}/{page:int?}")]
public IActionResult GetTaggedBlogPosts(string tag, int page = 0)
{
const int itemsPerPage = 10;
tag = tag.Replace('-', ' ').ToLowerInvariant();
IReadOnlyList<IBlogPost> allPosts = _blogPostService.GetBlogPosts(page, itemsPerPage);
allPosts = allPosts.Where(post => post.Tags.Contains(tag)).ToList();
return Ok(allPosts.Select(post => CreatePostObject(post)));
}
[HttpGet("author/{id:guid}")] [HttpGet("author/{id:guid}")]
public IActionResult GetAuthor(Guid id) public IActionResult GetAuthor(Guid id)
{ {

View File

@ -10,8 +10,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Alexinea.Extensions.Configuration.Toml" Version="7.0.0"/> <PackageReference Include="Alexinea.Extensions.Configuration.Toml" Version="7.0.0"/>
<PackageReference Include="Humanizer.Core" Version="2.14.1"/> <PackageReference Include="Humanizer.Core" Version="2.14.1"/>
<PackageReference Include="MailKit" Version="4.1.0"/>
<PackageReference Include="MailKitSimplified.Sender" Version="2.5.2"/>
<PackageReference Include="Markdig" Version="0.32.0"/> <PackageReference Include="Markdig" Version="0.32.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.10"/> <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.10"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.10"/> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.10"/>

View File

@ -20,11 +20,6 @@ class API {
return response.map(obj => new BlogPost(obj)); return response.map(obj => new BlogPost(obj));
} }
static async getBlogPostsByTag(tag: string, page: number): Promise<BlogPost[]> {
const response = await API.getResponse(`posts/tagged/${tag}/${page}`);
return response.map(obj => new BlogPost(obj));
}
static async getAuthor(id: string): Promise<Author> { static async getAuthor(id: string): Promise<Author> {
const response = await API.getResponse(`author/${id}`); const response = await API.getResponse(`author/${id}`);
return new Author(response); return new Author(response);

View File

@ -2,7 +2,6 @@ import API from "./API";
import UI from "./UI"; import UI from "./UI";
import Input from "./Input"; import Input from "./Input";
import Author from "./Author"; import Author from "./Author";
import BlogPost from "./BlogPost";
declare const Handlebars: any; declare const Handlebars: any;
declare const Prism: any; declare const Prism: any;
@ -28,19 +27,6 @@ declare const Prism: any;
} }
}); });
function getQueryVariable(variable: string): string {
const query = window.location.search.substring(1);
const vars = query.split("&");
for (const element of vars) {
const pair = element.split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return null;
}
Input.registerShortcut(Input.KONAMI_CODE, () => { Input.registerShortcut(Input.KONAMI_CODE, () => {
window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "_blank"); window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "_blank");
}); });
@ -60,15 +46,7 @@ declare const Prism: any;
const template = Handlebars.compile(UI.blogPostTemplate.innerHTML); const template = Handlebars.compile(UI.blogPostTemplate.innerHTML);
API.getBlogPostCount().then(async (count) => { API.getBlogPostCount().then(async (count) => {
for (let i = 0; i <= count / 10; i++) { for (let i = 0; i <= count / 10; i++) {
let posts: BlogPost[]; const posts = await API.getBlogPosts(i);
const tag = getQueryVariable("tag");
if (tag !== null) {
posts = await API.getBlogPostsByTag(tag, i);
} else {
posts = await API.getBlogPosts(i);
}
for (const post of posts) { for (const post of posts) {
let author: Author; let author: Author;
if (authors[post.authorId]) { if (authors[post.authorId]) {