diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 07a57174..1f8788c6 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -138,6 +138,7 @@ ActorOwn<> get_simple_config_google_dns(Promise promise, bool is_t #if TD_EMSCRIPTEN // FIXME return ActorOwn<>(); #else + auto name = G()->shared_config().get_option_string("dc_txt_domain_name", is_test ? "tapv2.stel.com" : "apv2.stel.com"); return ActorOwn<>(create_actor_on_scheduler( "Wget", scheduler_id, PromiseCreator::lambda([promise = std::move(promise)](Result r_query) mutable { @@ -171,7 +172,7 @@ ActorOwn<> get_simple_config_google_dns(Promise promise, bool is_t return decode_config(data); }()); }), - PSTRING() << "https://www.google.com/resolve?name=" << (is_test ? "t" : "") << "apv2.stel.com&type=16", + PSTRING() << "https://www.google.com/resolve?name=" << url_encode(name) << "&type=16", std::vector>({{"Host", "dns.google.com"}}), 10 /*timeout*/, 3 /*ttl*/, SslFd::VerifyPeer::Off)); #endif @@ -759,6 +760,9 @@ void ConfigManager::process_config(tl_object_ptr config) { shared_config.set_option_boolean("expect_blocking", (config->flags_ & telegram_api::config::BLOCKED_MODE_MASK) != 0); } + if (is_from_main_dc || !shared_config.have_option("dc_txt_domain_name")) { + shared_config.set_option_string("dc_txt_domain_name", config->dc_txt_domain_name_); + } if (is_from_main_dc || !shared_config.have_option("t_me_url")) { auto url = config->me_url_prefix_; if (!url.empty()) { @@ -769,6 +773,7 @@ void ConfigManager::process_config(tl_object_ptr config) { } } if (is_from_main_dc) { + shared_config.set_option_integer("webfile_dc_id", config->webfile_dc_id_); if ((config->flags_ & telegram_api::config::TMP_SESSIONS_MASK) != 0) { G()->shared_config().set_option_integer("session_count", config->tmp_sessions_); } else { @@ -792,8 +797,6 @@ void ConfigManager::process_config(tl_object_ptr config) { shared_config.set_option_integer("call_packet_timeout_ms", config->call_packet_timeout_ms_); shared_config.set_option_integer("call_receive_timeout_ms", config->call_receive_timeout_ms_); - shared_config.set_option_integer("webfile_dc_id", config->webfile_dc_id_); - // delete outdated options shared_config.set_option_empty("chat_big_size"); shared_config.set_option_empty("group_size_max"); diff --git a/td/telegram/ConfigShared.cpp b/td/telegram/ConfigShared.cpp index 4423cb16..5dae809c 100644 --- a/td/telegram/ConfigShared.cpp +++ b/td/telegram/ConfigShared.cpp @@ -89,11 +89,11 @@ int32 ConfigShared::get_option_integer(Slice name, int32 default_value) const { string ConfigShared::get_option_string(Slice name, string default_value) const { auto str_value = get_option(name); if (str_value.empty()) { - return default_value; + return std::move(default_value); } if (str_value[0] != 'S') { LOG(ERROR) << "Found \"" << str_value << "\" instead of string option"; - return default_value; + return std::move(default_value); } return str_value.substr(1); } diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 04c53aeb..99d42ee7 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4236,8 +4236,8 @@ bool Td::is_internal_config_option(Slice name) { return name == "call_ring_timeout_ms" || name == "call_receive_timeout_ms" || name == "channels_read_media_period" || name == "edit_time_limit" || name == "revoke_pm_inbox" || name == "revoke_time_limit" || name == "revoke_pm_time_limit" || name == "rating_e_decay" || name == "saved_animations_limit" || - name == "recent_stickers_limit" || name == "expect_blocking" || name == "my_phone_number" || - name == "webfile_dc_id" || name == "auth"; + name == "recent_stickers_limit" || name == "expect_blocking" || name == "dc_txt_domain_name" || + name == "my_phone_number" || name == "webfile_dc_id" || name == "auth"; } void Td::on_config_option_updated(const string &name) {