皮肤静态资源提供
This commit is contained in:
parent
63ffeeffb7
commit
50234d7070
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user