mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Немного реструктуризации
Добавлен роут для смены скина
This commit is contained in:
@@ -1,33 +1,35 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"github.com/gorilla/mux"
|
||||
"log"
|
||||
"elyby/minecraft-skinsystem/lib/structures"
|
||||
"net/http"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"elyby/minecraft-skinsystem/lib/data"
|
||||
"elyby/minecraft-skinsystem/lib/tools"
|
||||
)
|
||||
|
||||
func GetTextures(w http.ResponseWriter, r *http.Request) {
|
||||
func Textures(w http.ResponseWriter, r *http.Request) {
|
||||
username := tools.ParseUsername(mux.Vars(r)["username"])
|
||||
log.Println("request textures for username " + username)
|
||||
|
||||
rec, err := tools.FindRecord(username)
|
||||
rec, err := data.FindRecord(username)
|
||||
if (err != nil || rec.SkinId == 0) {
|
||||
rec.Url = "http://skins.minecraft.net/MinecraftSkins/" + username + ".png"
|
||||
rec.Hash = string(tools.BuildNonElyTexturesHash(username))
|
||||
}
|
||||
|
||||
textures := structures.TexturesResponse{
|
||||
Skin: &structures.Skin{
|
||||
textures := data.TexturesResponse{
|
||||
Skin: &data.Skin{
|
||||
Url: rec.Url,
|
||||
Hash: rec.Hash,
|
||||
},
|
||||
}
|
||||
|
||||
if (rec.IsSlim) {
|
||||
textures.Skin.Metadata = &structures.SkinMetadata{
|
||||
textures.Skin.Metadata = &data.SkinMetadata{
|
||||
Model: "slim",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user