diff --git a/launcher/accountconfig.kcfg b/launcher/accountconfig.kcfg index f068a05..4d39c23 100644 --- a/launcher/accountconfig.kcfg +++ b/launcher/accountconfig.kcfg @@ -39,8 +39,6 @@ SPDX-License-Identifier: CC0-1.0 false - - false @@ -63,5 +61,26 @@ SPDX-License-Identifier: CC0-1.0 + + https + + + + + + + + + 7000 + + + ffxiv.com + + + square-enix.com + + + finalfantasyxiv.com + diff --git a/launcher/config.kcfg b/launcher/config.kcfg index 298b403..2e19859 100644 --- a/launcher/config.kcfg +++ b/launcher/config.kcfg @@ -36,15 +36,6 @@ SPDX-License-Identifier: CC0-1.0 kamori.goats.dev - - ffxiv.com - - - square-enix.com - - - finalfantasyxiv.com - https @@ -54,11 +45,5 @@ SPDX-License-Identifier: CC0-1.0 false - - - - - 7000 - diff --git a/launcher/src/accountmanager.cpp b/launcher/src/accountmanager.cpp index 0f49681..14a64e2 100644 --- a/launcher/src/accountmanager.cpp +++ b/launcher/src/accountmanager.cpp @@ -73,7 +73,7 @@ Account *AccountManager::createSapphireAccount(const QString &lobbyUrl, const QS const auto account = new Account(QUuid::createUuid().toString(), this); account->config()->setIsSapphire(true); account->config()->setName(username); - account->config()->setLobbyUrl(lobbyUrl); + account->config()->setLobbyHost(lobbyUrl); insertAccount(account); diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index 7a09085..85950d7 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -186,8 +186,8 @@ void LauncherCore::fetchAvatar(Account *account) qDebug(ASTRA_LOG) << "Did not find lodestone character " << account->config()->lodestoneId() << " in cache, fetching from Lodestone."; QUrl url; - url.setScheme(config()->preferredProtocol()); - url.setHost(QStringLiteral("na.%1").arg(config()->mainServer())); // TODO: NA isnt the only thing in the world... + url.setScheme(account->config()->preferredProtocol()); + url.setHost(QStringLiteral("na.%1").arg(account->config()->mainServer())); // TODO: NA isnt the only thing in the world... url.setPath(QStringLiteral("/lodestone/character/%1").arg(account->config()->lodestoneId())); const QNetworkRequest request(url); @@ -367,7 +367,7 @@ void LauncherCore::setupIgnoreSSL(QNetworkReply *reply) { Q_ASSERT(reply != nullptr); - if (config()->preferredProtocol() == QStringLiteral("http")) { + if (reply->request().url().scheme() == QStringLiteral("http")) { connect(reply, &QNetworkReply::sslErrors, this, [reply](const QList &errors) { reply->ignoreSslErrors(errors); }); @@ -471,7 +471,7 @@ QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info) std::optional auth; if (!info.profile->config()->isBenchmark()) { if (info.profile->account()->config()->isSapphire()) { - auth = co_await m_sapphireLogin->login(info.profile->account()->config()->lobbyUrl(), info); + auth = co_await m_sapphireLogin->login(info.profile->account()->config()->lobbyHost(), info); } else { auth = co_await m_squareEnixLogin->login(&info); } @@ -505,8 +505,8 @@ QCoro::Task<> LauncherCore::fetchNews() query.addQueryItem(QStringLiteral("media"), QStringLiteral("pcapp")); QUrl headlineUrl; - headlineUrl.setScheme(config()->preferredProtocol()); - headlineUrl.setHost(QStringLiteral("frontier.%1").arg(config()->squareEnixServer())); + headlineUrl.setScheme(currentProfile()->account()->config()->preferredProtocol()); + headlineUrl.setHost(QStringLiteral("frontier.%1").arg(currentProfile()->account()->config()->squareEnixServer())); headlineUrl.setPath(QStringLiteral("/news/headline.json")); headlineUrl.setQuery(query); @@ -524,8 +524,8 @@ QCoro::Task<> LauncherCore::fetchNews() co_await headlineReply; QUrl bannerUrl; - bannerUrl.setScheme(config()->preferredProtocol()); - bannerUrl.setHost(QStringLiteral("frontier.%1").arg(config()->squareEnixServer())); + bannerUrl.setScheme(currentProfile()->account()->config()->preferredProtocol()); + bannerUrl.setHost(QStringLiteral("frontier.%1").arg(currentProfile()->account()->config()->squareEnixServer())); bannerUrl.setPath(QStringLiteral("/v2/topics/%1/banner.json").arg(QStringLiteral("en-us"))); bannerUrl.setQuery(query); diff --git a/launcher/src/squareenixlogin.cpp b/launcher/src/squareenixlogin.cpp index 62f357e..328d970 100644 --- a/launcher/src/squareenixlogin.cpp +++ b/launcher/src/squareenixlogin.cpp @@ -74,10 +74,10 @@ QCoro::Task> SquareEnixLogin::login(LoginInformation *i } // Inject custom game server if set - if (!m_launcher.config()->customGameServer().isEmpty()) { - m_auth.frontierHost = m_launcher.config()->customGameServer(); - m_auth.lobbyHost = m_launcher.config()->customGameServer(); - m_auth.lobbyHostPort = m_launcher.config()->customGameServerPort(); + if (!info->profile->account()->config()->lobbyHost().isEmpty()) { + m_auth.frontierHost = info->profile->account()->config()->gMServerHost(); + m_auth.lobbyHost = info->profile->account()->config()->lobbyHost(); + m_auth.lobbyHostPort = info->profile->account()->config()->lobbyHostPort(); } co_return m_auth; @@ -89,8 +89,8 @@ QCoro::Task SquareEnixLogin::checkGateStatus() const qInfo(ASTRA_LOG) << "Checking if the gate is open..."; QUrl url; - url.setScheme(m_launcher.config()->preferredProtocol()); - url.setHost(QStringLiteral("frontier.%1").arg(m_launcher.config()->squareEnixServer())); + url.setScheme(m_info->profile->account()->config()->preferredProtocol()); + url.setHost(QStringLiteral("frontier.%1").arg(m_info->profile->account()->config()->squareEnixServer())); url.setPath(QStringLiteral("/worldStatus/gate_status.json")); url.setQuery(QString::number(QDateTime::currentMSecsSinceEpoch())); @@ -130,8 +130,8 @@ QCoro::Task SquareEnixLogin::checkLoginStatus() const qInfo(ASTRA_LOG) << "Checking if login is open..."; QUrl url; - url.setScheme(m_launcher.config()->preferredProtocol()); - url.setHost(QStringLiteral("frontier.%1").arg(m_launcher.config()->squareEnixServer())); + url.setScheme(m_info->profile->account()->config()->preferredProtocol()); + url.setHost(QStringLiteral("frontier.%1").arg(m_info->profile->account()->config()->squareEnixServer())); url.setPath(QStringLiteral("/worldStatus/login_status.json")); url.setQuery(QString::number(QDateTime::currentMSecsSinceEpoch())); @@ -153,7 +153,7 @@ QCoro::Task SquareEnixLogin::checkLoginStatus() const qInfo(ASTRA_LOG) << "Login is open!"; co_return true; } else { - qInfo(ASTRA_LOG) << "Lgoin is closed!"; + qInfo(ASTRA_LOG) << "Login is closed!"; Q_EMIT m_launcher.loginError(i18n("The login gate is closed, the game may be under maintenance.\n\n%1", reply->errorString())); co_return false; } @@ -173,7 +173,7 @@ QCoro::Task SquareEnixLogin::checkBootUpdates() QUrl url; url.setScheme(QStringLiteral("http")); - url.setHost(QStringLiteral("patch-bootver.%1").arg(m_launcher.config()->squareEnixServer())); + url.setHost(QStringLiteral("patch-bootver.%1").arg(m_info->profile->account()->config()->squareEnixServer())); url.setPath(QStringLiteral("/http/%1/%2/%3/").arg(platform, bootUpdateChannel, m_info->profile->bootVersion())); url.setQuery(query); @@ -184,7 +184,7 @@ QCoro::Task SquareEnixLogin::checkBootUpdates() request.setHeader(QNetworkRequest::KnownHeaders::UserAgentHeader, patchUserAgent); } - request.setRawHeader(QByteArrayLiteral("Host"), QStringLiteral("patch-bootver.%1").arg(m_launcher.config()->squareEnixServer()).toUtf8()); + request.setRawHeader(QByteArrayLiteral("Host"), QStringLiteral("patch-bootver.%1").arg(m_info->profile->account()->config()->squareEnixServer()).toUtf8()); Utility::printRequest(QStringLiteral("GET"), request); const auto reply = m_launcher.mgr()->get(request); @@ -241,8 +241,8 @@ QCoro::Task> SquareEnixLogin::getStor } QUrl url; - url.setScheme(m_launcher.config()->preferredProtocol()); - url.setHost(QStringLiteral("ffxiv-login.%1").arg(m_launcher.config()->squareEnixLoginServer())); + url.setScheme(m_info->profile->account()->config()->preferredProtocol()); + url.setHost(QStringLiteral("ffxiv-login.%1").arg(m_info->profile->account()->config()->squareEnixLoginServer())); url.setPath(QStringLiteral("/oauth/ffxivarr/login/top")); url.setQuery(query); @@ -299,8 +299,8 @@ QCoro::Task SquareEnixLogin::loginOAuth() postData.addQueryItem(QStringLiteral("otppw"), m_info->oneTimePassword); QUrl url; - url.setScheme(m_launcher.config()->preferredProtocol()); - url.setHost(QStringLiteral("ffxiv-login.%1").arg(m_launcher.config()->squareEnixLoginServer())); + url.setScheme(m_info->profile->account()->config()->preferredProtocol()); + url.setHost(QStringLiteral("ffxiv-login.%1").arg(m_info->profile->account()->config()->squareEnixLoginServer())); url.setPath(QStringLiteral("/oauth/ffxivarr/login/login.send")); QNetworkRequest request(url); @@ -360,8 +360,8 @@ QCoro::Task SquareEnixLogin::registerSession() qInfo(ASTRA_LOG) << "Registering the session..."; QUrl url; - url.setScheme(m_launcher.config()->preferredProtocol()); - url.setHost(QStringLiteral("patch-gamever.%1").arg(m_launcher.config()->squareEnixServer())); + url.setScheme(m_info->profile->account()->config()->preferredProtocol()); + url.setHost(QStringLiteral("patch-gamever.%1").arg(m_info->profile->account()->config()->squareEnixServer())); url.setPath(QStringLiteral("/http/%1/%2/%3/%4").arg(platform, gameUpdateChannel, m_info->profile->baseGameVersion(), m_SID)); auto request = QNetworkRequest(url); diff --git a/launcher/ui/Settings/AccountSettings.qml b/launcher/ui/Settings/AccountSettings.qml index 14e7350..8bb20d9 100644 --- a/launcher/ui/Settings/AccountSettings.qml +++ b/launcher/ui/Settings/AccountSettings.qml @@ -51,6 +51,10 @@ FormCard.FormCardPage { Kirigami.Action { id: loginAction text: i18n("Login") + }, + Kirigami.Action { + id: developerAction + text: i18n("Developer") } ] @@ -255,6 +259,101 @@ FormCard.FormCardPage { } } + FormCard.FormCard { + visible: developerAction.checked + + Layout.fillWidth: true + Layout.topMargin: Kirigami.Units.largeSpacing * 4 + + FormCard.FormTextFieldDelegate { + id: preferredProtocolDelegate + + label: i18n("Preferred Protocol") + text: page.account.config.preferredProtocol + onTextChanged: page.account.config.preferredProtocol = text + } + + FormCard.FormDelegateSeparator { + above: preferredProtocolDelegate + below: squareMainServerDelegate + } + + FormCard.FormTextFieldDelegate { + id: squareMainServerDelegate + + label: i18n("SE Main Server (ffxiv.com)") + text: page.account.config.squareEnixServer + onTextChanged: page.account.config.squareEnixServer = text + } + + FormCard.FormDelegateSeparator { + above: squareMainServerDelegate + below: loginServerDelegate + } + + FormCard.FormTextFieldDelegate { + id: loginServerDelegate + + label: i18n("SE Login Server (square-enix.com)") + text: page.account.config.squareEnixLoginServer + onTextChanged: page.account.config.squareEnixLoginServer = text + } + + FormCard.FormDelegateSeparator { + above: loginServerDelegate + below: mainServerDelegate + } + + FormCard.FormTextFieldDelegate { + id: mainServerDelegate + + label: i18n("Main Server (finalfantasyxiv.com)") + text: page.account.config.mainServer + onTextChanged: page.account.config.mainServer = text + } + + FormCard.FormDelegateSeparator { + above: mainServerDelegate + below: gmServerDelegate + } + + FormCard.FormTextFieldDelegate { + id: gmServerDelegate + + label: i18n("GM Server (leave blank for default)") + text: page.account.config.gMServerHost + onTextChanged: page.account.config.gMServerHost = text + } + + FormCard.FormDelegateSeparator { + above: gmServerDelegate + below: gameServerDelegate + } + + FormCard.FormTextFieldDelegate { + id: gameServerDelegate + + label: i18n("Lobby Server (leave blank for default)") + text: page.account.config.lobbyHost + onTextChanged: page.account.config.lobbyHost = text + } + + FormCard.FormDelegateSeparator { + above: gameServerDelegate + below: gameServerPortDelegate + } + + FormCard.FormSpinBoxDelegate { + id: gameServerPortDelegate + + label: i18n("Lobby Server Port") + value: page.account.config.lobbyHostPort + onValueChanged: page.account.config.lobbyHostPort = value + from: 1 + to: 999999 + } + } + Kirigami.PromptDialog { id: deletePrompt diff --git a/launcher/ui/Settings/DeveloperSettings.qml b/launcher/ui/Settings/DeveloperSettings.qml index 4f45313..44e33f0 100644 --- a/launcher/ui/Settings/DeveloperSettings.qml +++ b/launcher/ui/Settings/DeveloperSettings.qml @@ -85,42 +85,6 @@ FormCard.FormCardPage { FormCard.FormCard { Layout.fillWidth: true - FormCard.FormButtonDelegate { - id: resetToDefaultsDelegate - - text: i18n("Reset to Defaults") - - onClicked: { - preferredProtocolDelegate.text = LauncherCore.config.defaultPreferredProtocol(); - dalamudServerDelegate.text = LauncherCore.config.defaultDalamudDistribServer(); - squareMainServerDelegate.text = LauncherCore.config.defaultSquareEnixServer(); - loginServerDelegate.text = LauncherCore.config.defaultSquareEnixLoginServer(); - mainServerDelegate.text = LauncherCore.config.defaultMainServer(); - } - } - - FormCard.FormDelegateSeparator { - above: resetToDefaultsDelegate - below: localServerDelegate - } - - FormCard.FormButtonDelegate { - id: localServerDelegate - - text: i18n("Set to localhost") - - onClicked: { - preferredProtocolDelegate.text = "http"; - squareMainServerDelegate.text = "ffxiv.localhost"; - loginServerDelegate.text = "square.localhost"; - } - } - - FormCard.FormDelegateSeparator { - above: localServerDelegate - below: preferredProtocolDelegate - } - FormCard.FormTextFieldDelegate { id: preferredProtocolDelegate @@ -141,72 +105,5 @@ FormCard.FormCardPage { text: LauncherCore.config.dalamudDistribServer onTextChanged: LauncherCore.config.dalamudDistribServer = text } - - FormCard.FormDelegateSeparator { - above: dalamudServerDelegate - below: squareMainServerDelegate - } - - FormCard.FormTextFieldDelegate { - id: squareMainServerDelegate - - label: i18n("SE Main Server (ffxiv.com)") - text: LauncherCore.config.squareEnixServer - onTextChanged: LauncherCore.config.squareEnixServer = text - } - - FormCard.FormDelegateSeparator { - above: squareMainServerDelegate - below: loginServerDelegate - } - - FormCard.FormTextFieldDelegate { - id: loginServerDelegate - - label: i18n("SE Login Server (square-enix.com)") - text: LauncherCore.config.squareEnixLoginServer - onTextChanged: LauncherCore.config.squareEnixLoginServer = text - } - - FormCard.FormDelegateSeparator { - above: loginServerDelegate - below: mainServerDelegate - } - - FormCard.FormTextFieldDelegate { - id: mainServerDelegate - - label: i18n("Main Server (finalfantasyxiv.com)") - text: LauncherCore.config.mainServer - onTextChanged: LauncherCore.config.mainServer = text - } - - FormCard.FormDelegateSeparator { - above: mainServerDelegate - below: gameServerDelegate - } - - FormCard.FormTextFieldDelegate { - id: gameServerDelegate - - label: i18n("Game Server (leave blank for default)") - text: LauncherCore.config.customGameServer - onTextChanged: LauncherCore.config.customGameServer = text - } - - FormCard.FormDelegateSeparator { - above: gameServerDelegate - below: gameServerPortDelegate - } - - FormCard.FormSpinBoxDelegate { - id: gameServerPortDelegate - - label: i18n("Game Server Port") - value: LauncherCore.config.customGameServerPort - onValueChanged: LauncherCore.config.customGameServerPort = value - from: 1 - to: 999999 - } } }