tABC_CC ABC_LoginServerOtpStatus(const Lobby &lobby, tABC_U08Buf LP1, bool *on, long *timeout, tABC_Error *pError) { tABC_CC cc = ABC_CC_Ok; json_t *pJSON_Value = NULL; JsonPtr reply; std::string url = ABC_SERVER_ROOT "/otp/status"; ABC_CHECK_RET(ABC_LoginServerOtpRequest(url.c_str(), lobby, LP1, &reply, pError)); pJSON_Value = json_object_get(reply.get(), ABC_SERVER_JSON_OTP_ON); ABC_CHECK_ASSERT((pJSON_Value && json_is_boolean(pJSON_Value)), ABC_CC_JSONError, "Error otp/on JSON"); *on = json_is_true(pJSON_Value); if (*on) { pJSON_Value = json_object_get(reply.get(), ABC_SERVER_JSON_OTP_TIMEOUT); ABC_CHECK_ASSERT((pJSON_Value && json_is_integer(pJSON_Value)), ABC_CC_JSONError, "Error otp/timeout JSON"); *timeout = json_integer_value(pJSON_Value); } exit: return cc; }
Status loginServerUploadLogs(const Account *account) { const auto url = ABC_SERVER_ROOT "/account/debug"; JsonPtr json; HttpReply reply; DataChunk logData = debugLogLoad(); if (account) { JsonArray jsonArray; auto ids = account->wallets.list(); for (const auto &id: ids) { std::shared_ptr<Wallet> wallet; if (cacheWallet(wallet, nullptr, id.c_str())) { DataChunk watchData; ABC_CHECK(fileLoad(watchData, watcherPath(*wallet))); jsonArray.append( json_string(base64Encode(watchData).c_str())); } } json.reset(json_pack("{ss, ss, ss}", ABC_SERVER_JSON_L1_FIELD, base64Encode(account->login.lobby.authId()).c_str(), ABC_SERVER_JSON_LP1_FIELD, base64Encode(account->login.authKey()).c_str(), "log", base64Encode(logData).c_str())); if (jsonArray) json_object_set(json.get(), "watchers", jsonArray.get()); } else { json.reset(json_pack("{ss}", "log", base64Encode(logData).c_str())); } ABC_CHECK(AirbitzRequest().post(reply, url, json.encode())); return Status(); }