diff --git a/README.md b/README.md index 0360056..7394e5b 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,10 @@ Basically there are three ways to execute the command: ## Changelog ### **WORK IN PROGRESS** +### 1.5.9 (2023-08-12) +* (grizzelbee) Fix: First device of any user was missing in users viewing +* (grizzelbee) New: Added an icon to peers, users, peer and user + ### 1.5.8 (2023-08-11) * (grizzelbee) Fix: Interface is now correctly set to offline if host is not reachable. diff --git a/admin/network-interface-card.svg b/admin/icons/network-interface-card.svg similarity index 100% rename from admin/network-interface-card.svg rename to admin/icons/network-interface-card.svg diff --git a/admin/icons/peer.svg b/admin/icons/peer.svg new file mode 100644 index 0000000..91c1831 --- /dev/null +++ b/admin/icons/peer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/icons/peers.svg b/admin/icons/peers.svg new file mode 100644 index 0000000..39eee40 --- /dev/null +++ b/admin/icons/peers.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/icons/user.svg b/admin/icons/user.svg new file mode 100644 index 0000000..79e8281 --- /dev/null +++ b/admin/icons/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/icons/users.svg b/admin/icons/users.svg new file mode 100644 index 0000000..3151d09 --- /dev/null +++ b/admin/icons/users.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/io-package.json b/io-package.json index bcbe003..f4f4285 100644 --- a/io-package.json +++ b/io-package.json @@ -1,8 +1,21 @@ { "common": { "name": "wireguard", - "version": "1.5.8", + "version": "1.5.9", "news": { + "1.5.9": { + "en": "First device of any user was missing in users viewing\nAdded an icon to peers, users, peer and user", + "de": "Das erste Gerät eines Benutzers fehlte in der Benutzeransicht.\nEin Symbol für Peers, Benutzer, Peer und Benutzer wurde hinzugefügt", + "ru": "Первое устройство любого пользователя отсутствовало при просмотре пользователями \n Добавлен значок для одноранговых узлов, пользователей, однорангового узла и пользователя.", + "pt": "Faltava o primeiro dispositivo de qualquer usuário na visualização dos usuários\nAdicionou um ícone para pares, usuários, par e usuário", + "nl": "Het eerste apparaat van een gebruiker ontbrak bij het bekijken van gebruikers\n Een pictogram toegevoegd aan peers, gebruikers, peer en gebruiker", + "fr": "Le premier appareil de n'importe quel utilisateur manquait dans la visualisation des utilisateurs \n Ajout d'une icône aux pairs, aux utilisateurs, aux pairs et à l'utilisateur", + "it": "Il primo dispositivo di qualsiasi utente mancava nella visualizzazione degli utenti\nAggiunta un'icona a peer, utenti, peer e utente", + "es": "Faltaba el primer dispositivo de cualquier usuario en la visualización de usuarios \n Se agregó un ícono a pares, usuarios, pares y usuarios", + "pl": "Brak pierwszego urządzenia dowolnego użytkownika podczas przeglądania użytkowników \n Dodano ikonę do rówieśników, użytkowników, rówieśników i użytkowników", + "uk": "Перший пристрій будь-якого користувача був відсутній під час перегляду користувачів\nДодано піктограму для однорангових пристроїв, користувачів, однорангового пристрою та користувача", + "zh-cn": "用户查看时缺少任何用户的第一台设备\n向同伴、用户、同伴和用户添加了图标" + }, "1.5.8": { "en": "Interface is now correctly set to offline if host is not reachable.", "de": "Die Schnittstelle wird jetzt korrekt auf offline gesetzt, wenn der Host nicht erreichbar ist.", diff --git a/main.js b/main.js index 6cd2764..e6d0d54 100644 --- a/main.js +++ b/main.js @@ -384,7 +384,7 @@ class Wireguard extends utils.Adapter { if (!connectedUsers.includes(wg[data[i][0]].peers[data[i][1]].user)) connectedUsers.push(wg[data[i][0]].peers[data[i][1]].user); } // build users perspective - if (wg[data[i][0]].peers[data[i][1]].user !== '') { + if (wg[data[i][0]].peers[data[i][1]].user) { // there is a username if ( Object.prototype.hasOwnProperty.call(wg[data[i][0]].users, wg[data[i][0]].peers[data[i][1]].user) ){ // there is already a connected state @@ -393,6 +393,7 @@ class Wireguard extends utils.Adapter { } else { // create new connected state wg[data[i][0]].users[wg[data[i][0]].peers[data[i][1]].user] = {'connected' : wg[data[i][0]].peers[data[i][1]].connected}; + wg[data[i][0]].users[wg[data[i][0]].peers[data[i][1]].user][adapter.getDeviceByPeer(data[i][1])] = wg[data[i][0]].peers[data[i][1]].connected ; } } } @@ -609,16 +610,26 @@ class Wireguard extends utils.Adapter { obj.common.type='boolean'; if (path.split('.').includes('peers')) adapter.setConnectedState(path, value); break; - case 'users': - obj.common.name='Connect states of users and their devices'; - break; } // If there is an object inside the given structure, dive one level deeper - if (typeof value === 'object'){ + if (typeof value === 'object') { // It's an object - so iterate deeper - obj.type= 'group'; - obj.role= ''; - obj.common.name = adapter.getDescByPeer(key); + obj.type = 'group'; + obj.role = ''; + switch ( obj.common.name ) { + case 'peers' : + obj.common.name='Peers by public key'; + obj.common.icon='icons/peers.svg'; + break; + case 'users' : + obj.common.name='Connect-states of users and their devices by Name'; + obj.common.icon='icons/users.svg'; + break; + default : + obj.common.name = adapter.getDescByPeer(key); + if (path.split('.').includes('peers')) obj.common.icon='icons/peer.svg'; + if (path.split('.').includes('users')) obj.common.icon='icons/user.svg'; + } obj.common.write= true; adapter.createOrExtendObject( `${path}.${key}`, obj, null ); adapter.extractTreeItems(`${path}.${key}`, value); @@ -730,7 +741,7 @@ class Wireguard extends utils.Adapter { type: 'device', common: { name : `Interface ${Object.keys(wgData)[n]} on host ${host}`, - icon : 'network-interface-card.svg', + icon : 'icons/network-interface-card.svg', // 'icon':'', 'read': true, 'write': false, diff --git a/package-lock.json b/package-lock.json index 822dd91..27d20f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "iobroker.wireguard", - "version": "1.5.2", + "version": "1.5.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "iobroker.wireguard", - "version": "1.5.2", + "version": "1.5.9", "license": "MIT", "dependencies": { "@iobroker/adapter-core": "^3.0.3", @@ -24,7 +24,7 @@ "@types/gulp": "^4.0.13", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", - "eslint": "^8.46.0", + "eslint": "^8.47.0", "eslint-plugin-react": "^7.33.1", "mocha": "^10.2.0", "parcel-bundler": "^1.5.1", @@ -2238,9 +2238,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz", - "integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -2261,9 +2261,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -2276,9 +2276,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz", - "integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==", + "version": "8.47.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", + "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -6867,15 +6867,15 @@ } }, "node_modules/eslint": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz", - "integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==", + "version": "8.47.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", + "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.1", - "@eslint/js": "^8.46.0", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "^8.47.0", "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -6886,7 +6886,7 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.2", + "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", @@ -7004,9 +7004,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz", - "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -17024,9 +17024,9 @@ "dev": true }, "@eslint/eslintrc": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz", - "integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -17041,9 +17041,9 @@ }, "dependencies": { "globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -17052,9 +17052,9 @@ } }, "@eslint/js": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz", - "integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==", + "version": "8.47.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", + "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==", "dev": true }, "@esm2cjs/execa": { @@ -20645,15 +20645,15 @@ } }, "eslint": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz", - "integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==", + "version": "8.47.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", + "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.1", - "@eslint/js": "^8.46.0", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "^8.47.0", "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -20664,7 +20664,7 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.2", + "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", @@ -20771,9 +20771,9 @@ } }, "eslint-visitor-keys": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz", - "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true }, "espree": { diff --git a/package.json b/package.json index 74edc90..5fd80c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.wireguard", - "version": "1.5.8", + "version": "1.5.9", "description": "Connect to WireGuard hosts and grab connection information on peers", "author": { "name": "grizzelbee", @@ -32,7 +32,7 @@ "@types/gulp": "^4.0.13", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", - "eslint": "^8.46.0", + "eslint": "^8.47.0", "eslint-plugin-react": "^7.33.1", "mocha": "^10.2.0", "parcel-bundler": "^1.5.1",