feat: public API, SEO and existing surfaces

This commit is contained in:
Florian Sylvain committed 2026-11-03 03:58:10 +01:00
1 parent 45fbbc33b1
commit c390fcfe8d
103 files changed
+4476 -231

No files matched your search

@@ -8,6 +8,7 @@ import (
"RenewCMS/internal/domain/image"
"RenewCMS/internal/domain/site"
"RenewCMS/internal/domain/user"
"maps"
"slices"
"strings"
)
@@ -160,11 +161,11 @@ func (l *ListMediaUseCase) articleUsageCount(img image.Image) (int, error) {
if err != nil {
return 0, err
}
distinct := map[uint32]bool{}
distinct := map[uint32]article.Article{}
for _, found := range slices.Concat(inBody, referencing) {
distinct[found.ID] = true
distinct[found.ID] = found
}
return len(distinct), nil
return distinctArticleCount(slices.Collect(maps.Values(distinct))), nil
}
func (l *ListMediaUseCase) usageCounter() (func(image.Image) int, error) {
@@ -177,13 +178,13 @@ func (l *ListMediaUseCase) usageCounter() (func(image.Image) int, error) {
return nil, err
}
return func(img image.Image) int {
used := siteUsage[img.ID]
mentioning := []article.Article{}
for _, a := range articles {
if articleMentionsImage(a, img) {
used++
mentioning = append(mentioning, a)
}
}
return used
return siteUsage[img.ID] + distinctArticleCount(mentioning)
}, nil
}