diff --git a/external/libphysis b/external/libphysis index 0b09892..c3ad93a 160000 --- a/external/libphysis +++ b/external/libphysis @@ -1 +1 @@ -Subproject commit 0b098928db2fb8cfbffdef9b9a420847bdde1e8e +Subproject commit c3ad93addb1204808c680d3dd7db9a2086392a53 diff --git a/launcher/include/profile.h b/launcher/include/profile.h index bacc85a..2a19610 100644 --- a/launcher/include/profile.h +++ b/launcher/include/profile.h @@ -135,6 +135,8 @@ public: [[nodiscard]] int numInstalledExpansions() const; [[nodiscard]] QString expansionVersion(int index) const; + [[nodiscard]] QString frontierUrl() const; + [[nodiscard]] int dalamudAssetVersion() const; void setDalamudAssetVersion(int version); @@ -209,6 +211,8 @@ private: QString m_compatibilityToolVersion; bool m_dalamudApplicable = false; + QString m_frontierUrl; + bool m_loggedIn = false; LauncherCore &m_launcher; diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index 6259723..74b2a28 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -406,10 +406,11 @@ QCoro::Task<> LauncherCore::fetchNews() QNetworkRequest headlineRequest(QUrl(QStringLiteral("%1&%2").arg(headlineUrl.toString(), QString::number(QDateTime::currentMSecsSinceEpoch())))); headlineRequest.setRawHeader(QByteArrayLiteral("Accept"), QByteArrayLiteral("application/json, text/plain, */*")); headlineRequest.setRawHeader(QByteArrayLiteral("Origin"), QByteArrayLiteral("https://launcher.finalfantasyxiv.com")); - headlineRequest.setRawHeader(QByteArrayLiteral("Referer"), - QStringLiteral("https://launcher.finalfantasyxiv.com/v600/index.html?rc_lang=%1&time=%2") - .arg(QStringLiteral("en-us"), QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH"))) - .toUtf8()); + headlineRequest.setRawHeader( + QByteArrayLiteral("Referer"), + QStringLiteral("%1/index.html?rc_lang=%2&time=%3") + .arg(currentProfile()->frontierUrl(), QStringLiteral("en-us"), QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH"))) + .toUtf8()); Utility::printRequest(QStringLiteral("GET"), headlineRequest); auto headlineReply = mgr()->get(headlineRequest); @@ -424,10 +425,11 @@ QCoro::Task<> LauncherCore::fetchNews() QNetworkRequest bannerRequest(QUrl(QStringLiteral("%1&_=%3").arg(bannerUrl.toString(), QString::number(QDateTime::currentMSecsSinceEpoch())))); bannerRequest.setRawHeader(QByteArrayLiteral("Accept"), QByteArrayLiteral("application/json, text/plain, */*")); bannerRequest.setRawHeader(QByteArrayLiteral("Origin"), QByteArrayLiteral("https://launcher.finalfantasyxiv.com")); - bannerRequest.setRawHeader(QByteArrayLiteral("Referer"), - QStringLiteral("https://launcher.finalfantasyxiv.com/v700/index.html?rc_lang=%1&time=%2") - .arg(QStringLiteral("en-us"), QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH"))) - .toUtf8()); + bannerRequest.setRawHeader( + QByteArrayLiteral("Referer"), + QStringLiteral("%1/v700/index.html?rc_lang=%2&time=%3") + .arg(currentProfile()->frontierUrl(), QStringLiteral("en-us"), QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH"))) + .toUtf8()); Utility::printRequest(QStringLiteral("GET"), bannerRequest); auto bannerReply = mgr()->get(bannerRequest); diff --git a/launcher/src/profile.cpp b/launcher/src/profile.cpp index d7fec27..c207158 100644 --- a/launcher/src/profile.cpp +++ b/launcher/src/profile.cpp @@ -420,6 +420,10 @@ void Profile::readGameVersion() readGameData(); } + // Extract frontier url if possible + const QString launcherPath = QString(gamePath() + QStringLiteral("/boot/ffxivlauncher64.exe")); + m_frontierUrl = QString::fromUtf8(physis_extract_frontier_url(launcherPath.toStdString().c_str())); + Q_EMIT gameInstallChanged(); } @@ -533,6 +537,16 @@ QString Profile::expansionVersion(const int index) const return QString::fromLatin1(m_repositories.repositories[index + 1].version); } +QString Profile::frontierUrl() const +{ + if (m_frontierUrl.isEmpty()) { + // fallback url + return QStringLiteral("https://launcher.finalfantasyxiv.com/v600/"); + } else { + return m_frontierUrl; + } +} + int Profile::dalamudAssetVersion() const { return m_dalamudAssetVersion;