This commit is contained in:
2026-10-28 14:24:41 +02:00
parent bd22fa86b7
commit 2bc968a92c
5 changed files with 50 additions and 4 deletions
+7 -1
View File
@@ -1,13 +1,19 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using StatiKosev.Services;
namespace StatiKosev.Pages;
public class IndexModel : PageModel
public class IndexModel(NtfyNotifier ntfy) : PageModel
{
public string VisitorName { get; private set; } = "";
public void OnGet()
{
VisitorName = User.Identity?.IsAuthenticated == true ? User.Identity.Name! : "";
var userAgent = Request.Headers.UserAgent.ToString();
ntfy.Notify("Home page visit",
$"{(VisitorName == "" ? "Guest" : VisitorName)}\n{userAgent[..Math.Min(userAgent.Length, 160)]}",
"eyes");
}
}