last accessed at!!!
This commit is contained in:
+2
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user