Store hashed ips. Display unique ip count in catalog
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/dominicf2001/comfychan/internal/database"
|
||||
)
|
||||
|
||||
// 10 MB memory limit
|
||||
@@ -102,3 +103,11 @@ func SavePostFile(file *multipart.File, filename string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func SumUniquePostIps(posts []database.Post) int {
|
||||
uniqueIpHashes := map[string]bool{}
|
||||
for _, post := range posts {
|
||||
uniqueIpHashes[post.IpHash] = true
|
||||
}
|
||||
return len(uniqueIpHashes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user