fix: show uncompressed size in stats

also renamed variables to make it more readable
This commit is contained in:
2026-06-14 12:40:19 -04:00
parent c6ba7b2ea9
commit 61efbf8b04
3 changed files with 9 additions and 9 deletions
@@ -81,11 +81,11 @@
<p <p
class="text-2xl font-bold" class="text-2xl font-bold"
use:tooltip={[ use:tooltip={[
`${stats.pastes.trueTotalSizeInBytes != stats.pastes.totalSizeInBytes ? `Uncompressed Size: ${formatBytes(stats.pastes.trueTotalSizeInBytes)}` : ''}`, `${stats.pastes.totalStoredSizeInBytes != stats.pastes.totalOriginalSizeInBytes ? `Uncompressed Size: ${formatBytes(stats.pastes.totalOriginalSizeInBytes)}` : ''}`,
true true
]} ]}
> >
{formatBytes(stats.pastes.totalSizeInBytes)} {formatBytes(stats.pastes.totalStoredSizeInBytes)}
</p> </p>
</div> </div>
</div> </div>
@@ -224,9 +224,9 @@ namespace SharpbinV3.Server.Controllers
private async Task<IActionResult> BuildUserResponse(User user, int page = 1) private async Task<IActionResult> BuildUserResponse(User user, int page = 1)
{ {
var isAuthenticatedUser = HttpContext.User?.FindFirst("uuid")?.Value == user.UUID.ToString(); var isRequestedUser = HttpContext.User?.FindFirst("uuid")?.Value == user.UUID.ToString();
var pasteQuery = _db.Pastes.AsNoTracking().Where(p => p.AuthorUUID == user.UUID); var pasteQuery = _db.Pastes.AsNoTracking().Where(p => p.AuthorUUID == user.UUID);
if (!isAuthenticatedUser) if (!isRequestedUser)
{ {
if (user.Visibility == Visibility.Private && (!user.Roles.HasFlag(Role.Admin) || !user.Roles.HasFlag(Role.Moderator))) if (user.Visibility == Visibility.Private && (!user.Roles.HasFlag(Role.Admin) || !user.Roles.HasFlag(Role.Moderator)))
return NotFound(); return NotFound();
@@ -270,7 +270,7 @@ namespace SharpbinV3.Server.Controllers
TotalPages = totalPages, TotalPages = totalPages,
}; };
if (isAuthenticatedUser) if (isRequestedUser)
{ {
var reports = await _reportService.GetReports( var reports = await _reportService.GetReports(
new ReportQuery new ReportQuery
+4 -4
View File
@@ -332,8 +332,8 @@ namespace SharpbinV3.Server
var pasteCount = await db.Pastes.CountAsync(); var pasteCount = await db.Pastes.CountAsync();
var userCount = await db.Users.CountAsync(); var userCount = await db.Users.CountAsync();
var totalPasteSize = await db.Pastes.SumAsync(p => p.StoredSize); var totalStoredSize = await db.Pastes.SumAsync(p => p.StoredSize);
var trueTotalPasteSize = await db.Pastes.SumAsync(p => p.OriginalSize); var totalOriginalSize = await db.Pastes.SumAsync(p => p.OriginalSize);
var dailyCounts = await db var dailyCounts = await db
.Pastes.Where(p => p.CreatedAt >= sevenDaysAgo) .Pastes.Where(p => p.CreatedAt >= sevenDaysAgo)
@@ -363,8 +363,8 @@ namespace SharpbinV3.Server
{ {
total = pasteCount, total = pasteCount,
past7Days = pasteCountWeek, past7Days = pasteCountWeek,
totalSizeInBytes = totalPasteSize, totalStoredSizeInBytes = totalStoredSize,
trueTotalSizeInBytes = trueTotalPasteSize, totalOriginalSizeInBytes = totalOriginalSize,
daily = dailyStats, daily = dailyStats,
}, },
users = new { total = userCount }, users = new { total = userCount },