mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-04-28 08:49:46 -05:00
25 lines
483 B
Go
25 lines
483 B
Go
package widget
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"log/slog"
|
|
"net/http"
|
|
|
|
"github.com/PrivateCaptcha/PrivateCaptcha/pkg/common"
|
|
)
|
|
|
|
//go:embed static
|
|
var staticFiles embed.FS
|
|
|
|
func Static() http.HandlerFunc {
|
|
sub, _ := fs.Sub(staticFiles, "static")
|
|
srv := http.FileServer(http.FS(sub))
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
slog.DebugContext(r.Context(), "Static request", "path", r.URL.Path)
|
|
common.WriteHeaders(w, common.CachedHeaders)
|
|
srv.ServeHTTP(w, r)
|
|
}
|
|
}
|