1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Move setupSsl to Utility namespace

This commit is contained in:
Joshua Goins 2023-12-17 13:05:37 -05:00
parent 68f76f63d4
commit df041144c5
5 changed files with 13 additions and 12 deletions

View file

@ -99,7 +99,6 @@ public:
// Networking misc.
void buildRequest(const Profile &settings, QNetworkRequest &request);
void setSSL(QNetworkRequest &request);
void setupIgnoreSSL(QNetworkReply *reply);
[[nodiscard]] bool isLoadingFinished() const;

View file

@ -12,4 +12,5 @@ QDir stateDirectory();
QString toWindowsPath(const QDir &dir);
void printRequest(const QString &type, const QNetworkRequest &request);
void createPathIfNeeded(const QDir &dir);
void setSSL(QNetworkRequest &request);
}

View file

@ -170,7 +170,7 @@ void LauncherCore::setAutoLoginProfile(Profile *profile)
void LauncherCore::buildRequest(const Profile &settings, QNetworkRequest &request)
{
setSSL(request);
Utility::setSSL(request);
if (settings.account()->license() == Account::GameLicense::macOS) {
request.setHeader(QNetworkRequest::UserAgentHeader, QByteArrayLiteral("macSQEXAuthor/2.0.0(MacOSX; ja-jp)"));
@ -186,15 +186,6 @@ void LauncherCore::buildRequest(const Profile &settings, QNetworkRequest &reques
request.setRawHeader(QByteArrayLiteral("Accept-Language"), QByteArrayLiteral("en-us"));
}
void LauncherCore::setSSL(QNetworkRequest &request)
{
QSslConfiguration config;
config.setProtocol(QSsl::AnyProtocol);
config.setPeerVerifyMode(QSslSocket::VerifyNone);
request.setSslConfiguration(config);
}
void LauncherCore::setupIgnoreSSL(QNetworkReply *reply)
{
Q_ASSERT(reply != nullptr);

View file

@ -271,7 +271,7 @@ QCoro::Task<bool> SquareEnixLogin::registerSession()
url.setPath(QStringLiteral("/http/win32/ffxivneo_release_game/%1/%2").arg(m_info->profile->baseGameVersion(), m_SID));
auto request = QNetworkRequest(url);
m_launcher.setSSL(request);
Utility::setSSL(request);
request.setRawHeader(QByteArrayLiteral("X-Hash-Check"), QByteArrayLiteral("enabled"));
request.setRawHeader(QByteArrayLiteral("User-Agent"), QByteArrayLiteral("FFXIV PATCH CLIENT"));
request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded"));

View file

@ -4,6 +4,7 @@
#include "utility.h"
#include "astra_http_log.h"
#include <QSslConfiguration>
#include <QStandardPaths>
using namespace Qt::StringLiterals;
@ -36,3 +37,12 @@ void Utility::createPathIfNeeded(const QDir &dir)
QDir().mkpath(dir.absolutePath());
}
}
void Utility::setSSL(QNetworkRequest &request)
{
QSslConfiguration config;
config.setProtocol(QSsl::AnyProtocol);
config.setPeerVerifyMode(QSslSocket::VerifyNone);
request.setSslConfiguration(config);
}