Fix some preauthentication requests.

GitOrigin-RevId: 1bbbbef17b740140ae99c4972d569306f6ca52ac
This commit is contained in:
levlam 2019-12-13 04:00:33 +03:00
parent f0d3854462
commit 2714fbf1f8
8 changed files with 18 additions and 12 deletions

View File

@ -4168,7 +4168,7 @@ sendCustomRequest method:string parameters:string = CustomRequestResult;
answerCustomQuery custom_query_id:int64 data:string = Ok;
//@description Sends a request to TON lite server through Telegram servers @request The request
//@description Sends a request to TON lite server through Telegram servers. Can be called before authorization @request The request
sendTonLiteServerRequest request:bytes = TonLiteServerResponse;
//@description Returns a salt to be used with locally stored password to access a local TON-based wallet

View File

@ -465,6 +465,7 @@ void PasswordManager::check_email_address_verification_code(string code, Promise
void PasswordManager::request_password_recovery(
Promise<td_api::object_ptr<td_api::emailAddressAuthenticationCodeInfo>> promise) {
// is called only after authoriation
send_with_promise(
G()->net_query_creator().create(create_storer(telegram_api::auth_requestPasswordRecovery())),
PromiseCreator::lambda([promise = std::move(promise)](Result<NetQueryPtr> r_query) mutable {
@ -478,6 +479,7 @@ void PasswordManager::request_password_recovery(
}
void PasswordManager::recover_password(string code, Promise<State> promise) {
// is called only after authoriation
send_with_promise(G()->net_query_creator().create(create_storer(telegram_api::auth_recoverPassword(std::move(code)))),
PromiseCreator::lambda(
[actor_id = actor_id(this), promise = std::move(promise)](Result<NetQueryPtr> r_query) mutable {

View File

@ -495,8 +495,8 @@ class SendLiteRequestQuery : public Td::ResultHandler {
}
void send(BufferSlice request) {
send_query(
G()->net_query_creator().create(create_storer(telegram_api::wallet_sendLiteRequest(std::move(request)))));
send_query(G()->net_query_creator().create(create_storer(telegram_api::wallet_sendLiteRequest(std::move(request))),
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off));
}
void on_result(uint64 id, BufferSlice packet) override {

View File

@ -477,7 +477,8 @@ class GetAppConfigQuery : public Td::ResultHandler {
}
void send() {
send_query(G()->net_query_creator().create(create_storer(telegram_api::help_getAppConfig())));
send_query(G()->net_query_creator().create(create_storer(telegram_api::help_getAppConfig()), DcId::main(),
NetQuery::Type::Common, NetQuery::AuthFlag::Off));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -508,7 +509,8 @@ class SaveAppLogQuery : public Td::ResultHandler {
input_app_events.push_back(
make_tl_object<telegram_api::inputAppEvent>(G()->server_time_cached(), type, peer_id, std::move(data)));
send_query(
G()->net_query_creator().create(create_storer(telegram_api::help_saveAppLog(std::move(input_app_events)))));
G()->net_query_creator().create(create_storer(telegram_api::help_saveAppLog(std::move(input_app_events))),
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -3504,6 +3506,7 @@ bool Td::is_preauthentication_request(int32 id) {
case td_api::setCustomLanguagePackString::ID:
case td_api::deleteLanguagePack::ID:
case td_api::processPushNotification::ID:
case td_api::sendTonLiteServerRequest::ID:
case td_api::getOption::ID:
case td_api::setOption::ID:
case td_api::getStorageStatistics::ID:

View File

@ -26,6 +26,7 @@ class GetTermsOfServiceUpdateQuery : public Td::ResultHandler {
}
void send() {
// we don't poll terms of service before authorization
send_query(G()->net_query_creator().create(create_storer(telegram_api::help_getTermsOfServiceUpdate())));
}

View File

@ -261,8 +261,7 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
LOG(DEBUG) << part.id << " " << to_string(query);
net_query = G()->net_query_creator().create(
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), create_storer(query),
remote_.get_dc_id(), is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download,
NetQuery::AuthFlag::On);
remote_.get_dc_id(), is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download);
cdn_part_reupload_token_.erase(it);
}
}
@ -452,9 +451,9 @@ Result<FileLoader::CheckInfo> FileDownloader::check_loop(int64 checked_prefix_si
has_hash_query_ = true;
auto query =
telegram_api::upload_getFileHashes(remote_.as_input_file_location(), narrow_cast<int32>(checked_prefix_size));
auto net_query = G()->net_query_creator().create(
create_storer(query), remote_.get_dc_id(),
is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download, NetQuery::AuthFlag::On);
auto net_query =
G()->net_query_creator().create(create_storer(query), remote_.get_dc_id(),
is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download);
info.queries.push_back(std::move(net_query));
break;
}

View File

@ -70,7 +70,7 @@ void PublicRsaKeyWatchdog::loop() {
has_query_ = true;
G()->net_query_dispatcher().dispatch_with_callback(
G()->net_query_creator().create(create_storer(telegram_api::help_getCdnConfig()), DcId::main(),
NetQuery::Type::Common, NetQuery::AuthFlag::Off, NetQuery::GzipFlag::On,
NetQuery::Type::Common, NetQuery::AuthFlag::On, NetQuery::GzipFlag::On,
60 * 60 * 24),
actor_shared(this));
}

View File

@ -110,7 +110,8 @@ class TempAuthKeyWatchdog : public NetQueryCallback {
return;
}
LOG(WARNING) << "Start auth_dropTempAuthKeys except keys " << format::as_array(ids);
auto query = G()->net_query_creator().create(create_storer(telegram_api::auth_dropTempAuthKeys(std::move(ids))));
auto query = G()->net_query_creator().create(create_storer(telegram_api::auth_dropTempAuthKeys(std::move(ids))),
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off);
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
}