Skip to content

Commit 3025810

Browse files
committed
TLS and Auth Support (#99)
1 parent 7cbe77b commit 3025810

File tree

5 files changed

+223
-24
lines changed

5 files changed

+223
-24
lines changed

main.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ function findInterfaces() {
184184
config.daemons[iface] = {
185185
type: iface,
186186
ip: config.ccuAddress,
187+
isSecure: config.useTLS,
188+
useAuth: config.useAuth,
189+
user: config.user,
190+
pass: config.pass,
187191
port: ports[iface],
188192
protocol: iface === 'CUxD' ? 'binrpc' : 'xmlrpc',
189193
reinitTimeout: iface === 'HmIP' ? 600000 : 60000,
@@ -194,7 +198,11 @@ function findInterfaces() {
194198
initRpcClients();
195199
if (regaPresent) {
196200
rega = new Rega({
197-
host: config.ccuAddress
201+
host: config.ccuAddress,
202+
tls: config.useTls,
203+
auth: config.useAuth,
204+
user: config.user,
205+
pass: config.pass
198206
});
199207
getRegaNames();
200208
}
@@ -311,11 +319,25 @@ function initRpcClients() {
311319
config.daemons[daemon].ident = daemon === 'CUxD' ? 'CUxD' : 'hmm_' + daemon;
312320
daemonIndex[config.daemons[daemon].ident] = daemon;
313321

314-
rpcClients[daemon] = (config.daemons[daemon].protocol === 'binrpc' ? binrpc : xmlrpc).createClient({
322+
const clientOptions = {
315323
host: config.daemons[daemon].ip,
316324
port: config.daemons[daemon].port,
317325
path: config.daemons[daemon].path,
318-
});
326+
isSecure: config.daemons[daemon].isSecure,
327+
};
328+
329+
if (config.daemons[daemon].isSecure && config.daemons[daemon].ident !== 'CUxD') {
330+
config.daemons[daemon].port = 40000 + config.daemons[daemon].port;
331+
}
332+
333+
if (config.daemons[daemon].useAuth) {
334+
clientOptions.basic_auth = {
335+
user: config.daemons[daemon].user,
336+
pass: config.daemons[daemon].pass
337+
}
338+
}
339+
340+
rpcClients[daemon] = (config.daemons[daemon].protocol === 'binrpc' ? binrpc : xmlrpc).createClient(clientOptions);
319341

320342
initRpcServer(config.daemons[daemon].protocol);
321343
init(daemon);

package-lock.json

Lines changed: 157 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "homematic-manager",
3-
"version": "2.5.1",
3+
"version": "2.6.0",
44
"private": true,
55
"dependencies": {
66
"async": "2.6.2",
@@ -11,7 +11,7 @@
1111
"electron-window-state": "5.0.3",
1212
"free-jqgrid": "4.15.5",
1313
"hm-discover": "1.1.0",
14-
"homematic-rega": "1.3.5",
14+
"homematic-rega": "^1.4.0",
1515
"homematic-xmlrpc": "1.0.2",
1616
"instascan": "1.0.0",
1717
"jquery": "3.3.1",

0 commit comments

Comments
 (0)