moved styles css from main to handlers

This commit is contained in:
ladddder
2023-12-05 16:39:30 +01:00
parent 7fd2b2b3c3
commit eef6061d93
4 changed files with 26 additions and 313 deletions

View File

@@ -1,7 +1,7 @@
package main
import (
"embed"
_ "embed"
"fmt"
"html/template"
"log"
@@ -16,9 +16,6 @@ import (
"github.com/gofiber/template/html/v2"
)
//go:embed styles.css
var cssData embed.FS
//go:embed VERSION
var version string
@@ -155,19 +152,8 @@ func main() {
app.Get("/", handlers.Form)
app.Get("/styles.css", func(c *fiber.Ctx) error {
cssData, err := cssData.ReadFile("styles.css")
if err != nil {
return c.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
}
c.Set("Content-Type", "text/css")
return c.Send(cssData)
})
app.Get("/script.js", handlers.Script)
app.Get("styles.css", handlers.Styles)
app.Get("script.js", handlers.Script)
app.Get("ruleset", handlers.Ruleset)
app.Get("raw/*", handlers.Raw)