Change code generator (#4)

* Change code generator
* Remove gin
This commit is contained in:
Jonas Plum
2022-01-08 00:48:44 +01:00
committed by GitHub
parent b5dd0cfacd
commit 8333ea88a8
148 changed files with 3077 additions and 23976 deletions

View File

@@ -5,20 +5,18 @@ import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
"github.com/SecurityBrewery/catalyst/ui"
)
func static(ctx *gin.Context) {
func static(w http.ResponseWriter, r *http.Request) {
fsys, _ := fs.Sub(ui.UI, "dist")
upath := strings.TrimPrefix(ctx.Request.URL.Path, "/")
upath := strings.TrimPrefix(r.URL.Path, "/")
if _, err := fs.Stat(fsys, upath); err != nil {
ctx.Request.URL.Path = "/"
ctx.Request.URL.RawPath = "/"
r.URL.Path = "/"
r.URL.RawPath = "/"
}
http.FileServer(http.FS(fsys)).ServeHTTP(ctx.Writer, ctx.Request)
http.FileServer(http.FS(fsys)).ServeHTTP(w, r)
}