修复材质提供路径

This commit is contained in:
xmdhs 2023-09-12 22:12:16 +08:00
parent 4ca9b70e4a
commit 5c590ac78f
No known key found for this signature in database
GPG Key ID: E809D6D43DEFCC95

View File

@ -8,7 +8,6 @@ import (
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
"strings"
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
@ -83,7 +82,6 @@ func (y *Yggdrasil) YggdrasilRoot() httprouter.Handle {
func (y *Yggdrasil) TextureAssets() httprouter.Handle { func (y *Yggdrasil) TextureAssets() httprouter.Handle {
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Set("Content-Type", "image/png") w.Header().Set("Content-Type", "image/png")
r.RequestURI = strings.TrimPrefix(r.RequestURI, "/texture/") http.StripPrefix("/texture/", http.FileServer(http.Dir(y.config.TexturePath))).ServeHTTP(w, r)
http.FileServer(http.Dir(y.config.TexturePath)).ServeHTTP(w, r)
} }
} }