dis: Rework styling and build procedure

This commit is contained in:
Tom Wiesing 2022-10-14 16:48:12 +02:00
parent 1e1d1a3cad
commit cdc7d69ad9
No known key found for this signature in database
51 changed files with 1251 additions and 339 deletions

View file

@ -6,8 +6,10 @@ import (
"embed"
"io/fs"
"net/http"
"strings"
"github.com/FAU-CDI/wisski-distillery/internal/component"
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
"github.com/tkw1536/goprogram/stream"
)
@ -25,6 +27,13 @@ func (static *Static) Handler(route string, context context.Context, io stream.I
return nil, err
}
// censor *.html in the filesystem
fs = fsx.Censor(fs, func(path string) bool {
suffix := "html"
return len(path) >= len(suffix) && strings.EqualFold(path[len(path)-len(suffix):], suffix)
})
// and serve it
return http.StripPrefix(route, http.FileServer(http.FS(fs))), nil
}