Committing updates.
This commit is contained in:
@@ -582,7 +582,6 @@ namespace Apostol {
|
||||
|
||||
const auto& caModuleAddress = Config()->IniFile().ReadString("module", "address", "");
|
||||
|
||||
const auto& caAuthorization = pServerRequest->Headers["authorization"];
|
||||
const auto& caOrigin = pServerRequest->Headers["origin"];
|
||||
const auto& caUserAddress = pServerRequest->Params["address"];
|
||||
|
||||
@@ -787,8 +786,7 @@ namespace Apostol {
|
||||
|
||||
CHTTPRequest::Prepare(pProxyRequest, Method.c_str(), URI.c_str());
|
||||
|
||||
if (!caAuthorization.IsEmpty())
|
||||
pProxyRequest->AddHeader("Authorization", caAuthorization);
|
||||
pProxyRequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]);
|
||||
|
||||
if (!caModuleAddress.IsEmpty())
|
||||
pProxyRequest->AddHeader("Module-Address", caModuleAddress);
|
||||
@@ -875,7 +873,6 @@ namespace Apostol {
|
||||
if (checkFee == -1)
|
||||
throw ExceptionFrm("Invalid module fee value: %s", caModuleFee.c_str());
|
||||
|
||||
const auto& caAuthorization = pServerRequest->Headers["authorization"];
|
||||
const auto& caOrigin = pServerRequest->Headers["origin"];
|
||||
const auto& caUserAddress = pServerRequest->Params["address"];
|
||||
|
||||
@@ -1244,8 +1241,7 @@ namespace Apostol {
|
||||
|
||||
CHTTPRequest::Prepare(pProxyRequest, Method.c_str(), URI.c_str());
|
||||
|
||||
if (!caAuthorization.IsEmpty())
|
||||
pProxyRequest->AddHeader("Authorization", caAuthorization);
|
||||
pProxyRequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]);
|
||||
|
||||
if (!caModuleAddress.IsEmpty())
|
||||
pProxyRequest->AddHeader("Module-Address", caModuleAddress);
|
||||
@@ -1628,7 +1624,7 @@ namespace Apostol {
|
||||
PGP.StatusTime = Now();
|
||||
PGP.Status = CKeyContext::ksFetching;
|
||||
|
||||
CHTTPRequest::Prepare(ARequest, "GET", CString().Format("/api/v1/key/public?account=%s", PGP.Name.c_str()).c_str());
|
||||
CHTTPRequest::Prepare(ARequest, "GET", CString().Format("/api/v1/key/public?account=%s&type=pgp", PGP.Name.c_str()).c_str());
|
||||
|
||||
ARequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]);
|
||||
};
|
||||
@@ -1702,15 +1698,16 @@ namespace Apostol {
|
||||
|
||||
const auto& caServerContext = CurrentServer().Value();
|
||||
|
||||
Log()->Debug(0, "Trying to fetch a BTC KEY%d from: %s", m_KeyIndex + 1, caServerContext.URI.c_str());
|
||||
Log()->Debug(0, "Trying to fetch a BTC key \"%s\" from: %s", BTC.Name.c_str(), caServerContext.URI.c_str());
|
||||
|
||||
auto OnRequest = [this, &BTC](CHTTPClient *Sender, CHTTPRequest *ARequest) {
|
||||
const auto& caServerContext = CurrentServer().Value();
|
||||
BTC.StatusTime = Now();
|
||||
BTC.Status = CKeyContext::ksFetching;
|
||||
CString URI("/api/v1/key?type=BTC-PUBLIC&name=KEY");
|
||||
URI << m_KeyIndex + 1;
|
||||
CHTTPRequest::Prepare(ARequest, "GET", URI.c_str());
|
||||
|
||||
CHTTPRequest::Prepare(ARequest, "GET", CString().Format("/api/v1/key/public?account=%s&type=btc", BTC.Name.c_str()).c_str());
|
||||
|
||||
ARequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]);
|
||||
};
|
||||
|
||||
auto OnExecute = [this, &BTC](CTCPConnection *AConnection) {
|
||||
@@ -1771,6 +1768,7 @@ namespace Apostol {
|
||||
void CWebService::Reload() {
|
||||
|
||||
m_Providers.Clear();
|
||||
m_Tokens.Clear();
|
||||
|
||||
const auto &oauth2 = Config()->IniFile().ReadString(CONFIG_SECTION_NAME, "oauth2", "oauth2/service.json");
|
||||
const auto &provider = CString(SYSTEM_PROVIDER_NAME);
|
||||
@@ -1802,15 +1800,13 @@ namespace Apostol {
|
||||
|
||||
if (m_Servers.Count() == 0) {
|
||||
#ifdef _DEBUG
|
||||
int Index = m_Servers.AddPair("BM-2cXtL92m3CavBKx8qsV2LbZtAU3eQxW2rB", CServerContext("http://localhost:4988"));
|
||||
int Index = m_Servers.AddPair(BPS_BM_DEBUG_ADDRESS, CServerContext(BPS_SERVER_URL));
|
||||
m_Servers[Index].Value().PGP.Name = m_Servers[Index].Name();
|
||||
#else
|
||||
m_Servers.Add(m_DefaultServer);
|
||||
#endif
|
||||
}
|
||||
|
||||
// const auto& caServer = CurrentServer().Value();
|
||||
|
||||
if (m_Status == psRunning) {
|
||||
if (now >= m_RandomDate) {
|
||||
FetchKeys();
|
||||
|
||||
Reference in New Issue
Block a user