Group domains belonging to the same owner when analyzing storage.

Resolves: https://codeberg.org/git-pages/git-pages/issues/239
This commit is contained in:
miyuko
2026-07-28 01:53:12 +02:00
committed by Catherine
parent 3332df668b
commit e02c8dd138
+6
View File
@@ -4,6 +4,8 @@ import (
"context"
"fmt"
"strings"
"golang.org/x/net/publicsuffix"
)
type StorageSize struct {
@@ -30,6 +32,10 @@ func AnalyzeStorage(ctx context.Context) ([]*StorageSize, error) {
thinStats := []*StorageSize{}
getStats := func(domain string) *storageData {
eTLDPlusOne, err := publicsuffix.EffectiveTLDPlusOne(domain)
if err == nil {
domain = eTLDPlusOne
}
if _, found := thickStats[domain]; !found {
thickStats[domain] = &storageData{
siteBlobs: map[string]int64{},