diff --git a/Services/Admin/Pages/Assets/Index.cshtml b/Services/Admin/Pages/Assets/Index.cshtml
index 8d6e0bc..9e2f121 100644
--- a/Services/Admin/Pages/Assets/Index.cshtml
+++ b/Services/Admin/Pages/Assets/Index.cshtml
@@ -105,6 +105,26 @@ MINIO_BUCKET=downloads
@part
}
+
+
+
@@ -211,6 +231,17 @@ MINIO_BUCKET=downloads
}
+
+
}
diff --git a/Services/Admin/Pages/Assets/Index.cshtml.cs b/Services/Admin/Pages/Assets/Index.cshtml.cs
index 7f09065..0cff60e 100644
--- a/Services/Admin/Pages/Assets/Index.cshtml.cs
+++ b/Services/Admin/Pages/Assets/Index.cshtml.cs
@@ -322,4 +322,104 @@ public class IndexModel : AdminPageModel
var placeholderHash = md5.ComputeHash(placeholderBytes);
return Convert.ToHexString(placeholderHash).ToLower();
}
+
+ public async Task OnPostUploadFileAsync(IFormFile file, string? uploadPath)
+ {
+ if (file == null || file.Length == 0)
+ {
+ Message = "Please select a file to upload.";
+ IsError = true;
+ return RedirectToPage(new { tab = "browse", prefix = uploadPath });
+ }
+
+ // Sanitize and build the full path
+ var fileName = Path.GetFileName(file.FileName).Replace(" ", "_");
+ var fullPath = string.IsNullOrEmpty(uploadPath)
+ ? fileName
+ : $"{uploadPath.TrimEnd('/')}/{fileName}";
+
+ try
+ {
+ // Determine content type
+ var contentType = file.ContentType;
+ if (string.IsNullOrEmpty(contentType))
+ {
+ var ext = Path.GetExtension(fileName).ToLower();
+ contentType = ext switch
+ {
+ ".png" => "image/png",
+ ".jpg" or ".jpeg" => "image/jpeg",
+ ".gif" => "image/gif",
+ ".webp" => "image/webp",
+ ".tscn" => "text/plain",
+ ".gd" => "text/plain",
+ ".json" => "application/json",
+ _ => "application/octet-stream"
+ };
+ }
+
+ using var stream = file.OpenReadStream();
+ var success = await _cdnService.UploadFileAsync(fullPath, stream, contentType);
+
+ if (success)
+ {
+ Message = $"Uploaded: {fullPath}";
+ }
+ else
+ {
+ Message = "Upload failed. Check server logs.";
+ IsError = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ Message = $"Upload error: {ex.Message}";
+ IsError = true;
+ }
+
+ return RedirectToPage(new { tab = "browse", prefix = uploadPath });
+ }
+
+ public async Task OnPostDeleteCdnFileAsync(string filePath, string? returnPrefix)
+ {
+ if (string.IsNullOrEmpty(filePath))
+ {
+ Message = "File path is required.";
+ IsError = true;
+ return RedirectToPage(new { tab = "browse", prefix = returnPrefix });
+ }
+
+ try
+ {
+ var success = await _cdnService.DeleteFileAsync(filePath);
+
+ if (success)
+ {
+ // Also remove from tracking if exists
+ var tracked = await _db.ClientAssets.FirstOrDefaultAsync(a => a.FilePath == filePath);
+ if (tracked != null)
+ {
+ _db.ClientAssets.Remove(tracked);
+ await _db.SaveChangesAsync();
+ Message = $"Deleted from CDN and removed tracking: {filePath}";
+ }
+ else
+ {
+ Message = $"Deleted from CDN: {filePath}";
+ }
+ }
+ else
+ {
+ Message = "Delete failed. Check server logs.";
+ IsError = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ Message = $"Delete error: {ex.Message}";
+ IsError = true;
+ }
+
+ return RedirectToPage(new { tab = "browse", prefix = returnPrefix });
+ }
}
diff --git a/Services/Admin/Pages/Broadcast/Index.cshtml.cs b/Services/Admin/Pages/Broadcast/Index.cshtml.cs
index ed153d2..70f8533 100644
--- a/Services/Admin/Pages/Broadcast/Index.cshtml.cs
+++ b/Services/Admin/Pages/Broadcast/Index.cshtml.cs
@@ -31,12 +31,12 @@ public class IndexModel : AdminPageModel
{
try
{
- // Try to get connected player count from Redis
- var playerCount = await _redis.Db.StringGetAsync("server:player_count");
+ // Use correct Redis keys (stats:players and stats:dungeons)
+ var playerCount = await _redis.Db.StringGetAsync("stats:players");
if (playerCount.HasValue && int.TryParse(playerCount, out var count))
ConnectedPlayers = count;
- var dungeonCount = await _redis.Db.StringGetAsync("server:dungeon_count");
+ var dungeonCount = await _redis.Db.StringGetAsync("stats:dungeons");
if (dungeonCount.HasValue && int.TryParse(dungeonCount, out var dCount))
ActiveDungeons = dCount;
}
diff --git a/Services/Admin/Pages/Shared/_Layout.cshtml b/Services/Admin/Pages/Shared/_Layout.cshtml
index 25b81b2..a9259f7 100644
--- a/Services/Admin/Pages/Shared/_Layout.cshtml
+++ b/Services/Admin/Pages/Shared/_Layout.cshtml
@@ -4,7 +4,7 @@
- @ViewData["Title"] - Dungeon Divers Admin
+ @ViewData["Title"] - Void Scavengers Admin
+
@await RenderSectionAsync("Scripts", required: false)