Add favicon

This commit is contained in:
Gianni Carafa
2023-11-02 22:04:29 +01:00
parent c98e49f2b3
commit e748cb09a5
2 changed files with 11 additions and 0 deletions

BIN
cmd/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,6 +1,8 @@
package main package main
import ( import (
_ "embed"
"ladder/handlers" "ladder/handlers"
"log" "log"
"os" "os"
@@ -9,8 +11,12 @@ import (
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/basicauth" "github.com/gofiber/fiber/v2/middleware/basicauth"
"github.com/gofiber/fiber/v2/middleware/favicon"
) )
//go:embed favicon.ico
var faviconData string
func main() { func main() {
prefork, _ := strconv.ParseBool(os.Getenv("PREFORK")) prefork, _ := strconv.ParseBool(os.Getenv("PREFORK"))
@@ -30,6 +36,11 @@ func main() {
})) }))
} }
app.Use(favicon.New(favicon.Config{
Data: []byte(faviconData),
URL: "/favicon.ico",
}))
app.Get("/", handlers.Form) app.Get("/", handlers.Form)
app.Get("raw/*", handlers.Raw) app.Get("raw/*", handlers.Raw)
app.Get("api/*", handlers.Api) app.Get("api/*", handlers.Api)