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
+9 -1
View File
@@ -1,6 +1,7 @@
package main
import (
"context"
"errors"
"html/template"
"log"
@@ -78,6 +79,13 @@ func main() {
}
}
tracker := &AccessTracker{
pending: make(map[string]int64),
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go tracker.Run(ctx, db)
mux := http.NewServeMux()
fs := http.FileServer(http.Dir("static"))
mux.Handle("GET /css/", fs)
@@ -110,7 +118,7 @@ func main() {
"Host": config.Host,
})
})
mux.HandleFunc("GET /{id}", contentHandler(db, config))
mux.HandleFunc("GET /{id}", contentHandler(db, config, tracker))
mux.HandleFunc("POST /upload", uploadHandler(db, config, pages))
mux.HandleFunc("PUT /upload", uploadHandler(db, config, pages))
mux.HandleFunc("DELETE /{id}", deleteHandler(db, config))