feat: Refactor admin UI pages to support embedded mode and improve navigation

- Updated PlayerLogs, Players, Reports, Rooms, Settings, SignupCodes, and other pages to accept an optional `embedded` prop for better integration in various contexts.
- Introduced a new Activity page consolidating audit logs and player request logs with tab navigation.
- Added Content page for community board and loading tips with tab navigation.
- Created Moderation page to unify player directory, bans, and reports under a single interface.
- Implemented SettingsHome page to manage server settings and signup codes with tab navigation.
- Enhanced the Join page to include password creation for new accounts.
- Added global friends feature in Settings to allow all accounts to be friends without database entries.
- Introduced RelationshipQueries service to manage effective friend resolution based on global friends toggle.
- Added WireDates for consistent date handling in serialized data.
- Created reusable Tabs component for consistent tab navigation across various pages.
This commit is contained in:
Alexa
2026-06-06 16:39:19 +03:00
parent 34506e8294
commit 955246c6e4
41 changed files with 4129 additions and 2057 deletions
+14 -3
View File
@@ -174,13 +174,21 @@ public class PlayerService(DorkNetDbContext db, RoomService rooms, ILogger<Playe
// Self-heal: if the row exists but the bookkeeping fields
// drift (e.g. someone manually edited Username), restore them
// so admin tools always show "Coach" as the owner.
if (existing.Username != SystemAccountUsername || existing.DisplayName != SystemAccountUsername)
var nameDrift = existing.Username != SystemAccountUsername
|| existing.DisplayName != SystemAccountUsername;
// Heal a legacy year-9999 BannedUntil written before WireDates:
// such a value corrupts the watch's local-timezone date parse if it
// ever reaches a client (e.g. via /api/playersbanned). See WireDates.
var banDrift = existing.BannedUntil.HasValue
&& existing.BannedUntil.Value > WireDates.FarFuture;
if (nameDrift || banDrift)
{
await db.Players
.Where(p => p.Id == SystemAccountId)
.ExecuteUpdateAsync(s => s
.SetProperty(p => p.Username, SystemAccountUsername)
.SetProperty(p => p.DisplayName, SystemAccountUsername));
.SetProperty(p => p.DisplayName, SystemAccountUsername)
.SetProperty(p => p.BannedUntil, WireDates.FarFuture));
}
return;
}
@@ -204,7 +212,10 @@ public class PlayerService(DorkNetDbContext db, RoomService rooms, ILogger<Playe
// Far-future ban as a hard authorization backstop in case a
// forged JWT ever names player 1 as the subject. BanCheckMiddleware
// refuses any authenticated request when BannedUntil > now.
BannedUntil = new DateTime(9999, 12, 31, 0, 0, 0, DateTimeKind.Utc),
// WireDates.FarFuture (2099), NOT year 9999 — a 9999 BannedUntil
// serialised to the watch overflows its local-timezone date parse
// in some DST timezones and corrupts the response. See WireDates.
BannedUntil = WireDates.FarFuture,
PasswordHash = null,
CreatedAt = new DateTime(2020, 3, 6, 0, 0, 0, DateTimeKind.Utc),
LastSeenAt = new DateTime(2020, 3, 6, 0, 0, 0, DateTimeKind.Utc),