slighty changed the backend rewrite for more performance and less buggy logging

This commit is contained in:
z1glr
2025-04-19 19:28:41 +00:00
parent cc4555f175
commit 9743632ecb

View File

@@ -136,13 +136,15 @@ func init() {
app.Use(func(c *fiber.Ctx) error {
path := c.Path()
// if it is for the api, don't try to add the html extension
if path[1:4] != "dev" {
// check, wether a html-file exists for the path
if _, err := os.Stat(filepath.Join("html", path)); errors.Is(err, os.ErrNotExist) {
htmlPath := path + ".html"
if _, err := os.Stat(filepath.Join("html", htmlPath)); err == nil {
c.Path(htmlPath)
} else {
logger.Debug().Msgf("%q", err)
}
}
}