diff --git a/handle/yggdrasil/yggdrasil.go b/handle/yggdrasil/yggdrasil.go index 7232258..7dacc00 100644 --- a/handle/yggdrasil/yggdrasil.go +++ b/handle/yggdrasil/yggdrasil.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "net/url" + "strings" "github.com/go-playground/validator/v10" "github.com/julienschmidt/httprouter" @@ -78,3 +79,11 @@ func (y *Yggdrasil) YggdrasilRoot() httprouter.Handle { } } + +func (y *Yggdrasil) TextureAssets() httprouter.Handle { + return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { + w.Header().Set("Content-Type", "image/png") + r.RequestURI = strings.TrimPrefix(r.RequestURI, "/texture/") + http.FileServer(http.Dir(y.config.TexturePath)).ServeHTTP(w, r) + } +} diff --git a/server/route/route.go b/server/route/route.go index 1e02075..9dcf8f7 100644 --- a/server/route/route.go +++ b/server/route/route.go @@ -40,6 +40,8 @@ func newYggdrasil(r *httprouter.Router, handelY yggdrasil.Yggdrasil) error { r.POST("/api/yggdrasil/minecraftservices/player/certificates", warpHJSON(handelY.PlayerCertificates())) r.GET("/api/yggdrasil", warpHJSON(handelY.YggdrasilRoot())) + + r.GET("/texture/*filepath", handelY.TextureAssets()) return nil }