Status loginServerUploadLogs(Account *account) { const auto url = ABC_SERVER_ROOT "/v1/account/debug"; ServerRequestJson json; if (account) { json.setup(account->login); // Failure is fine JsonArray jsonArray; auto ids = account->wallets.list(); for (const auto &id: ids) { std::shared_ptr<Wallet> wallet = cacheWalletSoft(id); if (wallet) { const auto name = wallet->name(); logInfo("Wallet '" + name + "' " + id); const auto addresses = wallet->addresses.list(); for (const auto &address: addresses) logInfo(address); } DataChunk watchData; if (fileLoad(watchData, WalletPaths(id).cachePath())) { jsonArray.append( json_string(base64Encode(watchData).c_str())); } } json.set("watchers", jsonArray); // Failure is fine AutoFree<tABC_AccountSettings, accountSettingsFree> settings; settings.get() = accountSettingsLoad(*account); std::string servers(settings->szOverrideBitcoinServerList); std::string strOverride = (settings->bOverrideBitcoinServers ? "true" : "false"); logInfo("bOverrideBitcoinServers:" + strOverride); logInfo("szOverrideBitcoinServerList:" + servers); } DataChunk logData = debugLogLoad(); json.set("log", base64Encode(logData)); // Failure is fine HttpReply reply; ABC_CHECK(AirbitzRequest().post(reply, url, json.encode())); return Status(); }
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(); }