mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-08-01 17:56:02 +00:00
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:
@@ -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{},
|
||||
|
||||
Reference in New Issue
Block a user