Gitea/workflows #1
@@ -3,9 +3,11 @@
|
||||
"allow": [
|
||||
"Bash(dotnet test:*)",
|
||||
"Bash(dotnet build)",
|
||||
"Bash(dir:*)"
|
||||
"Bash(dir:*)",
|
||||
"Bash(dotnet add:*)",
|
||||
"Bash(dotnet build:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: My First Post
|
||||
date: 2026-03-06
|
||||
summary: Welcome to my blog! Here I'll share thoughts on software development, projects I'm working on, and things I find interesting.
|
||||
tags: [dev, personal]
|
||||
---
|
||||
|
||||
# Welcome to My Blog
|
||||
|
||||
I've been meaning to start writing about the things I build and learn, and I'm finally getting around to it.
|
||||
|
||||
## What to Expect
|
||||
|
||||
I plan to write about:
|
||||
|
||||
- **Projects** I'm working on, like this website and the other things on my portfolio
|
||||
- **Software development** tips and patterns I find useful
|
||||
- **Problem solving** approaches that have helped me grow as a developer
|
||||
|
||||
## Why a Blog?
|
||||
|
||||
Building things is great, but explaining *how* and *why* you built them is just as valuable. Writing forces you to organize your thoughts, and hopefully someone else finds it useful along the way.
|
||||
|
||||
Stay tuned for more posts!
|
||||
@@ -0,0 +1,20 @@
|
||||
using JoshHeaps.Net.Services.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace JoshHeaps.Net.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlogController(IBlogService blogService, IConfiguration configuration) : ControllerBase
|
||||
{
|
||||
[HttpPost("invalidate")]
|
||||
public IActionResult InvalidateCache([FromHeader(Name = "X-Invalidate-Key")] string? key)
|
||||
{
|
||||
var expectedKey = configuration["BlogApi:InvalidateKey"];
|
||||
if (string.IsNullOrEmpty(expectedKey) || key != expectedKey)
|
||||
return Unauthorized();
|
||||
|
||||
blogService.ClearCache();
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
@@ -84,5 +84,11 @@ public class BlogService : IBlogService
|
||||
return result;
|
||||
}
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
_cache.Clear();
|
||||
_logger.LogInformation("Blog cache cleared");
|
||||
}
|
||||
|
||||
private record CacheEntry(object Value, DateTime ExpiresAt);
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@ public interface IBlogService
|
||||
Task<List<BlogPost>> GetAllPostsAsync();
|
||||
Task<BlogPost?> GetPostBySlugAsync(string slug);
|
||||
Task<List<BlogPost>> GetPostsByTagAsync(string tag);
|
||||
void ClearCache();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"BlogApi": {
|
||||
"BaseUrl": "https://media.joshheaps.net"
|
||||
"BaseUrl": "https://media.joshheaps.net",
|
||||
"InvalidateKey": "CHANGE_ME"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user