Skip to content

Commit

Permalink
Merge pull request #86 from Grizzelbee/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Grizzelbee authored Aug 12, 2023
2 parents baa5705 + 7c6b66c commit 1fd0daa
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 51 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
File renamed without changes
1 change: 1 addition & 0 deletions admin/icons/peer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions admin/icons/peers.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions admin/icons/user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions admin/icons/users.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
29 changes: 20 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ;
}
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
78 changes: 39 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1fd0daa

Please sign in to comment.