Only rate limit uploads

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-08-01 04:14:52 +03:00
parent bee5e4ce20
commit 8d94b58bd8

View File

@@ -235,13 +235,13 @@ func main() {
flag.BoolVar(&useHTTPS, "https", false, "use https:// in generated URLs") flag.BoolVar(&useHTTPS, "https", false, "use https:// in generated URLs")
flag.Parse() flag.Parse()
http.HandleFunc("/", rateLimitMiddleware(func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodPost { if r.Method == http.MethodPost {
uploadHandler(w, r) rateLimitMiddleware(uploadHandler)(w, r)
} else { } else {
viewHandler(w, r) viewHandler(w, r)
} }
})) })
fmt.Printf("slenpaste running at http://%s, storing in %s\n", listenAddr, staticDir) fmt.Printf("slenpaste running at http://%s, storing in %s\n", listenAddr, staticDir)
http.ListenAndServe(listenAddr, nil) http.ListenAndServe(listenAddr, nil)