|
@@ -61,6 +61,32 @@ HTTPRET CNetWork::GetServerNode(std::string& data) {
|
|
|
return HTTPRET::http_yes;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+HTTPRET CNetWork::GetSysConfig(std::string& data)
|
|
|
+{
|
|
|
+ std::vector<cpr::Parameter> p;
|
|
|
+ std::string text = GetUrl("/api/client/v3/getconfig", p);
|
|
|
+ if (text.empty()) {
|
|
|
+ if (m_http_status == 445)
|
|
|
+ {
|
|
|
+ return HTTPRET::http_user_expired_at;
|
|
|
+ }
|
|
|
+ else if (m_http_status == 446)
|
|
|
+ {
|
|
|
+ return HTTPRET::http_user_transfer_enable;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return HTTPRET::http_f;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ data = text.c_str();
|
|
|
+
|
|
|
+ return HTTPRET::http_yes;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
HTTPRET CNetWork::PostLogin(LPCSTR username, LPCSTR password, std::string& data)
|
|
|
{
|
|
|
std::vector<cpr::Pair> p;
|
|
@@ -86,6 +112,31 @@ HTTPRET CNetWork::PostLogin(LPCSTR username, LPCSTR password, std::string& data)
|
|
|
return HTTPRET::http_yes;
|
|
|
}
|
|
|
|
|
|
+HTTPRET CNetWork::GetSysConfigFromUser(LPCSTR username, LPCSTR password, std::string& data) {
|
|
|
+ std::vector<cpr::Parameter> p;
|
|
|
+ p.push_back({ "email",username });
|
|
|
+ p.push_back({ "password",password });
|
|
|
+ std::string text = GetUrl("/api/client/v3/getconfig", p);
|
|
|
+ if (text.empty()) {
|
|
|
+ if (m_http_status == 445)
|
|
|
+ {
|
|
|
+ return HTTPRET::http_user_expired_at;
|
|
|
+ }
|
|
|
+ else if (m_http_status == 446)
|
|
|
+ {
|
|
|
+ return HTTPRET::http_user_transfer_enable;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return HTTPRET::http_f;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ data = text.c_str();
|
|
|
+
|
|
|
+ return HTTPRET::http_yes;
|
|
|
+}
|
|
|
+
|
|
|
void CNetWork::SetUrl(LPCSTR url)
|
|
|
{
|
|
|
m_url = url;
|
|
@@ -138,10 +189,10 @@ std::string CNetWork::GetUrl(std::string path, std::vector<cpr::Parameter> param
|
|
|
|
|
|
if (parame.empty())
|
|
|
{
|
|
|
- r = cpr::Get(cpr::Url{ s.c_str() }, hander, cpr::Timeout{ 60 * 100 });
|
|
|
+ r = cpr::Get(cpr::Url{ s.c_str() }, cpr::VerifySsl{ false }, hander, cpr::Timeout{ 60 * 1000 });
|
|
|
}
|
|
|
else {
|
|
|
- r = cpr::Get(cpr::Url{ s.c_str() }, ps, hander, cpr::Timeout{ 60 * 100 });
|
|
|
+ r = cpr::Get(cpr::Url{ s.c_str() }, cpr::VerifySsl{ false }, ps, hander, cpr::Timeout{ 60 * 1000 });
|
|
|
}
|
|
|
if (r.status_code == 200 || r.status_code == 201)
|
|
|
{
|
|
@@ -202,12 +253,12 @@ std::string CNetWork::PostUrl(std::string path, std::vector<cpr::Pair> parame, s
|
|
|
|
|
|
if (parame.empty())
|
|
|
{
|
|
|
- r = cpr::Get(cpr::Url{ s.c_str() }, hander, cpr::Timeout{ 60 * 100 });
|
|
|
+ r = cpr::Get(cpr::Url{ s.c_str() }, hander, cpr::VerifySsl{false}, cpr::Timeout{ 60 * 1000 });
|
|
|
}
|
|
|
else {
|
|
|
- r = cpr::Post(cpr::Url{ s.c_str() }, cpr::Payload{ parame.begin(),parame.end() }, hander, cpr::Timeout{ 60 * 100 });
|
|
|
+ r = cpr::Post(cpr::Url{ s.c_str() }, cpr::VerifySsl{ false }, cpr::Payload{ parame.begin(),parame.end() }, hander, cpr::Timeout{ 60 * 1000 });
|
|
|
}
|
|
|
-
|
|
|
+ Logger::getSingletonPtr()->DEBUG(r.url.c_str());
|
|
|
if (r.status_code == 200 || r.status_code == 201)
|
|
|
{
|
|
|
res_test = std::move(r.text);
|