last accessed at!!!

This commit is contained in:
2026-11-14 14:25:13 -05:00
parent 2e63dcbf31
commit 507ff7359c
5 changed files with 90 additions and 6 deletions
+2 -1
View File
@@ -284,7 +284,7 @@ func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template) http.Handl
}
}
func contentHandler(db *gorm.DB, cfg Config) http.HandlerFunc {
func contentHandler(db *gorm.DB, cfg Config, tracker *AccessTracker) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
id, _, _ := strings.Cut(r.PathValue("id"), ".") // remove any extension via strings.Cut
@@ -323,6 +323,7 @@ func contentHandler(db *gorm.DB, cfg Config) http.HandlerFunc {
}
defer file.Close()
tracker.Record(id)
ttl := 600 // 10 minutes
if upload.ExpiresAt != nil {