Skip to content

Commit dc79780

Browse files
committed
Merge branch 'MyDomoticz' of /home/domoshare into MyDomoticz
Conflicts: webserver/proxyclient.cpp
2 parents 406045f + f657d5e commit dc79780

File tree

10 files changed

+1501
-1391
lines changed

10 files changed

+1501
-1391
lines changed

main/WebServer.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6481,6 +6481,13 @@ namespace http {
64816481
m_sql.UpdatePreferencesVar("FloorplanActiveOpacity", atoi(m_pWebEm->FindValue("FloorplanActiveOpacity").c_str()));
64826482
m_sql.UpdatePreferencesVar("FloorplanInactiveOpacity", atoi(m_pWebEm->FindValue("FloorplanInactiveOpacity").c_str()));
64836483

6484+
std::string md_userid, md_password;
6485+
md_userid = m_pWebEm->FindValue("MyDomoticzUserId");
6486+
md_password = m_pWebEm->FindValue("MyDomoticzPassword");
6487+
m_sql.UpdatePreferencesVar("MyDomoticzUserId", md_userid);
6488+
md_password = base64_encode((const unsigned char *)md_password.c_str(), md_password.length());
6489+
m_sql.UpdatePreferencesVar("MyDomoticzPassword", md_password);
6490+
64846491
m_notifications.LoadConfig();
64856492

64866493
return (char*)m_retstr.c_str();
@@ -10602,6 +10609,16 @@ namespace http {
1060210609
{
1060310610
root["WebTheme"] = sValue;
1060410611
}
10612+
else if (Key == "MyDomoticzInstanceId") {
10613+
root["MyDomoticzInstanceId"] = sValue;
10614+
}
10615+
else if (Key == "MyDomoticzUserId") {
10616+
root["MyDomoticzUserId"] = sValue;
10617+
}
10618+
else if (Key == "MyDomoticzPassword") {
10619+
std::string tmp = base64_decode(sValue);
10620+
root["MyDomoticzPassword"] = tmp;
10621+
}
1060510622
}
1060610623
}
1060710624

main/WebServerHelper.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "stdafx.h"
22
#include "WebServerHelper.h"
3+
#include "../main/SQLHelper.h"
34

45
namespace http {
56
namespace server {
@@ -50,7 +51,8 @@ namespace http {
5051

5152
#if 1
5253
// RK: TODO
53-
const int connections = 3;
54+
//m_sql.UpdatePreferencesVar("MyDomoticzInstanceId", "");
55+
const int connections = GetNrMyDomoticzThreads();
5456
proxymanagerCollection.resize(connections);
5557
for (int i = 0; i < connections; i++) {
5658
proxymanagerCollection[i] = new CProxyManager(serverpath, plainServer_->m_pWebEm);
@@ -112,5 +114,18 @@ namespace http {
112114
(*it)->ReloadCustomSwitchIcons();
113115
}
114116
}
117+
118+
int CWebServerHelper::GetNrMyDomoticzThreads()
119+
{
120+
std::string instanceid;
121+
int nrThreads = 3;
122+
m_sql.GetPreferencesVar("MyDomoticzInstanceId", instanceid);
123+
if (instanceid == "") {
124+
return 1;
125+
}
126+
m_sql.GetPreferencesVar("MyDomoticzNrThreads", nrThreads);
127+
return nrThreads;
128+
}
115129
}
130+
116131
}

main/WebServerHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace http {
3030

3131
// RK: TODO
3232
std::vector<CProxyManager*> proxymanagerCollection;
33+
int GetNrMyDomoticzThreads();
3334
};
3435

3536
} // end namespace server

0 commit comments

Comments
 (0)