Skip to content

Commit

Permalink
Merge pull request #69 from Feuer-sturm/master
Browse files Browse the repository at this point in the history
jsonconfig, password encrptyed
  • Loading branch information
mcm1957 authored Dec 12, 2024
2 parents 57f2dd6 + 8bf6ea5 commit 747c458
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 8 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ main.test.js
test
gulpfile.js
.travis.yml
.dev-server/
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ This adapter would not have been possible without the great work of Marius Burka
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### WORK IN PROGRESS
* (Feuersturm) BREAKING: The password is stored encrypted now. Please reenter you password at configuration page. This is required only once after migration from release < 2.0.0 to release 2.0.0 or newer.
* (Feuersturm) switch adapter config to jsonconfig


### 1.0.1 (2024-06-06)
* (mcm1957) Adapter requires node.js 18 and js-controller >= 5 now
* (mcm1957) Adapter has been move to iobroker-community-adapters organization
Expand Down
File renamed without changes.
56 changes: 56 additions & 0 deletions admin/jsonConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"type": "panel",
"i18n": true,
"items": {
"header": {
"newLine": true,
"type": "header",
"text": "Rainbird",
"size": 2
},
"ipaddress": {
"type": "text",
"label": "ipaddress",
"newLine": true,
"xs": 12,
"sm": 12,
"md": 6,
"lg": 4,
"xl": 4
},
"password": {
"type": "password",
"label": "password",
"visible": true,
"newLine": true,
"xs": 12,
"sm": 12,
"md": 6,
"lg": 4,
"xl": 4
},
"pollinterval": {
"type": "number",
"label": "pollinterval",
"newLine": true,
"xs": 12,
"sm": 12,
"md": 6,
"lg": 4,
"xl": 4
},
"staticTextNote": {
"type": "staticText",
"label": "on save adapter restarts with new config immediately",
"style": {
"fontSize": 16
},
"newLine": true,
"xs": 12,
"sm": 12,
"md": 6,
"lg": 6,
"xl": 6
}
}
}
71 changes: 67 additions & 4 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"common": {
"name": "rainbird",
"version": "1.0.1",
"news": {
"news": {
"1.0.1": {
"en": "Adapter requires node.js 18 and js-controller >= 5 now\nAdapter has been move to iobroker-community-adapters organization\nAdapter-core has been adapter, adapter supports js-controller 6 now.\nDependencies have been updated",
"de": "Adapter benötigt node.js 18 und js-controller >= 5 jetzt\nAdapter wurde auf iobroker-community-Adapter Organisation verschoben\nAdapter-Kern ist Adapter, Adapter unterstützt jetzt js-controller 6.\nAbhängigkeiten wurden aktualisiert",
Expand Down Expand Up @@ -73,6 +73,9 @@
"readme": "https://github.com/iobroker-community-adapters/ioBroker.rainbird/blob/master/README.md",
"loglevel": "info",
"tier": 2,
"adminUI": {
"config": "json"
},
"type": "garden",
"licenseInformation": {
"license": "MIT",
Expand All @@ -93,10 +96,70 @@
{
"admin": ">=6.13.16"
}
]
],
"messages": [
{
"condition": {
"operand": "and",
"rules": [
"oldVersion<1.0.2",
"newVersion>=1.0.2"
]
},
"title": {
"en": "Important notice!",
"de": "Wichtiger Hinweis!",
"ru": "Важное замечание!",
"pt": "Notícia importante!",
"nl": "Belangrijke mededeling!",
"fr": "Avis important!",
"it": "Avviso IMPORTANTE!",
"es": "Noticia importante!",
"pl": "Ważna uwaga!",
"zh-cn": "重要通知!",
"uk": "Важливе повідомлення!"
},
"text": {
"en": "The password is stored encrypted starting with release 1.0.2. Please open configuration page and reenter your password again. This action is required only once.",
"de": "Das Passwort wird ab Release 1.0.2 verschlüsselt gespeichert. Bitte öffnen Sie die Konfigurationsseite und geben Sie Ihr Passwort erneut ein. Diese Aktion ist nur einmal erforderlich.",
"ru": "Пароль хранится зашифрованным, начиная с релиза 1.0.2. Пожалуйста, откройте страницу настройки и снова введите свой пароль. Это действие требуется только один раз.",
"pt": "A senha é armazenada criptografada começando com a versão 1.0.2. Por favor, abra a página de configuração e reinsira sua senha novamente. Esta ação é necessária apenas uma vez.",
"nl": "Het wachtwoord wordt versleuteld opgeslagen, te beginnen met release 1.0.2. Open de configuratiepagina en voer uw wachtwoord opnieuw in. Deze actie is slechts één keer nodig.",
"fr": "Le mot de passe est stocké crypté à partir de la version 1.0.2. Veuillez ouvrir la page de configuration et réentrer votre mot de passe. Cette mesure n'est requise qu'une seule fois.",
"it": "La password viene memorizzata a partire dal rilascio 1.0.2. Si prega di aprire la pagina di configurazione e reinserire nuovamente la password. Questa azione è richiesta solo una volta.",
"es": "La contraseña se almacena encriptada comenzando con el lanzamiento 1.0.0. Por favor, abra la página de configuración y vuelva a introducir su contraseña. Esta acción sólo se requiere una vez.",
"pl": "Hasło jest zapisywane zaszyfrowane począwszy od wydania 1.0.2. Proszę otworzyć stronę konfiguracji i ponownie wprowadzić hasło. Działanie to jest wymagane tylko raz.",
"uk": "Зашифрований пароль з релізом 1.0.2. Введіть номер мобільного, який Ви вказали при укладаннi договору з нами Ця дія потрібна тільки один раз.",
"zh-cn": "密码是从1.0.2发布开始的加密存储. 请打开配置页面并再次输入密码 。 只需采取这一行动一次."
},
"link": "https://github.com/iobroker-community-adapters/ioBroker.rainbird#changelog",
"level": "warn",
"linkText": {
"en": "Changelog",
"de": "Änderungsprotokoll",
"ru": "Список изменений",
"pt": "Registro de alterações",
"nl": "Wijzigingslog",
"fr": "Journal des modifications",
"it": "Registro delle modifiche",
"es": "registro de cambios",
"pl": "Dziennik zmian",
"zh-cn": "变更日志",
"uk": "Журнал змін"
},
"buttons": [
"agree",
"cancel"
]
}
]
},
"protectedNative": [],
"encryptedNative": [],
"protectedNative": [
"password"
],
"encryptedNative": [
"password"
],
"native": {
"ipaddress": "",
"password": "",
Expand Down
11 changes: 7 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,16 @@ function startAdapter(options) {
adapter.log.info('[START] Starting Rain Bird adapter V' + adapterVersion + '' + patchVersion);
adapter.setState('info.connection', true, true);
adapter.getForeignObject('system.config', (err, obj) => {
if (obj && obj.native && obj.native.secret) {

//Not necessary any more after changing to jsonconfig and password stored encrypted in io-packages.json:
/*if (obj && obj.native && obj.native.secret) {
//noinspection JSUnresolvedVariable
adapter.config.password = ioBLib.decrypt(obj.native.secret, adapter.config.password);
//adapter.config.password = ioBLib.decrypt(obj.native.secret, adapter.config.password);
} else {
//noinspection JSUnresolvedVariable
adapter.config.password = ioBLib.decrypt('Zgfr56gFe87jJOM', adapter.config.password);
}
//adapter.config.password = ioBLib.decrypt('Zgfr56gFe87jJOM', adapter.config.password);
}*/

main();
});
Expand Down

0 comments on commit 747c458

Please sign in to comment.