diff --git a/src/jami/account_const.h b/src/jami/account_const.h index c81fa6b3b702d823b0516cb1a919ef6b1538e8d3..3e31666ef1b17cad2078f35ffdf81c8625e4c4e1 100644 --- a/src/jami/account_const.h +++ b/src/jami/account_const.h @@ -142,6 +142,7 @@ constexpr static const char ARCHIVE_PIN[] = "Account.archivePIN"; constexpr static const char DEVICE_ID[] = "Account.deviceID"; constexpr static const char DEVICE_NAME[] = "Account.deviceName"; constexpr static const char PROXY_ENABLED[] = "Account.proxyEnabled"; +constexpr static const char PROXY_LIST_ENABLED[] = "Account.proxyListEnabled"; constexpr static const char PROXY_SERVER[] = "Account.proxyServer"; constexpr static const char PROXY_PUSH_TOKEN[] = "Account.proxyPushToken"; constexpr static const char KEEP_ALIVE_ENABLED[] = "Account.keepAliveEnabled"; diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index edffa3f516ace324b5d5c544209793aeaf11fc1c..9eabdee2a6421c4d6b7810c4055a2d587b4db9c9 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2581,7 +2581,7 @@ JamiAccount::loadCachedProxyServer(std::function<void(const std::string& proxy)> const auto& conf = config(); if (conf.proxyEnabled and proxyServerCached_.empty()) { JAMI_DEBUG("[Account {:s}] loading DHT proxy URL: {:s}", getAccountID(), conf.proxyListUrl); - if (conf.proxyListUrl.empty()) { + if (conf.proxyListUrl.empty() or not conf.proxyListEnabled) { cb(getDhtProxyServer(conf.proxyServer)); } else { loadCachedUrl(conf.proxyListUrl, diff --git a/src/jamidht/jamiaccount_config.cpp b/src/jamidht/jamiaccount_config.cpp index 2dae189e19e9017f2c48fc801c0fae83df0a13ce..552d2f66b600b60a910cbe753207e31f324322fd 100644 --- a/src/jamidht/jamiaccount_config.cpp +++ b/src/jamidht/jamiaccount_config.cpp @@ -48,6 +48,7 @@ JamiAccountConfig::serialize(YAML::Emitter& out) const SERIALIZE_CONFIG(libjami::Account::ConfProperties::ACCOUNT_PUBLISH, accountPublish); SERIALIZE_CONFIG(Conf::PROXY_ENABLED_KEY, proxyEnabled); SERIALIZE_CONFIG(Conf::PROXY_SERVER_KEY, proxyServer); + SERIALIZE_CONFIG(libjami::Account::ConfProperties::PROXY_LIST_ENABLED, proxyListEnabled); SERIALIZE_CONFIG(libjami::Account::ConfProperties::DHT_PROXY_LIST_URL, proxyListUrl); SERIALIZE_CONFIG(libjami::Account::ConfProperties::RingNS::URI, nameServer); SERIALIZE_CONFIG(libjami::Account::VolatileProperties::REGISTERED_NAME, registeredName); @@ -98,6 +99,7 @@ JamiAccountConfig::unserialize(const YAML::Node& node) parseValueOptional(node, Conf::PROXY_ENABLED_KEY, proxyEnabled); parseValueOptional(node, Conf::PROXY_SERVER_KEY, proxyServer); parseValueOptional(node, libjami::Account::ConfProperties::DHT_PROXY_LIST_URL, proxyListUrl); + parseValueOptional(node, libjami::Account::ConfProperties::PROXY_LIST_ENABLED, proxyListEnabled); parseValueOptional(node, libjami::Account::ConfProperties::DEVICE_NAME, deviceName); parseValueOptional(node, libjami::Account::ConfProperties::MANAGER_URI, managerUri); @@ -158,6 +160,7 @@ JamiAccountConfig::toMap() const a.emplace(libjami::Account::ConfProperties::ALLOW_CERT_FROM_TRUSTED, allowPeersFromTrusted ? TRUE_STR : FALSE_STR); a.emplace(libjami::Account::ConfProperties::PROXY_ENABLED, proxyEnabled ? TRUE_STR : FALSE_STR); + a.emplace(libjami::Account::ConfProperties::PROXY_LIST_ENABLED, proxyListEnabled ? TRUE_STR : FALSE_STR); a.emplace(libjami::Account::ConfProperties::PROXY_SERVER, proxyServer); a.emplace(libjami::Account::ConfProperties::DHT_PROXY_LIST_URL, proxyListUrl); a.emplace(libjami::Account::ConfProperties::MANAGER_URI, managerUri); @@ -214,6 +217,7 @@ JamiAccountConfig::fromMap(const std::map<std::string, std::string>& details) auto oldProxyServer = proxyServer, oldProxyServerList = proxyListUrl; parseString(details, libjami::Account::ConfProperties::DHT_PROXY_LIST_URL, proxyListUrl); parseBool(details, libjami::Account::ConfProperties::PROXY_ENABLED, proxyEnabled); + parseBool(details, libjami::Account::ConfProperties::PROXY_LIST_ENABLED, proxyListEnabled); parseString(details, libjami::Account::ConfProperties::PROXY_SERVER, proxyServer); parseString(details, libjami::Account::ConfProperties::UI_CUSTOMIZATION, uiCustomization); if (not managerUri.empty() and managerUri.rfind("http", 0) != 0) { diff --git a/src/jamidht/jamiaccount_config.h b/src/jamidht/jamiaccount_config.h index ce84ae430c603ee69fd1ef10429545285178af17..6fbda16cd80928bc78eaf223de6f62666d236259 100644 --- a/src/jamidht/jamiaccount_config.h +++ b/src/jamidht/jamiaccount_config.h @@ -51,6 +51,7 @@ struct JamiAccountConfig : public SipAccountBaseConfig { std::string bootstrapListUrl {"https://config.jami.net/bootstrapList"}; bool proxyEnabled {false}; + bool proxyListEnabled {true}; std::string proxyServer {"dhtproxy.jami.net:[80-95]"}; std::string proxyListUrl {"https://config.jami.net/proxyList"};