diff --git a/launcher/config.kcfg b/launcher/config.kcfg
index 7714bb5..2da48f3 100644
--- a/launcher/config.kcfg
+++ b/launcher/config.kcfg
@@ -32,6 +32,9 @@ SPDX-License-Identifier: CC0-1.0
square-enix.com
+
+ https
+
diff --git a/launcher/include/launchercore.h b/launcher/include/launchercore.h
index 7f2f544..fe30fce 100755
--- a/launcher/include/launchercore.h
+++ b/launcher/include/launchercore.h
@@ -71,6 +71,7 @@ class LauncherCore : public QObject
Q_PROPERTY(QString dalamudDistribServer READ dalamudDistribServer WRITE setDalamudDistribServer NOTIFY dalamudDistribServerChanged)
Q_PROPERTY(QString squareEnixServer READ squareEnixServer WRITE setSquareEnixServer NOTIFY squareEnixServerChanged)
Q_PROPERTY(QString squareEnixLoginServer READ squareEnixLoginServer WRITE setSquareEnixLoginServer NOTIFY squareEnixLoginServerChanged)
+ Q_PROPERTY(QString preferredProtocol READ preferredProtocol WRITE setPreferredProtocol NOTIFY preferredProtocolChanged)
Q_PROPERTY(Headline *headline READ headline NOTIFY newsChanged)
Q_PROPERTY(Profile *currentProfile READ currentProfile WRITE setCurrentProfile NOTIFY currentProfileChanged)
Q_PROPERTY(Profile *autoLoginProfile READ autoLoginProfile WRITE setAutoLoginProfile NOTIFY autoLoginProfileChanged)
@@ -116,6 +117,8 @@ public:
void buildRequest(const Profile &settings, QNetworkRequest &request);
void setSSL(QNetworkRequest &request);
+ void setupIgnoreSSL(QNetworkReply *reply);
+
void readInitialInformation();
[[nodiscard]] bool closeWhenLaunched() const;
@@ -139,6 +142,9 @@ public:
[[nodiscard]] QString squareEnixLoginServer() const;
void setSquareEnixLoginServer(const QString &value);
+ [[nodiscard]] QString preferredProtocol() const;
+ void setPreferredProtocol(const QString &value);
+
[[nodiscard]] QString autoLoginProfileName() const;
[[nodiscard]] Profile *autoLoginProfile() const;
void setAutoLoginProfile(Profile *value);
@@ -175,6 +181,7 @@ signals:
void dalamudDistribServerChanged();
void squareEnixServerChanged();
void squareEnixLoginServerChanged();
+ void preferredProtocolChanged();
void loginError(QString message);
void stageChanged(QString message);
void stageIndeterminate();
diff --git a/launcher/src/assetupdater.cpp b/launcher/src/assetupdater.cpp
index 8045b87..8d6cab6 100644
--- a/launcher/src/assetupdater.cpp
+++ b/launcher/src/assetupdater.cpp
@@ -247,7 +247,7 @@ static const QMap channelToDistribPrefix = {{P
QUrl AssetUpdater::dalamudVersionManifestUrl(const Profile::DalamudChannel channel) const
{
QUrl url;
- url.setScheme(QStringLiteral("https"));
+ url.setScheme(launcher.preferredProtocol());
url.setHost(launcher.dalamudDistribServer());
url.setPath(QStringLiteral("/dalamud-distrib/%1version").arg(channelToDistribPrefix[channel]));
@@ -257,7 +257,7 @@ QUrl AssetUpdater::dalamudVersionManifestUrl(const Profile::DalamudChannel chann
QUrl AssetUpdater::dalamudLatestPackageUrl(Profile::DalamudChannel channel) const
{
QUrl url;
- url.setScheme(QStringLiteral("https"));
+ url.setScheme(launcher.preferredProtocol());
url.setHost(launcher.dalamudDistribServer());
url.setPath(QStringLiteral("/dalamud-distrib/%1latest.zip").arg(channelToDistribPrefix[channel]));
@@ -267,7 +267,7 @@ QUrl AssetUpdater::dalamudLatestPackageUrl(Profile::DalamudChannel channel) cons
QUrl AssetUpdater::dalamudAssetManifestUrl() const
{
QUrl url;
- url.setScheme(QStringLiteral("https"));
+ url.setScheme(launcher.preferredProtocol());
url.setHost(launcher.dalamudDistribServer());
url.setPath(QStringLiteral("/DalamudAssets/asset.json"));
diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp
index 1bd1f00..6f8e181 100755
--- a/launcher/src/launchercore.cpp
+++ b/launcher/src/launchercore.cpp
@@ -35,6 +35,15 @@ void LauncherCore::setSSL(QNetworkRequest &request)
request.setSslConfiguration(config);
}
+void LauncherCore::setupIgnoreSSL(QNetworkReply *reply)
+{
+ if (preferredProtocol() == QStringLiteral("http")) {
+ connect(reply, &QNetworkReply::sslErrors, this, [reply](const QList &errors) {
+ reply->ignoreSslErrors(errors);
+ });
+ }
+}
+
void LauncherCore::buildRequest(const Profile &settings, QNetworkRequest &request)
{
setSSL(request);
@@ -587,6 +596,20 @@ void LauncherCore::setSquareEnixLoginServer(const QString &value)
}
}
+QString LauncherCore::preferredProtocol() const
+{
+ return Config::preferredProtocol();
+}
+
+void LauncherCore::setPreferredProtocol(const QString &value)
+{
+ if (value != Config::preferredProtocol()) {
+ Config::setPreferredProtocol(value);
+ Config::self()->save();
+ Q_EMIT preferredProtocolChanged();
+ }
+}
+
[[nodiscard]] QString LauncherCore::autoLoginProfileName() const
{
return Config::autoLoginProfile();
@@ -629,7 +652,7 @@ QCoro::Task<> LauncherCore::fetchNews()
query.addQueryItem(QStringLiteral("media"), QStringLiteral("pcapp"));
QUrl url;
- url.setScheme(QStringLiteral("https"));
+ url.setScheme(preferredProtocol());
url.setHost(QStringLiteral("frontier.%1").arg(squareEnixServer()));
url.setPath(QStringLiteral("/news/headline.json"));
url.setQuery(query);
diff --git a/launcher/src/squareboot.cpp b/launcher/src/squareboot.cpp
index a8b9fc5..28d2f39 100644
--- a/launcher/src/squareboot.cpp
+++ b/launcher/src/squareboot.cpp
@@ -67,7 +67,7 @@ QCoro::Task<> SquareBoot::checkGateStatus(const LoginInformation &info)
qDebug() << "Checking gate...";
QUrl url;
- url.setScheme(QStringLiteral("https"));
+ url.setScheme(window.preferredProtocol());
url.setHost(QStringLiteral("frontier.%1").arg(window.squareEnixServer()));
url.setPath(QStringLiteral("/worldStatus/gate_status.json"));
url.setQuery(QString::number(QDateTime::currentMSecsSinceEpoch()));
@@ -78,6 +78,7 @@ QCoro::Task<> SquareBoot::checkGateStatus(const LoginInformation &info)
window.buildRequest(*info.profile, request);
const auto reply = window.mgr->get(request);
+ window.setupIgnoreSSL(reply);
co_await reply;
const QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
diff --git a/launcher/src/squarelauncher.cpp b/launcher/src/squarelauncher.cpp
index bf6bfc1..7a669fa 100644
--- a/launcher/src/squarelauncher.cpp
+++ b/launcher/src/squarelauncher.cpp
@@ -57,7 +57,7 @@ QCoro::Task> SquareLauncher::getStored
}
QUrl url;
- url.setScheme(QStringLiteral("https"));
+ url.setScheme(window.preferredProtocol());
url.setHost(QStringLiteral("ffxiv-login.%1").arg(window.squareEnixLoginServer()));
url.setPath(QStringLiteral("/oauth/ffxivarr/login/top"));
url.setQuery(query);
@@ -124,6 +124,7 @@ QCoro::Task<> SquareLauncher::login(const LoginInformation &info)
request.setRawHeader(QByteArrayLiteral("Cache-Control"), QByteArrayLiteral("no-cache"));
const auto reply = window.mgr->post(request, postData.toString(QUrl::FullyEncoded).toUtf8());
+ window.setupIgnoreSSL(reply);
co_await reply;
const QString str = reply->readAll();
@@ -186,7 +187,14 @@ QCoro::Task<> SquareLauncher::registerSession(const LoginInformation &info)
co_await reply;
if (reply->error() == QNetworkReply::NoError) {
+ QString patchUniqueId;
if (reply->rawHeaderList().contains(QByteArrayLiteral("X-Patch-Unique-Id"))) {
+ patchUniqueId = reply->rawHeader(QByteArrayLiteral("X-Patch-Unique-Id"));
+ } else if (reply->rawHeaderList().contains(QByteArrayLiteral("x-patch-unique-id"))) {
+ patchUniqueId = reply->rawHeader(QByteArrayLiteral("x-patch-unique-id"));
+ }
+
+ if (!patchUniqueId.isEmpty()) {
const QString body = reply->readAll();
if (!body.isEmpty()) {
@@ -199,7 +207,7 @@ QCoro::Task<> SquareLauncher::registerSession(const LoginInformation &info)
patcher->deleteLater();
}
- auth.SID = reply->rawHeader(QByteArrayLiteral("X-Patch-Unique-Id"));
+ auth.SID = patchUniqueId;
window.launchGame(*info.profile, auth);
} else {
diff --git a/launcher/ui/Settings/DeveloperSettings.qml b/launcher/ui/Settings/DeveloperSettings.qml
index 5a860b2..66c6ef8 100644
--- a/launcher/ui/Settings/DeveloperSettings.qml
+++ b/launcher/ui/Settings/DeveloperSettings.qml
@@ -40,6 +40,19 @@ FormCard.FormCardPage {
FormCard.FormCard {
Layout.fillWidth: true
+ FormCard.FormTextFieldDelegate {
+ id: preferredProtocolDelegate
+
+ label: i18n("Preferred Protocol")
+ text: LauncherCore.preferredProtocol
+ onTextChanged: LauncherCore.preferredProtocol = text
+ }
+
+ FormCard.FormDelegateSeparator {
+ above: preferredProtocolDelegate
+ below: dalamudServerDelegate
+ }
+
FormCard.FormTextFieldDelegate {
id: dalamudServerDelegate