Merge pull request #3028 from PrismLauncher/backport-3027-to-release-9.x

This commit is contained in:
Tayou 2024-10-29 23:15:22 +01:00 committed by GitHub
commit 23d6f8aaed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 17 deletions

View File

@ -74,12 +74,12 @@ void MSADeviceCodeStep::perform()
m_task->setAskRetry(false);
m_task->addNetAction(m_request);
connect(m_task.get(), &Task::finished, this, &MSADeviceCodeStep::deviceAutorizationFinished);
connect(m_task.get(), &Task::finished, this, &MSADeviceCodeStep::deviceAuthorizationFinished);
m_task->start();
}
struct DeviceAutorizationResponse {
struct DeviceAuthorizationResponse {
QString device_code;
QString user_code;
QString verification_uri;
@ -90,17 +90,17 @@ struct DeviceAutorizationResponse {
QString error_description;
};
DeviceAutorizationResponse parseDeviceAutorizationResponse(const QByteArray& data)
DeviceAuthorizationResponse parseDeviceAuthorizationResponse(const QByteArray& data)
{
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson(data, &err);
if (err.error != QJsonParseError::NoError) {
qWarning() << "Failed to parse device autorization response due to err:" << err.errorString();
qWarning() << "Failed to parse device authorization response due to err:" << err.errorString();
return {};
}
if (!doc.isObject()) {
qWarning() << "Device autorization response is not an object";
qWarning() << "Device authorization response is not an object";
return {};
}
auto obj = doc.object();
@ -111,9 +111,9 @@ DeviceAutorizationResponse parseDeviceAutorizationResponse(const QByteArray& dat
};
}
void MSADeviceCodeStep::deviceAutorizationFinished()
void MSADeviceCodeStep::deviceAuthorizationFinished()
{
auto rsp = parseDeviceAutorizationResponse(*m_response);
auto rsp = parseDeviceAuthorizationResponse(*m_response);
if (!rsp.error.isEmpty() || !rsp.error_description.isEmpty()) {
qWarning() << "Device authorization failed:" << rsp.error;
emit finished(AccountTaskState::STATE_FAILED_HARD,
@ -208,12 +208,12 @@ AuthenticationResponse parseAuthenticationResponse(const QByteArray& data)
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson(data, &err);
if (err.error != QJsonParseError::NoError) {
qWarning() << "Failed to parse device autorization response due to err:" << err.errorString();
qWarning() << "Failed to parse device authorization response due to err:" << err.errorString();
return {};
}
if (!doc.isObject()) {
qWarning() << "Device autorization response is not an object";
qWarning() << "Device authorization response is not an object";
return {};
}
auto obj = doc.object();
@ -274,4 +274,4 @@ void MSADeviceCodeStep::authenticationFinished()
m_data->msaToken.refresh_token = rsp.refresh_token;
m_data->msaToken.token = rsp.access_token;
emit finished(AccountTaskState::STATE_WORKING, tr("Got"));
}
}

View File

@ -58,7 +58,7 @@ class MSADeviceCodeStep : public AuthStep {
void authorizeWithBrowser(QString url, QString code, int expiresIn);
private slots:
void deviceAutorizationFinished();
void deviceAuthorizationFinished();
void startPoolTimer();
void authenticateUser();
void authenticationFinished();

View File

@ -132,9 +132,9 @@ class InstallJavaPage : public QWidget, public BasePage {
m_recommended_majors = majors;
recommendedFilterChanged();
}
void setRecomend(bool recomend)
void setRecommend(bool recommend)
{
m_recommend = recomend;
m_recommend = recommend;
recommendedFilterChanged();
}
void recommendedFilterChanged()
@ -202,7 +202,7 @@ InstallDialog::InstallDialog(const QString& uid, BaseInstance* instance, QWidget
recommendedCheckBox->setCheckState(Qt::CheckState::Checked);
connect(recommendedCheckBox, &QCheckBox::stateChanged, this, [this](int state) {
for (BasePage* page : container->getPages()) {
pageCast(page)->setRecomend(state == Qt::Checked);
pageCast(page)->setRecommend(state == Qt::Checked);
}
});
@ -261,7 +261,7 @@ InstallDialog::InstallDialog(const QString& uid, BaseInstance* instance, QWidget
container->selectPage(page->id());
auto cast = pageCast(page);
cast->setRecomend(true);
cast->setRecommend(true);
connect(cast, &InstallJavaPage::selectionChanged, this, [this, cast] { validate(cast); });
if (!recommendedJavas.isEmpty()) {
cast->setRecommendedMajors(recommendedJavas);
@ -344,4 +344,4 @@ void InstallDialog::done(int result)
} // namespace Java
#include "InstallJavaDialog.moc"
#include "InstallJavaDialog.moc"

View File

@ -4,7 +4,7 @@
<launchable type="desktop-id">org.prismlauncher.PrismLauncher.desktop</launchable>
<name>Prism Launcher</name>
<developer_name>Prism Launcher Contributors</developer_name>
<summary>A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once</summary>
<summary>Custom Minecraft Launcher to easily manage multiple Minecraft installations at once</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-only</project_license>
<url type="homepage">https://prismlauncher.org/</url>