Add favicon route
This commit is contained in:
BIN
src/favicon.ico
Normal file
BIN
src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -12,6 +12,7 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
app.Get("/ping", PingHandler)
|
app.Get("/ping", PingHandler)
|
||||||
|
app.Get("/favicon.ico", FaviconHandler)
|
||||||
app.Get("/list", ListHandler)
|
app.Get("/list", ListHandler)
|
||||||
app.Get("/skin/:uuid", SkinHandler)
|
app.Get("/skin/:uuid", SkinHandler)
|
||||||
app.Get("/face/:uuid", FaceHandler)
|
app.Get("/face/:uuid", FaceHandler)
|
||||||
@@ -29,6 +30,11 @@ func PingHandler(ctx *fiber.Ctx) error {
|
|||||||
return ctx.SendStatus(http.StatusOK)
|
return ctx.SendStatus(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FaviconHandler serves the favicon.ico file to any users that visit the API using a browser.
|
||||||
|
func FaviconHandler(ctx *fiber.Ctx) error {
|
||||||
|
return ctx.Type("ico").Send(favicon)
|
||||||
|
}
|
||||||
|
|
||||||
// ListHandler is the API handler used for the `/list` route.
|
// ListHandler is the API handler used for the `/list` route.
|
||||||
func ListHandler(ctx *fiber.Ctx) error {
|
func ListHandler(ctx *fiber.Ctx) error {
|
||||||
result := make([]string, 0)
|
result := make([]string, 0)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
@@ -16,6 +17,11 @@ import (
|
|||||||
"github.com/mineatar-io/skin-render"
|
"github.com/mineatar-io/skin-render"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
//go:embed favicon.ico
|
||||||
|
favicon []byte
|
||||||
|
)
|
||||||
|
|
||||||
// QueryParams is used by most all API routes as options for how the image should be rendered, or how errors should be handled.
|
// QueryParams is used by most all API routes as options for how the image should be rendered, or how errors should be handled.
|
||||||
type QueryParams struct {
|
type QueryParams struct {
|
||||||
Scale int `query:"scale"`
|
Scale int `query:"scale"`
|
||||||
|
|||||||
Reference in New Issue
Block a user