+ Delete @_deleteTarget.Title? This cannot be undone.
+
+
+
+
+
+}
+
+@code {
+ private List? _posts;
+ private NewsPost? _deleteTarget;
+
+ protected override async Task OnInitializedAsync()
+ {
+ await LoadAsync();
+ }
+
+ private async Task LoadAsync()
+ {
+ _posts = await Catalog.NewsPosts
+ .OrderByDescending(p => p.CreatedAt)
+ .AsNoTracking()
+ .ToListAsync();
+ }
+
+ private void ConfirmDelete(NewsPost post) => _deleteTarget = post;
+ private void CancelDelete() => _deleteTarget = null;
+
+ private async Task ExecuteDelete()
+ {
+ if (_deleteTarget is null) return;
+ Catalog.NewsPosts.Remove(_deleteTarget);
+ await Catalog.SaveChangesAsync();
+ _deleteTarget = null;
+ await LoadAsync();
+ }
+}
diff --git a/Server/src/SOR.Database/Contexts/CatalogDbContext.cs b/Server/src/SOR.Database/Contexts/CatalogDbContext.cs
index 0053cc2..e36bd67 100644
--- a/Server/src/SOR.Database/Contexts/CatalogDbContext.cs
+++ b/Server/src/SOR.Database/Contexts/CatalogDbContext.cs
@@ -21,6 +21,7 @@ public sealed class CatalogDbContext : DbContext
public CatalogDbContext(DbContextOptions options)
: base(options) { }
+ public DbSet NewsPosts => Set();
public DbSet CardSets => Set();
public DbSet CardDefinitions => Set();
public DbSet CardAssets => Set();
@@ -36,6 +37,17 @@ public sealed class CatalogDbContext : DbContext
{
builder.HasDefaultSchema("catalog");
+ builder.Entity(e =>
+ {
+ e.ToTable("news_posts");
+ e.HasKey(n => n.Id);
+ e.Property(n => n.Slug).IsRequired();
+ e.Property(n => n.Title).IsRequired();
+ e.Property(n => n.BodyHtml).HasColumnType("text").IsRequired();
+ e.HasIndex(n => n.Slug).IsUnique();
+ e.HasIndex(n => new { n.IsPublished, n.PublishedAt });
+ });
+
builder.Entity(e =>
{
e.ToTable("card_sets");
diff --git a/Server/src/SOR.Database/Entities/Catalog/NewsPost.cs b/Server/src/SOR.Database/Entities/Catalog/NewsPost.cs
new file mode 100644
index 0000000..517feda
--- /dev/null
+++ b/Server/src/SOR.Database/Entities/Catalog/NewsPost.cs
@@ -0,0 +1,39 @@
+namespace SOR.Database.Entities.Catalog;
+
+///
+/// A website news post / announcement managed via the admin portal.
+///
+/// Body content is stored as HTML — the admin editor is responsible for
+/// sanitising or producing safe markup before saving.
+///
+public sealed class NewsPost
+{
+ public Guid Id { get; set; } = Guid.NewGuid();
+
+ /// URL-friendly slug, e.g. "set-2-launch". Must be unique.
+ public string Slug { get; set; } = string.Empty;
+
+ /// Display title of the post.
+ public string Title { get; set; } = string.Empty;
+
+ /// Short teaser shown on the news index page (plain text).
+ public string Summary { get; set; } = string.Empty;
+
+ /// Full post body as HTML. Rendered directly — admin is trusted.
+ public string BodyHtml { get; set; } = string.Empty;
+
+ /// CDN URL of the post's hero image. Null = no image.
+ public string? HeroImageUrl { get; set; }
+
+ /// Author display name shown on the post.
+ public string AuthorName { get; set; } = "Aeternalis Games";
+
+ /// When the post was made visible. Null = not yet published.
+ public DateTimeOffset? PublishedAt { get; set; }
+
+ /// True once PublishedAt is set and the post is live.
+ public bool IsPublished { get; set; }
+
+ public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
+ public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
+}
diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260423000001_AddNewsPosts.cs b/Server/src/SOR.Database/Migrations/Catalog/20260423000001_AddNewsPosts.cs
new file mode 100644
index 0000000..047daee
--- /dev/null
+++ b/Server/src/SOR.Database/Migrations/Catalog/20260423000001_AddNewsPosts.cs
@@ -0,0 +1,58 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SOR.Database.Migrations.Catalog
+{
+ ///
+ public partial class AddNewsPosts : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "news_posts",
+ schema: "catalog",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ Slug = table.Column(type: "text", nullable: false),
+ Title = table.Column(type: "text", nullable: false),
+ Summary = table.Column(type: "text", nullable: false),
+ BodyHtml = table.Column(type: "text", nullable: false),
+ HeroImageUrl = table.Column(type: "text", nullable: true),
+ AuthorName = table.Column(type: "text", nullable: false),
+ PublishedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ IsPublished = table.Column(type: "boolean", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false),
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_news_posts", x => x.Id);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_news_posts_Slug",
+ schema: "catalog",
+ table: "news_posts",
+ column: "Slug",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_news_posts_IsPublished_PublishedAt",
+ schema: "catalog",
+ table: "news_posts",
+ columns: new[] { "IsPublished", "PublishedAt" });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "news_posts",
+ schema: "catalog");
+ }
+ }
+}
diff --git a/Server/src/SOR.Website/Pages/AiAssets/Index.cshtml b/Server/src/SOR.Website/Pages/AiAssets/Index.cshtml
index 535af6b..a8a89b8 100644
--- a/Server/src/SOR.Website/Pages/AiAssets/Index.cshtml
+++ b/Server/src/SOR.Website/Pages/AiAssets/Index.cshtml
@@ -1,4 +1,4 @@
-@page
+@page "/ai-assets"
@model IndexModel
@{
ViewData["Title"] = "AI Asset Disclosure";
diff --git a/Server/src/SOR.Website/Pages/AiAssets/Report.cshtml b/Server/src/SOR.Website/Pages/AiAssets/Report.cshtml
index 964ede4..c356b00 100644
--- a/Server/src/SOR.Website/Pages/AiAssets/Report.cshtml
+++ b/Server/src/SOR.Website/Pages/AiAssets/Report.cshtml
@@ -1,4 +1,4 @@
-@page
+@page "/ai-assets/report"
@model ReportModel
@{
ViewData["Title"] = "AI Asset Report";
diff --git a/Server/src/SOR.Website/Pages/Auth/Login.cshtml b/Server/src/SOR.Website/Pages/Auth/Login.cshtml
index 7988ba5..2176fb7 100644
--- a/Server/src/SOR.Website/Pages/Auth/Login.cshtml
+++ b/Server/src/SOR.Website/Pages/Auth/Login.cshtml
@@ -19,14 +19,14 @@
-
- Username or Email
+
-
+ placeholder="your handle or email">
+
diff --git a/Server/src/SOR.Website/Pages/Auth/Login.cshtml.cs b/Server/src/SOR.Website/Pages/Auth/Login.cshtml.cs
index 5c510a5..fd87e97 100644
--- a/Server/src/SOR.Website/Pages/Auth/Login.cshtml.cs
+++ b/Server/src/SOR.Website/Pages/Auth/Login.cshtml.cs
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.RateLimiting;
+using Microsoft.EntityFrameworkCore;
using SOR.Database.Entities.Identity;
///
@@ -38,10 +39,10 @@ public sealed class LoginModel(
public sealed class InputModel
{
- [Required(ErrorMessage = "Email is required.")]
- [EmailAddress(ErrorMessage = "Enter a valid email address.")]
+ // Accepts either an email address or the player's in-game display name (handle).
+ [Required(ErrorMessage = "Username or email is required.")]
[MaxLength(254)]
- public string Email { get; set; } = string.Empty;
+ public string UsernameOrEmail { get; set; } = string.Empty;
[Required(ErrorMessage = "Password is required.")]
[DataType(DataType.Password)]
@@ -65,40 +66,44 @@ public sealed class LoginModel(
if (!ModelState.IsValid)
return Page();
- // PasswordSignInAsync with lockoutOnFailure:true — after 5 failures the
- // account is locked for 30 minutes (configured in Program.cs).
- var result = await signInManager.PasswordSignInAsync(
- Input.Email,
- Input.Password,
- Input.RememberMe,
- lockoutOnFailure: true);
+ // Resolve account: try email first, then fall back to display name.
+ // We look up the user explicitly so we can use the TUser overload of
+ // PasswordSignInAsync — this lets us pass lockoutOnFailure correctly
+ // regardless of which identifier the player used.
+ var input = Input.UsernameOrEmail.Trim();
+ var user = await userManager.FindByEmailAsync(input)
+ ?? await userManager.Users
+ .FirstOrDefaultAsync(u => u.DisplayName == input);
- if (result.Succeeded)
+ if (user is not null)
{
- // Add the display_name claim to the cookie so the layout can show
- // the player's handle without a DB hit on every request.
- var user = await userManager.FindByEmailAsync(Input.Email);
- if (user is not null)
+ var result = await signInManager.PasswordSignInAsync(
+ user,
+ Input.Password,
+ Input.RememberMe,
+ lockoutOnFailure: true);
+
+ if (result.Succeeded)
{
+ // Embed display_name in the cookie so the nav bar shows the
+ // player's handle without a DB round-trip on every request.
var extraClaims = new[]
{
new Claim("display_name", user.DisplayName ?? user.Email ?? string.Empty),
};
await signInManager.SignInWithClaimsAsync(user, Input.RememberMe, extraClaims);
+ return SafeRedirect(ReturnUrl);
}
- return SafeRedirect(ReturnUrl);
+ if (result.IsLockedOut)
+ {
+ ErrorMessage = "Too many failed attempts. Please try again later.";
+ return Page();
+ }
}
- if (result.IsLockedOut)
- {
- // Generic message — does not reveal whether the email exists.
- ErrorMessage = "Too many failed attempts. Please try again later.";
- return Page();
- }
-
- // Generic: do not confirm whether the email is registered (prevents enumeration).
- ErrorMessage = "Invalid email or password.";
+ // Generic: does not confirm whether the identifier exists (prevents enumeration).
+ ErrorMessage = "Invalid username/email or password.";
return Page();
}
diff --git a/Server/src/SOR.Website/Pages/HowToPlay.cshtml b/Server/src/SOR.Website/Pages/HowToPlay.cshtml
index 75232e2..aef7e97 100644
--- a/Server/src/SOR.Website/Pages/HowToPlay.cshtml
+++ b/Server/src/SOR.Website/Pages/HowToPlay.cshtml
@@ -1,4 +1,4 @@
-@page
+@page "/how-to-play"
@model HowToPlayModel
@{
ViewData["Title"] = "How To Play";
diff --git a/Server/src/SOR.Website/Pages/Index.cshtml b/Server/src/SOR.Website/Pages/Index.cshtml
index 6f7dfca..f310a42 100644
--- a/Server/src/SOR.Website/Pages/Index.cshtml
+++ b/Server/src/SOR.Website/Pages/Index.cshtml
@@ -8,6 +8,15 @@
}
+ @if (!string.IsNullOrEmpty(Model.CdnBaseUrl))
+ {
+ @* Hero background sourced from CDN. Upload hero-bg.jpg to /website/ on the CDN to activate. *@
+
+ }
Aeternalis
Channel the Archspirits. Shape the mindscape. Fill the void with stars.
diff --git a/Server/src/SOR.Website/Pages/Index.cshtml.cs b/Server/src/SOR.Website/Pages/Index.cshtml.cs
index 7fecf27..e8cd045 100644
--- a/Server/src/SOR.Website/Pages/Index.cshtml.cs
+++ b/Server/src/SOR.Website/Pages/Index.cshtml.cs
@@ -1,8 +1,18 @@
namespace SOR.Website.Pages;
using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.Extensions.Configuration;
-public sealed class IndexModel : PageModel
+public sealed class IndexModel(IConfiguration config) : PageModel
{
- public void OnGet() { }
+ ///
+ /// CDN base URL for sourcing website art (hero image, etc.).
+ /// e.g. https://cdn.aeternalisgames.com
+ ///
+ public string CdnBaseUrl { get; private set; } = string.Empty;
+
+ public void OnGet()
+ {
+ CdnBaseUrl = config["Cdn:PublicBaseUrl"]?.TrimEnd('/') ?? string.Empty;
+ }
}
diff --git a/Server/src/SOR.Website/Pages/Leaderboard.cshtml b/Server/src/SOR.Website/Pages/Leaderboard.cshtml
index 0cb4ddb..2fc3b36 100644
--- a/Server/src/SOR.Website/Pages/Leaderboard.cshtml
+++ b/Server/src/SOR.Website/Pages/Leaderboard.cshtml
@@ -28,6 +28,9 @@
#
Channeler
Rank Score
+
Games Played
+
Games Won
+
Win Rate
@@ -42,7 +45,6 @@
@if (rank <= 3)
{
- @* Rank icons use plain text fallbacks — no image dependency *@
@rank
}
else
@@ -50,12 +52,14 @@
@rank
}
- @* DisplayName auto-encoded by Razor *@
@entry.DisplayName
@if (isSelf) { (you) }
@entry.RankScore
+
@entry.GamesPlayed
+
@entry.GamesWon
+
@entry.WinRateDisplay
}
diff --git a/Server/src/SOR.Website/Pages/Leaderboard.cshtml.cs b/Server/src/SOR.Website/Pages/Leaderboard.cshtml.cs
index 7737bee..41fdf6c 100644
--- a/Server/src/SOR.Website/Pages/Leaderboard.cshtml.cs
+++ b/Server/src/SOR.Website/Pages/Leaderboard.cshtml.cs
@@ -3,17 +3,20 @@ namespace SOR.Website.Pages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using SOR.Database.Contexts;
-using SOR.Database.Entities.Identity;
+using SOR.Database.Enums;
///
-/// Public leaderboard showing top ranked players.
+/// Public leaderboard showing top ranked players with win/loss stats.
///
/// Security controls:
-/// - Only exposes: DisplayName, RankScore. Never: Email, AccountId, or internal fields.
+/// - Only exposes: DisplayName, RankScore, GamesPlayed, GamesWon.
+/// Never: Email, AccountId, or internal fields.
/// - AI accounts and accounts hidden from leaderboard are excluded at query level.
/// - Pagination limits response size.
///
-public sealed class LeaderboardModel(SorIdentityDbContext identity) : PageModel
+public sealed class LeaderboardModel(
+ SorIdentityDbContext identity,
+ GameDbContext game) : PageModel
{
public const int PageSize = 50;
@@ -22,31 +25,88 @@ public sealed class LeaderboardModel(SorIdentityDbContext identity) : PageModel
public async Task OnGetAsync()
{
- // Only safe-to-display fields are projected — email and internal IDs are excluded.
- Entries = await identity.Users
+ // Step 1 — pull the top-ranked accounts (identity schema).
+ var accounts = await identity.Users
.Where(a => !a.IsAi && !a.IsHiddenFromLeaderboard)
.OrderByDescending(a => a.RankScore)
.Take(PageSize)
- .Select(a => new LeaderboardEntry
+ .Select(a => new { a.Id, a.DisplayName, a.RankScore })
+ .AsNoTracking()
+ .ToListAsync();
+
+ if (accounts.Count == 0)
+ {
+ Entries = [];
+ return;
+ }
+
+ var accountIds = accounts.Select(a => a.Id).ToHashSet();
+
+ // Step 2 — pull completed game sessions for those accounts (game schema).
+ // A session counts for a player if they appear in any seat.
+ // WinnerAccountId being in the set means they won that session.
+ var sessions = await game.GameSessions
+ .Where(s => s.Status == GameSessionStatus.Completed
+ && (accountIds.Contains(s.PlayerOneAccountId)
+ || accountIds.Contains(s.PlayerTwoAccountId)))
+ .Select(s => new
{
- DisplayName = a.DisplayName ?? "Channeler",
- RankScore = a.RankScore,
+ s.PlayerOneAccountId,
+ s.PlayerTwoAccountId,
+ s.WinnerAccountId,
})
.AsNoTracking()
.ToListAsync();
- // Current user's display name (to highlight their entry)
+ // Step 3 — aggregate wins and plays per account in memory.
+ var plays = new Dictionary();
+ var wins = new Dictionary();
+
+ foreach (var s in sessions)
+ {
+ foreach (var id in new[] { s.PlayerOneAccountId, s.PlayerTwoAccountId }
+ .Where(accountIds.Contains))
+ {
+ plays.TryGetValue(id, out var p);
+ plays[id] = p + 1;
+
+ if (s.WinnerAccountId == id)
+ {
+ wins.TryGetValue(id, out var w);
+ wins[id] = w + 1;
+ }
+ }
+ }
+
+ Entries = accounts
+ .Select(a =>
+ {
+ var played = plays.GetValueOrDefault(a.Id);
+ var won = wins.GetValueOrDefault(a.Id);
+ return new LeaderboardEntry
+ {
+ DisplayName = a.DisplayName ?? "Channeler",
+ RankScore = a.RankScore,
+ GamesPlayed = played,
+ GamesWon = won,
+ WinRate = played > 0 ? (double)won / played : 0,
+ };
+ })
+ .ToList();
+
if (User.Identity?.IsAuthenticated == true)
CurrentUserDisplayName = User.FindFirst("display_name")?.Value;
}
- ///
- /// Public-safe projection: only display name and rank score.
- /// Email, AccountId, and moderation state are intentionally excluded.
- ///
public sealed class LeaderboardEntry
{
public string DisplayName { get; init; } = string.Empty;
- public int RankScore { get; init; }
+ public int RankScore { get; init; }
+ public int GamesPlayed { get; init; }
+ public int GamesWon { get; init; }
+ public double WinRate { get; init; }
+
+ public string WinRateDisplay =>
+ GamesPlayed == 0 ? "—" : $"{WinRate:P0}";
}
}
diff --git a/Server/src/SOR.Website/Pages/News/Index.cshtml b/Server/src/SOR.Website/Pages/News/Index.cshtml
index 92e21ba..f64264f 100644
--- a/Server/src/SOR.Website/Pages/News/Index.cshtml
+++ b/Server/src/SOR.Website/Pages/News/Index.cshtml
@@ -2,6 +2,7 @@
@model IndexModel
@{
ViewData["Title"] = "News";
+ ViewData["MetaDescription"] = "Patch notes, set releases, and announcements from Aeternalis Games.";
}
@@ -12,8 +13,46 @@
-
-
News and patch notes are coming soon. Check back after launch.