Skip to content

Commit

Permalink
fix compile error with older Qt 5.9 (mrkite#374)
Browse files Browse the repository at this point in the history
* fix mojang api url for playername query

the old url is deprecated (stopped service)

* parse Mojang API for player skin

and use that skin as icon in menu

* fix compile error with older Qt 5.9
  • Loading branch information
EtlamGit authored Nov 21, 2023
1 parent cd82e3a commit 133027c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions minutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,15 +906,15 @@ void Minutor::updatePlayerCache(QNetworkReply * reply) {
if (reply->request().url().toString().contains("sessionserver.mojang.com")) {
QJsonDocument json = QJsonDocument::fromJson(response);
if (!json.isEmpty() && json.object().contains("name")) {
QString playerName = json["name"].toString();
QString playerName = json.object().value("name").toString();
// reconstruct player UUID
QString playerUUID = pendingNetworkAccess[reply];
// store in player cache
QSettings settings;
settings.setValue("PlayerCache/"+playerUUID+"/name", playerName);

// get URL to skin texture
QString value = json["properties"][0]["value"].toString();
QString value = json.object().value("properties").toArray()[0].toObject().value("value").toString();
QJsonDocument vjson = QJsonDocument::fromJson(QByteArray::fromBase64(value.toUtf8()));
if (!vjson.isEmpty()) {
QString url = vjson.object()["textures"].toObject()["SKIN"].toObject()["url"].toString();
Expand Down

0 comments on commit 133027c

Please sign in to comment.