mirror of
https://github.com/elyby/chrly.git
synced 2025-01-10 22:02:04 +05:30
Added uuid normalization for mojang's uuid to textures request
This commit is contained in:
parent
20a8d90ad7
commit
bd13480175
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -86,7 +87,8 @@ func UsernamesToUuids(usernames []string) ([]*ProfileInfo, error) {
|
||||
// Obtains textures information for provided uuid
|
||||
// See https://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape
|
||||
func UuidToTextures(uuid string, signed bool) (*SignedTexturesResponse, error) {
|
||||
url := "https://sessionserver.mojang.com/session/minecraft/profile/" + uuid
|
||||
normalizedUuid := strings.ReplaceAll(uuid, "-", "")
|
||||
url := "https://sessionserver.mojang.com/session/minecraft/profile/" + normalizedUuid
|
||||
if signed {
|
||||
url += "?unsigned=false"
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ func TestUuidToTextures(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("obtain signed textures", func(t *testing.T) {
|
||||
t.Run("obtain signed textures with dashed uuid", func(t *testing.T) {
|
||||
assert := testify.New(t)
|
||||
|
||||
defer gock.Off()
|
||||
@ -230,7 +230,7 @@ func TestUuidToTextures(t *testing.T) {
|
||||
|
||||
HttpClient = client
|
||||
|
||||
result, err := UuidToTextures("4566e69fc90748ee8d71d7ba5aa00d20", true)
|
||||
result, err := UuidToTextures("4566e69f-c907-48ee-8d71-d7ba5aa00d20", true)
|
||||
if assert.NoError(err) {
|
||||
assert.Equal("4566e69fc90748ee8d71d7ba5aa00d20", result.Id)
|
||||
assert.Equal("Thinkofdeath", result.Name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user