added revalidate cache feature

This commit is contained in:
2025-11-20 15:41:00 +01:00
parent ff2cb2335c
commit 34f55eccf0
4 changed files with 171 additions and 2 deletions

31
internal/hasher.go Normal file
View File

@@ -0,0 +1,31 @@
package steamimmich
import (
"crypto/sha1"
"fmt"
"io"
"os"
)
func hashFiles(assets []AssetState) (map[int]string, error) {
results := make(map[int]string)
for i, p := range assets {
f, err := os.Open(p.FilePath)
if err != nil {
results[i] = ""
continue
}
h := sha1.New()
if _, err := io.Copy(h, f); err != nil {
f.Close()
return nil, err
}
f.Close()
results[i] = fmt.Sprintf("%x", h.Sum(nil))
}
return results, nil
}