From ccb5fc6f4ab09fac602f268f36d077a42aaef1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 28 Sep 2015 22:43:57 +0200 Subject: [PATCH] GH-1072 use crafatar for grabbing the user skin --- application/MainWindow.cpp | 8 ++++---- application/pages/global/AccountListPage.cpp | 4 ++-- logic/minecraft/SkinUtils.h | 2 +- logic/net/URLConstants.cpp | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 4ba717d3..a3a62f30 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -548,9 +548,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi { for (auto profile : account->profiles()) { - auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png"); + auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); auto action = CacheDownload::make( - QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta); + QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta); skin_dls.append(action); meta->stale = true; } @@ -775,7 +775,7 @@ void MainWindow::repopulateAccountsMenu() action->setChecked(true); } - action->setIcon(SkinUtils::getFaceFromCache(profile.name)); + action->setIcon(SkinUtils::getFaceFromCache(profile.id)); accountMenu->addAction(action); connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount())); } @@ -834,7 +834,7 @@ void MainWindow::activeAccountChanged() const AccountProfile *profile = account->currentProfile(); if (profile != nullptr) { - accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->name)); + accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->id)); accountMenuButton->setText(profile->name); return; } diff --git a/application/pages/global/AccountListPage.cpp b/application/pages/global/AccountListPage.cpp index 7ca7e414..62267f13 100644 --- a/application/pages/global/AccountListPage.cpp +++ b/application/pages/global/AccountListPage.cpp @@ -129,9 +129,9 @@ void AccountListPage::addAccount(const QString &errMsg) for (AccountProfile profile : account->profiles()) { - auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png"); + auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); auto action = CacheDownload::make( - QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta); + QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta); job->addNetAction(action); meta->stale = true; } diff --git a/logic/minecraft/SkinUtils.h b/logic/minecraft/SkinUtils.h index 5584bf6c..5f5b1897 100644 --- a/logic/minecraft/SkinUtils.h +++ b/logic/minecraft/SkinUtils.h @@ -21,5 +21,5 @@ namespace SkinUtils { -QPixmap MULTIMC_LOGIC_EXPORT getFaceFromCache(QString username, int height = 64, int width = 64); +QPixmap MULTIMC_LOGIC_EXPORT getFaceFromCache(QString id, int height = 64, int width = 64); } diff --git a/logic/net/URLConstants.cpp b/logic/net/URLConstants.cpp index b6c78610..85224767 100644 --- a/logic/net/URLConstants.cpp +++ b/logic/net/URLConstants.cpp @@ -8,7 +8,8 @@ const QString AWS_DOWNLOAD_INDEXES(AWS_DOWNLOAD_BASE + "indexes/"); const QString ASSETS_BASE("assets.minecraft.net/"); const QString RESOURCE_BASE("resources.download.minecraft.net/"); const QString LIBRARY_BASE("libraries.minecraft.net/"); -const QString SKINS_BASE("skins.minecraft.net/MinecraftSkins/"); +//const QString SKINS_BASE("skins.minecraft.net/MinecraftSkins/"); +const QString SKINS_BASE("crafatar.com/skins/"); const QString AUTH_BASE("authserver.mojang.com/"); const QString FORGE_LEGACY_URL("http://files.minecraftforge.net/minecraftforge/json"); const QString @@ -20,4 +21,4 @@ const QString IMGUR_BASE_URL("https://api.imgur.com/3/"); const QString FMLLIBS_OUR_BASE_URL("http://files.multimc.org/fmllibs/"); const QString FMLLIBS_FORGE_BASE_URL("http://files.minecraftforge.net/fmllibs/"); const QString TRANSLATIONS_BASE_URL("http://files.multimc.org/translations/"); -} \ No newline at end of file +}