Skip to content
Snippets Groups Projects
Commit ec56378d authored by Vsevolod Ivanov's avatar Vsevolod Ivanov Committed by Adrien Béraud
Browse files

server_account_manager: update to opendht api

Change-Id: I08ffedc34ff3d7a669e6046b95d6c5a373f214ed
parent 6b392ef1
No related branches found
No related tags found
No related merge requests found
4533b12c6269b4762425a10428fef42458a5f20372b6f633aa1a14b4b4ab417d64a15fcc012685543687a34e5639824469b8478d352532888af3f8bd7f8592f9 opendht-739f4d0c0d6aff5dd18d84269fe2e276e0530433.tar.gz
b9c28f1c540fa180224571cae186296442069619af11d0079f52554eb7af2bcb254cad3dddc49ef25e8b9ad8c9d97b924de0db07027f01b772c924421310bc27 opendht-104a9e3b283d3b8d7d86e31b7d911ca000a6e7ad.tar.gz
set BUILD=%SRC%..\build
set OPENDHT_VERSION=739f4d0c0d6aff5dd18d84269fe2e276e0530433
set OPENDHT_VERSION=104a9e3b283d3b8d7d86e31b7d911ca000a6e7ad
set OPENDHT_URL=https://github.com/savoirfairelinux/opendht/archive/%OPENDHT_VERSION%.tar.gz
mkdir %BUILD%
......
# OPENDHT
OPENDHT_VERSION := 739f4d0c0d6aff5dd18d84269fe2e276e0530433
OPENDHT_VERSION := 104a9e3b283d3b8d7d86e31b7d911ca000a6e7ad
OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz
PKGS += opendht
......
......@@ -51,7 +51,6 @@ ServerAccountManager::ServerAccountManager(
void
ServerAccountManager::setHeaderFields(Request& request){
request.set_header_field(restinio::http_field_t::host, request.get_url().host + ":" + request.get_url().service);
request.set_header_field(restinio::http_field_t::user_agent, "Jami");
request.set_header_field(restinio::http_field_t::accept, "application/json");
request.set_header_field(restinio::http_field_t::content_type, "application/json");
......@@ -83,10 +82,7 @@ ServerAccountManager::initAuthentication(
JAMI_WARN("[Auth] authentication with: %s to %s", ctx->credentials->username.c_str(), url.c_str());
auto request = std::make_shared<Request>(*Manager::instance().ioContext(), url, logger_);
auto reqid = request->id();
restinio::http_request_header_t header;
header.method(restinio::http_method_post());
request->set_header(header);
request->set_target(PATH_DEVICE);
request->set_method(restinio::http_method_post());
request->set_auth(ctx->credentials->username, ctx->credentials->password);
{
std::stringstream ss;
......@@ -206,10 +202,7 @@ ServerAccountManager::syncDevices()
JAMI_WARN("[Auth] syncDevices with: %s to %s", creds_->username.c_str(), url.c_str());
auto request = std::make_shared<Request>(*Manager::instance().ioContext(), url, logger_);
auto reqid = request->id();
restinio::http_request_header_t header;
header.method(restinio::http_method_get());
request->set_header(header);
request->set_target(PATH_DEVICE + "?username=" + creds_->username);
request->set_method(restinio::http_method_get());
request->set_auth(creds_->username, creds_->password);
setHeaderFields(*request);
request->add_on_state_change_callback([reqid, onAsync = onAsync_]
......@@ -265,10 +258,7 @@ ServerAccountManager::revokeDevice(const std::string& password, const std::strin
JAMI_WARN("[Revoke] Removing device of %s at %s", info_->username.c_str(), url.c_str());
auto request = std::make_shared<Request>(*Manager::instance().ioContext(), url, logger_);
auto reqid = request->id();
restinio::http_request_header_t header;
header.method(restinio::http_method_delete());
request->set_header(header);
request->set_target(PATH_DEVICE + "?deviceId=" + device);
request->set_method(restinio::http_method_delete());
request->set_auth(info_->username, password);
setHeaderFields(*request);
request->add_on_state_change_callback([reqid, cb, onAsync = onAsync_]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment