From 316789cf93aa05d65a978687e7ae12b825265875 Mon Sep 17 00:00:00 2001 From: Moritz Heusinger Date: Mon, 5 Apr 2021 23:05:42 +0200 Subject: [PATCH] chore: release v3.0.18 local link now respects port and protocol --- README.md | 3 +++ admin/index_m.html | 28 ++++++++++++++++++++++++---- hm-rega.js | 2 +- io-package.json | 31 ++++++++++++++++--------------- lib/rega.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 7 files changed, 47 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index b06a04f..74c68e9 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,9 @@ with the ioBroker CLI. You can change the port via `iob set hm-rega. - ### __WORK IN PROGRESS__ --> +### 3.0.18 (2021-04-05) +* (foxriver76) local link now respects port and protocol + ### 3.0.17 (2021-04-04) * (foxriver76) correctly identify incomplete requests diff --git a/admin/index_m.html b/admin/index_m.html index 0ad9758..882e95b 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -161,10 +161,6 @@ } } - if (settings.username === undefined) settings.username = ''; - if (settings.password === undefined) settings.password = ''; - if (settings.useHttps === undefined) settings.useHttps = false; - for (var key in settings) { if (settings.hasOwnProperty(key)) setValue(key, settings[key], onChange); } // endFor @@ -250,6 +246,24 @@ obj[$this.attr('id')] = $this.data('crypt') && $this.val() ? encrypt(secret, $this.val()) : $this.val(); } // endElse }); + + const webifPort = parseInt(obj.webinterfacePort) + + if (!webifPort || webifPort === 80 || webifPort === 443) { + // if no port set or standard port used - if user specified we do not change + if (obj.useHttps) { + obj.webinterfacePort = 443; + } else { + obj.webinterfacePort = 80; + } + } + + if (obj.useHttps) { + obj.webinterfaceProtocol = 'https'; + } else { + obj.webinterfaceProtocol = 'http'; + } + return obj; } @@ -585,6 +599,12 @@ +
+ +
+
+ +
diff --git a/hm-rega.js b/hm-rega.js index cbaeff6..d9a9ee7 100644 --- a/hm-rega.js +++ b/hm-rega.js @@ -310,7 +310,7 @@ function main() { rega = new Rega({ ccuIp: adapter.config.homematicAddress, - webinterfacePort: adapter.config.webinterfacePort, + webinterfacePort: adapter.config.webinterfacePort || adapter.config.useHttps ? 443 : 80, port: adapter.config.homematicPort, reconnectionInterval: adapter.config.reconnectionInterval, logger: adapter.log, diff --git a/io-package.json b/io-package.json index e99c250..366bd6a 100644 --- a/io-package.json +++ b/io-package.json @@ -1,8 +1,20 @@ { "common": { "name": "hm-rega", - "version": "3.0.17", + "version": "3.0.18", "news": { + "3.0.18": { + "en": "local link now respects port and protocol", + "de": "Die lokale Verbindung respektiert jetzt Port und Protokoll", + "ru": "локальная ссылка теперь уважает порт и протокол", + "pt": "o link local agora respeita a porta e o protocolo", + "nl": "lokale link respecteert nu poort en protocol", + "fr": "le lien local respecte désormais le port et le protocole", + "it": "il collegamento locale ora rispetta la porta e il protocollo", + "es": "el enlace local ahora respeta el puerto y el protocolo", + "pl": "łącze lokalne obsługuje teraz port i protokół", + "zh-cn": "本地链接现在遵守端口和协议" + }, "3.0.17": { "en": "correctly identify incomplete requests", "de": "unvollständige Anfragen korrekt identifizieren", @@ -230,18 +242,6 @@ "es": "ahora establecemos el tipo de objeto explícito al extender el objeto", "pl": "teraz ustawiamy jawny typ obiektu na rozszerzanie obiektu", "zh-cn": "现在,我们在扩展对象上设置显式对象类型" - }, - "2.6.19": { - "en": "fixed issue on syncing service message counter when invisible variables are synchronized", - "de": "Problem beim Synchronisieren des Dienstnachrichtenzählers beim Synchronisieren unsichtbarer Variablen behoben", - "ru": "исправлена проблема с синхронизацией счетчика служебных сообщений при синхронизации невидимых переменных", - "pt": "Foi corrigido o problema de sincronização do contador de mensagens de serviço quando variáveis invisíveis são sincronizadas", - "nl": "probleem opgelost bij het synchroniseren van serviceberichtenteller wanneer onzichtbare variabelen werden gesynchroniseerd", - "fr": "Correction d'un problème sur la synchronisation du compteur de messages de service lorsque les variables invisibles sont synchronisées", - "it": "risolto il problema relativo alla sincronizzazione del contatore dei messaggi del servizio quando le variabili invisibili sono sincronizzate", - "es": "Problema solucionado al sincronizar el contador de mensajes del servicio cuando se sincronizan variables invisibles", - "pl": "naprawiono problem z synchronizacją licznika komunikatów serwisowych, gdy synchronizowane są niewidoczne zmienne", - "zh-cn": "解决了同步不可见变量时同步服务消息计数器的问题" } }, "titleLang": { @@ -290,7 +290,7 @@ "ccu2" ], "localLinks": { - "_default": "http://%homematicAddress%" + "_default": "%webinterfaceProtocol%://%homematicAddress%:%webinterfacePort%" }, "type": "iot-systems", "connectionType": "local", @@ -335,7 +335,8 @@ "password": "", "useHttps": false, "showInvSysVar": false, - "webinterfacePort": 0 + "webinterfacePort": 80, + "webinterfaceProtocol": "http" }, "protectedNative": [ "username", diff --git a/lib/rega.js b/lib/rega.js index cc80274..30cb844 100644 --- a/lib/rega.js +++ b/lib/rega.js @@ -45,7 +45,7 @@ class Rega { if (this.options.ccuIp) { // if specific webinterface port provided use it, else use default https/http request({ - url: `${this.protocol + this.options.ccuIp}${this.options.webinterfacePort ? `:${this.options.webinterfacePort}` : ''}/ise/checkrega.cgi`, + url: `${this.protocol + this.options.ccuIp}:${this.options.webinterfacePort}/ise/checkrega.cgi`, strictSSL: false }, (error, response, body) => { if (!error && response.statusCode === 200) { diff --git a/package-lock.json b/package-lock.json index 5934d13..8cb75c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "iobroker.hm-rega", - "version": "3.0.17", + "version": "3.0.18", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4441e66..9258dfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.hm-rega", - "version": "3.0.17", + "version": "3.0.18", "engines": { "node": ">=10.0.0" },