mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
- Must be explicitly enabled for a request
- Uses Retry-After Header if present, falls back to exponential back off
starting with 10 seconds
- if retry delay is greater than 1 minute or it retries more than 3
times then fail with a "Rate Limited" reason
- Sets task status to inform user of retry.
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
(cherry picked from commit e8da9ee4fb)
37 lines
898 B
C++
37 lines
898 B
C++
|
|
#include "GetSkinStep.h"
|
|
|
|
#include <QNetworkRequest>
|
|
|
|
#include "Application.h"
|
|
|
|
GetSkinStep::GetSkinStep(AccountData* data) : AuthStep(data) {}
|
|
|
|
QString GetSkinStep::describe()
|
|
{
|
|
return tr("Getting skin.");
|
|
}
|
|
|
|
void GetSkinStep::perform()
|
|
{
|
|
QUrl url(m_data->minecraftProfile.skin.url);
|
|
|
|
m_response.reset(new QByteArray());
|
|
m_request = Net::Download::makeByteArray(url, m_response);
|
|
m_request->enableAutoRetry(true);
|
|
|
|
m_task.reset(new NetJob("GetSkinStep", APPLICATION->network()));
|
|
m_task->setAskRetry(false);
|
|
m_task->addNetAction(m_request);
|
|
|
|
connect(m_task.get(), &Task::finished, this, &GetSkinStep::onRequestDone);
|
|
|
|
m_task->start();
|
|
}
|
|
|
|
void GetSkinStep::onRequestDone()
|
|
{
|
|
if (m_request->error() == QNetworkReply::NoError)
|
|
m_data->minecraftProfile.skin.data = *m_response;
|
|
emit finished(AccountTaskState::STATE_WORKING, tr("Got skin"));
|
|
}
|