bugfix/api auth data saving (#1195)

* bugfix: fixed authData saving

* bugfix: added serviceInfo processing from api response
This commit is contained in:
Nethius 2024-10-24 19:12:53 +04:00 committed by GitHub
parent 7a389e8755
commit 4685d3b543
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 3 deletions

View file

@ -37,6 +37,7 @@ namespace
constexpr char userCountryCode[] = "user_country_code";
constexpr char serverCountryCode[] = "server_country_code";
constexpr char serviceType[] = "service_type";
constexpr char serviceInfo[] = "service_info";
constexpr char aesKey[] = "aes_key";
constexpr char aesIv[] = "aes_iv";
@ -163,6 +164,11 @@ void ApiController::fillServerConfig(const QString &protocol, const ApiControlle
QVariantMap map = serverConfig.value(configKey::apiConfig).toObject().toVariantMap();
map.insert(newServerConfig.value(configKey::apiConfig).toObject().toVariantMap());
auto apiConfig = QJsonObject::fromVariantMap(map);
if (newServerConfig.value(config_key::configVersion).toInt() == ApiConfigSources::AmneziaGateway) {
apiConfig.insert(configKey::serviceInfo, QJsonDocument::fromJson(apiResponseBody).object().value(configKey::serviceInfo).toObject());
}
serverConfig[configKey::apiConfig] = apiConfig;
return;