Suiranoil / SkinRestorer

A server-side mod for restoring skins on offline servers.
https://www.curseforge.com/minecraft/mc-mods/skinrestorer
MIT License
26 stars 6 forks source link

"Failed to set skin" for the "web" subcommand #15

Closed lunatic-gh closed 8 months ago

lunatic-gh commented 8 months ago

When using the web sub-command (/skin set web slim ) it always says "Failed to set skin" in chat, and the console just logs following:

[13:58:18] [ForkJoinPool.commonPool-worker-3/ERROR]: Cannot get the skin for com.mojang.authlib.GameProfile@67b3d312[id=5b22ca46-9470-41f4-8c79-d54f29bf2e40,name=KianaGHG,properties={textures=[Property[name=textures, value=ewogICJ0aW1lc3RhbXAiIDogMTcwMTQzNTA4MDI4OSwKICAicHJvZmlsZUlkIiA6ICI1YjIyY2E0Njk0NzA0MWY0OGM3OWQ1NGYyOWJmMmU0MCIsCiAgInByb2ZpbGVOYW1lIiA6ICJLaWFuYUdIRyIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZGU0ZTU2Zjk1ZjRkN2Q5NmViYTVlYmE4YzE4NGNhMTlkMGExZjI3YmZhMmIzNzI1MjdjOTk3Zjg2NjljMGIwIgogICAgfSwKICAgICJDQVBFIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9mOWE3NjUzNzY0Nzk4OWY5YTBiNmQwMDFlMzIwZGFjNTkxYzM1OWU5ZTYxYTMxZjRjZTExYzg4ZjIwN2YwYWQ0IgogICAgfQogIH0KfQ==, signature=P9wEDaLoFTc+A61FB0QSZ01b7vwYxlgeRk0+qytN+p7rqu4plxzA4YrsGJbi5PVAUV/bwfQLlXaXOpJ+ar3fMEfODtzy9/uIRqwlIrUJ4ohIenF4O0ghM8xrhRZzC8AIn/FsN8k4ky8SZ0us0GsVsaP4PW/lMMh8HtqHxU+/qd1JZtC4YN1+1EEtT/2sOxA5hsDtvghpLOSobXNkxdDoGQfiGdmLlB8O6BeO6WycNkXcMXQ/mQ2fEC+Lwyt9GWBr9MFPTyCzd062Ow/TwrFrIYNX4iHGt2iXKqoEhF1tpgfwIy7rPiLhzHUGIjno6LasylzvQM3iUlyNsoZaqzxcR4r6GMjx9WBPPiX4K5yPPCuhQlXqmUonUzTHP/X51QJY6JsxFsRxbj850lufJd5LYKaYcHxbVd6e6w5tBmVp6nmYPhE2IwutML8SCPPqN80TRxPdHSrDVGUJSr3taiXDwsD9JaShMHIKTpShznxa84LsI0E/VN2Rdgba6VGW0xnZmx/5m/EdcGG4fp0GxUpGNHQh98LtzAg9N4mZZmx6nn16AgHi6azZz+CN8LR4geL5N+qzFi4a6TGIhfRgwx+JbYMlbWoFi9knztv38ODXr6jRcqahEZcyIN9Cawjw7y3fINOPgU/TPPoIbOVsGbFcUYA3ACABdIGHB5x0HNlJCf8=]]}]

decoding the "value" key from the property gives me a json object, showing my exact profile details (username, cape, etc), so it's not an issue with my profile itself.

edit: the subcommand "mojang" works fine for every existing username, only "web" doesn't.

NikolasPpd commented 8 months ago

Can you please provide the exact command that resulted in this error? I just tried the /skin set web classic "http://textures.minecraft.net/texture/long_string_of_characters" MyMinecraftUsername command as mentioned in #3 and it worked fine (for the URL I used the Texture URL of a skin I found on mineskin.org. You can also upload your own skins and use their Texture URL).

lunatic-gh commented 8 months ago

Very weird. Now it seems to work just fine with every skin i tried on namemc. Maybe it was just some temporary downtime or something, no idea.

xiaofeiTM233 commented 7 months ago

reappear on an offline server , 1.20.1 fabric server with skin-restorer-1.2.3 and an offline player (named Elysia) /skin set web slim "https://littleskin.cn/raw/322776" Elysia image log:[20:17:07 ERROR]: Cannot get the skin for com.mojang.authlib.GameProfile@49ccd7bc[id=f36c9363-7398-39fe-9357-e1cb09d136a5,name=Elysia,properties={textures=[com.mojang.authlib.properties.Property@69c31460]},legacy=false] but If I replace the url field for https://littleskin.cn/raw/153616 then it be ok image The source of the problem is unclear, and it can be repeats steadily

NikolasPpd commented 7 months ago

I tried opening the 1st URL on a browser an hour ago and it wouldn't load (got a Gateway time-out so it's probably a host error). The 2nd URL opened just fine.

A few minutes ago I tried again they both loaded. Now, only the 1st one loads and the other one throws an error.

So my guess would be that it's a problem of the skin hosting service rather than the SkinRestorer mod. You could try using mineskin.org instead.

xiaofeiTM233 commented 7 months ago

I tried opening the 1st URL on a browser an hour ago and it wouldn't load (got a Gateway time-out so it's probably a host error). The 2nd URL opened just fine.

But for my pc and server, I opened smoothly and could get files normally. @NikolasPpd Both https://littleskin.cn/raw/322776 and https://littleskin.cn/raw/153616

NikolasPpd commented 7 months ago

There were times when they both loaded fine on my computer and times when one of them wouldn't load. If it's a server issue (which I suspect it is), when you try to load a skin in-game and the server hosting the skin doesn't respond properly it won't work.

lunatic-gh commented 7 months ago

For me, it's also the 1st loading, the 2nd not loading. image

Yesterday when trying, both didn't load and showed a time-out.

On this case, i'd also assume it's an issue with the api of littleskin, if it's even using one, which doesn't seem to be the case.

xiaofeiTM233 commented 7 months ago

For me, it's also the 1st loading, the 2nd not loading.

By the way, this site is from China, so it has two CDN systems (for China / foreign), after local testing it turns out that their CDN is not on cloudflare.com but on ksyun.com, so I have a question, what is the process of obtaining files in web mode?

NikolasPpd commented 7 months ago

Judging from the code here https://github.com/Suiranoil/SkinRestorer/blob/1.20.2/src/main/java/net/lionarius/skinrestorer/MineskinSkinProvider.java and MineSkin's API docs https://rest.wiki/?https://api.mineskin.org/openapi.yml#, I think your client makes a request to MineSkin's API, which then tries to load the skin from the URL you provided so you can finally be able to load it in-game.

xiaofeiTM233 commented 7 months ago

I think your client makes a request to MineSkin's API, which then tries to load the skin from the URL you provided so you can finally be able to load it in-game.

Oh, I see. I'd like to get the skin files locally and transfer them through the server, can it be realized?

NikolasPpd commented 7 months ago

MineSkin does provide an endpoint to upload skin files directly but SkinRestorer only supports setting skins via URL. The easiest way to set custom skins would be to visit https://mineskin.org/, upload the skin you want image and when a window like this one pops up image copy the Texture URL and use that as the URL when setting your skin in-game.

xiaofeiTM233 commented 7 months ago

I mean can I save the skin file on the server of SkinRestorer and show it to other players through SkinRestorer when they need it? This way I don't have to worry about Failed to set skin, and I can just move the file to the server @NikolasPpd

NikolasPpd commented 7 months ago

Skimming through the mod's code and seeing its directory on my server, it seems like it stores skins locally on your Minecraft server so that it doesn't have to load them from a 3rd party every single time. Therefore you only have to load a skin once using the command and then it's cached inside your server's directory.

Keep in mind though that there's probably only one cached skin per player. Meaning that if you swap between multiple skins you need to use the /set command and provide a URL for the skin each time and only the skin you're currently using is being cached on the server (replacing any previous skin).

Silverteal commented 7 months ago

This mod may not provide the skin to the client directly. As I know, official client only allows skins from *.mojang.com or *.minecraft.net. This mod may just download "web" skin to the server and upload it to mineskin, and mineskin will upload it to mojang, and then it can provide mojang link in player's profile to every players' client.

Silverteal commented 7 months ago

This mod may not provide the skin to the client directly. As I know, official client only allows skins from *.mojang.com or *.minecraft.net. This mod may just download "web" skin to the server and upload it to mineskin, and mineskin will upload it to mojang, and then it can provide mojang link in player's profile to every players' client.

So, if the server could't connect to mojang api fluently, /skin set web might fail and sometimes skin can't be shown even it was correctly set. When client or server can't connect to mojang api, it of course can't correctly get or set skin.