@@ -45,6 +45,7 @@ import (
4545 "github.com/Defacto2/server/model/fix"
4646 "github.com/aarondl/null/v8"
4747 "github.com/aarondl/sqlboiler/v4/boil"
48+ "github.com/dustin/go-humanize"
4849 "github.com/google/uuid"
4950 "github.com/gorilla/sessions"
5051 "github.com/labstack/echo-contrib/session"
@@ -682,9 +683,10 @@ func downloader(data map[string]any, conf config.Config) map[string]any {
682683 data ["usageDownloads" ] = 0
683684 data ["extsDownloads" ] = []helper.Extension {}
684685 if check == nil {
685- data ["countDownloads" ], _ = helper .Count (string (conf .AbsDownload ))
686+ c , _ := helper .Count (string (conf .AbsDownload ))
687+ data ["countDownloads" ] = humanize .Comma (int64 (c ))
686688 b , _ := helper .DiskUsage (string (conf .AbsDownload ))
687- data ["usageDownloads" ] = helper .ByteCount (b )
689+ data ["usageDownloads" ] = helper .ByteCountFloat (b )
688690 exts , _ := helper .CountExts (string (conf .AbsDownload ))
689691 data ["extsDownloads" ] = exts
690692 }
@@ -699,9 +701,10 @@ func previewer(data map[string]any, conf config.Config) map[string]any {
699701 data ["usagePreviews" ] = 0
700702 data ["extsPreviews" ] = []helper.Extension {}
701703 if check == nil {
702- data ["countPreviews" ], _ = helper .Count (conf .AbsPreview .String ())
704+ c , _ := helper .Count (conf .AbsPreview .String ())
705+ data ["countPreviews" ] = humanize .Comma (int64 (c ))
703706 b , _ := helper .DiskUsage (string (conf .AbsPreview ))
704- data ["usagePreviews" ] = helper .ByteCount (b )
707+ data ["usagePreviews" ] = helper .ByteCountFloat (b )
705708 exts , _ := helper .CountExts (conf .AbsPreview .String ())
706709 data ["extsPreviews" ] = exts
707710 }
@@ -716,9 +719,10 @@ func thumbnailer(data map[string]any, conf config.Config) map[string]any {
716719 data ["usageThumbnails" ] = 0
717720 data ["extsThumbnails" ] = []helper.Extension {}
718721 if check == nil {
719- data ["countThumbnails" ], _ = helper .Count (conf .AbsThumbnail .String ())
722+ c , _ := helper .Count (conf .AbsThumbnail .String ())
723+ data ["countThumbnails" ] = humanize .Comma (int64 (c ))
720724 b , _ := helper .DiskUsage (string (conf .AbsThumbnail ))
721- data ["usageThumbnails" ] = helper .ByteCount (b )
725+ data ["usageThumbnails" ] = helper .ByteCountFloat (b )
722726 exts , _ := helper .CountExts (conf .AbsThumbnail .String ())
723727 data ["extsThumbnails" ] = exts
724728 }
@@ -733,9 +737,10 @@ func extraer(data map[string]any, conf config.Config) map[string]any {
733737 data ["usageExtras" ] = 0
734738 data ["extsExtras" ] = []helper.Extension {}
735739 if check == nil {
736- data ["countExtras" ], _ = helper .Count (conf .AbsExtra .String ())
740+ c , _ := helper .Count (conf .AbsExtra .String ())
741+ data ["countExtras" ] = humanize .Comma (int64 (c ))
737742 b , _ := helper .DiskUsage (string (conf .AbsExtra ))
738- data ["usageExtras" ] = helper .ByteCount (b )
743+ data ["usageExtras" ] = helper .ByteCountFloat (b )
739744 exts , _ := helper .CountExts (conf .AbsExtra .String ())
740745 data ["extsExtras" ] = exts
741746 }
@@ -750,9 +755,10 @@ func orphaneder(data map[string]any, conf config.Config) map[string]any {
750755 data ["usageOrphaned" ] = 0
751756 data ["extsOrphaned" ] = []helper.Extension {}
752757 if check == nil {
753- data ["countOrphaned" ], _ = helper .Count (conf .AbsOrphaned .String ())
758+ c , _ := helper .Count (conf .AbsOrphaned .String ())
759+ data ["countOrphaned" ] = humanize .Comma (int64 (c ))
754760 b , _ := helper .DiskUsage (string (conf .AbsOrphaned ))
755- data ["usageOrphaned" ] = helper .ByteCount (b )
761+ data ["usageOrphaned" ] = helper .ByteCountFloat (b )
756762 exts , _ := helper .CountExts (conf .AbsOrphaned .String ())
757763 data ["extsOrphaned" ] = exts
758764 }
0 commit comments