Complete move to IndexedDB

This commit is contained in:
“bobbydigitales”
2023-11-14 00:12:39 -08:00
parent 41054a5dbf
commit b07a93246f
10 changed files with 560 additions and 175 deletions

View File

@@ -55,9 +55,16 @@ func (lh *LoggingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// noDirListing wraps an http.FileServer handler to prevent directory listings
func noDirListing(h http.Handler, root string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Serve index.html when root is requested
if r.URL.Path == "/" {
http.ServeFile(w, r, filepath.Join(root, "index.html"))
return
}
// Check if the path is a directory
path := filepath.Join(root, r.URL.Path)
if info, err := os.Stat(path); err == nil && info.IsDir() {
http.NotFound(w, r) // Always return 404 for directories
http.NotFound(w, r) // Return 404 for directories other than root
return
}
h.ServeHTTP(w, r)