diff --git a/main.js b/main.js index e9aab3c..fbf86ff 100755 --- a/main.js +++ b/main.js @@ -184,6 +184,10 @@ function findInterfaces() { config.daemons[iface] = { type: iface, ip: config.ccuAddress, + isSecure: config.useTLS, + useAuth: config.useAuth, + user: config.user, + pass: config.pass, port: ports[iface], protocol: iface === 'CUxD' ? 'binrpc' : 'xmlrpc', reinitTimeout: iface === 'HmIP' ? 600000 : 60000, @@ -194,7 +198,11 @@ function findInterfaces() { initRpcClients(); if (regaPresent) { rega = new Rega({ - host: config.ccuAddress + host: config.ccuAddress, + tls: config.useTls, + auth: config.useAuth, + user: config.user, + pass: config.pass }); getRegaNames(); } @@ -311,11 +319,25 @@ function initRpcClients() { config.daemons[daemon].ident = daemon === 'CUxD' ? 'CUxD' : 'hmm_' + daemon; daemonIndex[config.daemons[daemon].ident] = daemon; - rpcClients[daemon] = (config.daemons[daemon].protocol === 'binrpc' ? binrpc : xmlrpc).createClient({ + const clientOptions = { host: config.daemons[daemon].ip, port: config.daemons[daemon].port, path: config.daemons[daemon].path, - }); + isSecure: config.daemons[daemon].isSecure, + }; + + if (config.daemons[daemon].isSecure && config.daemons[daemon].ident !== 'CUxD') { + config.daemons[daemon].port = 40000 + config.daemons[daemon].port; + } + + if (config.daemons[daemon].useAuth) { + clientOptions.basic_auth = { + user: config.daemons[daemon].user, + pass: config.daemons[daemon].pass + } + } + + rpcClients[daemon] = (config.daemons[daemon].protocol === 'binrpc' ? binrpc : xmlrpc).createClient(clientOptions); initRpcServer(config.daemons[daemon].protocol); init(daemon); diff --git a/package-lock.json b/package-lock.json index 47cc164..50120e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "homematic-manager", - "version": "2.5.1", + "version": "2.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1136,6 +1136,21 @@ "core-assert": "^0.2.0" } }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + }, + "dependencies": { + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + } + } + }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -1468,6 +1483,40 @@ "is-arrayish": "^0.2.1" } }, + "es-abstract": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.15.0.tgz", + "integrity": "sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ==", + "requires": { + "es-to-primitive": "^1.2.0", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.0", + "is-callable": "^1.1.4", + "is-regex": "^1.0.4", + "object-inspect": "^1.6.0", + "object-keys": "^1.1.1", + "string.prototype.trimleft": "^2.1.0", + "string.prototype.trimright": "^2.1.0" + }, + "dependencies": { + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + } + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "es6-promise": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", @@ -2533,8 +2582,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "functional-red-black-tree": { "version": "1.0.1", @@ -2701,7 +2749,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -2712,6 +2759,11 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -2761,14 +2813,24 @@ } }, "homematic-rega": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/homematic-rega/-/homematic-rega-1.3.5.tgz", - "integrity": "sha512-Z7EOywBZDLtxC7alIC+/SQ5trQu+DUfnKS/owE1lwzugbZ63f2xuKkyXtJ1Eti6bWoE8UmyEpi2pae8ioQFGSQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/homematic-rega/-/homematic-rega-1.4.0.tgz", + "integrity": "sha512-izopJrkdwyHtMW6MXYGX63tg9FPVcll8lcmvXde2bXFfNGnpWLg7YWv3tkX2/8ATkQ6LZMVbj9vjRoQOKWBudw==", "requires": { - "iconv-lite": "^0.4.24", + "iconv-lite": "^0.5.0", "request": "^2.88.0", - "temp-dir": "^1.0.0", - "xml2js": "^0.4.19" + "temp-dir": "^2.0.0", + "xml2js": "^0.4.22" + }, + "dependencies": { + "iconv-lite": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz", + "integrity": "sha512-NnEhI9hIEKHOzJ4f697DMz9IQEXr/MMJ5w64vN2/4Ai+wRnvV7SBrL0KLoRlwaKVghOc7LQ5YkPLuX146b6Ydw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } } }, "homematic-xmlrpc": { @@ -2817,6 +2879,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -3020,6 +3083,11 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -3049,6 +3117,11 @@ } } }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -3230,6 +3303,14 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "requires": { + "has": "^1.0.1" + } + }, "is-retry-allowed": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", @@ -3242,6 +3323,14 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "requires": { + "has-symbols": "^1.0.0" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -3917,6 +4006,11 @@ } } }, + "object-inspect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", + "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" + }, "object-keys": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", @@ -3932,6 +4026,15 @@ "isobject": "^3.0.0" } }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -5444,6 +5547,24 @@ "strip-ansi": "^3.0.0" } }, + "string.prototype.trimleft": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", + "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", + "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", @@ -5607,9 +5728,9 @@ } }, "temp-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", - "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz", + "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==" }, "temp-file": { "version": "3.3.2", @@ -5989,6 +6110,15 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", @@ -6165,18 +6295,27 @@ "dev": true }, "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "version": "0.4.22", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.22.tgz", + "integrity": "sha512-MWTbxAQqclRSTnehWWe5nMKzI3VmJ8ltiJEco8akcC6j3miOhjjfzKum5sId+CWhfxdOs/1xauYr8/ZDBtQiRw==", "requires": { "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "util.promisify": "~1.0.0", + "xmlbuilder": "~11.0.0" + }, + "dependencies": { + "xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" + } } }, "xmlbuilder": { "version": "9.0.7", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "dev": true }, "xmldom": { "version": "0.1.27", diff --git a/package.json b/package.json index 63b716d..5559141 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homematic-manager", - "version": "2.5.1", + "version": "2.6.0", "private": true, "dependencies": { "async": "2.6.2", @@ -11,7 +11,7 @@ "electron-window-state": "5.0.3", "free-jqgrid": "4.15.5", "hm-discover": "1.1.0", - "homematic-rega": "1.3.5", + "homematic-rega": "^1.4.0", "homematic-xmlrpc": "1.0.2", "instascan": "1.0.0", "jquery": "3.3.1", diff --git a/www/index.html b/www/index.html index 1904b4c..2c323d4 100755 --- a/www/index.html +++ b/www/index.html @@ -303,6 +303,22 @@
+ + +
++ + +
++ + +
++ + +
diff --git a/www/js/homematic-manager.js b/www/js/homematic-manager.js index 3fbeeb8..9dcd03c 100755 --- a/www/js/homematic-manager.js +++ b/www/js/homematic-manager.js @@ -548,7 +548,7 @@ function initDialogsMisc() { autoOpen: false, modal: true, width: 640, - height: 400, + height: 480, buttons: [ { text: _('Save & Restart'), @@ -556,10 +556,14 @@ function initDialogsMisc() { $(this).dialog('close'); config.rpcInitIp = $.trim($('#init-ip-select').val()); config.ccuAddress = $.trim($('#ccu-address').val()); + config.user = $.trim($('#auth-user').val()); + config.pass = $.trim($('#auth-pass').val()); config.rpcLogFolder = $.trim($('#rpc-log-folder').val()); config.rpcDelay = parseInt($.trim($('#rpc-delay').val()), 10) || 100; config.clearCache = $('#clear-cache').is(':checked'); config.showUnhandled = $('#show-unhandled').is(':checked'); + config.useAuth = $('#use-auth').is(':checked'); + config.useTLS = $('#use-tls').is(':checked'); config.hideNameCols = $('#hide-name-cols').is(':checked'); ipcRpc.send('config', [config]); } @@ -4628,6 +4632,16 @@ $('.externalLink').click(function () { shell.openExternal($(this).data('href')); }); +$('#use-auth').change(function () { + if ($(this).is(':checked')) { + $('#auth-user').removeAttr('disabled'); + $('#auth-pass').removeAttr('disabled'); + } else { + $('#auth-user').attr('disabled', true); + $('#auth-pass').attr('disabled', true); + } +}); + function dialogConfigOpen() { $('#init-ip-select').html(''); config.rpcInitIpSelect.forEach(ip => { @@ -4639,8 +4653,16 @@ function dialogConfigOpen() { }); $('#ccu-address').val(config.ccuAddress); + $('#auth-user').val(config.user); + $('#auth-pass').val(config.pass); $('#rpc-log-folder').val(config.rpcLogFolder); $('#rpc-delay').val(config.rpcDelay); + if (config.useTLS) { + $('#use-tls').prop('checked', true); + } + if (config.useAuth) { + $('#use-auth').prop('checked', true).trigger('change'); + } if (config.showUnhandled) { $('#show-unhandled').prop('checked', true); }