Skip to content

Commit

Permalink
add capability for device encryption key, #152
Browse files Browse the repository at this point in the history
  • Loading branch information
DutchmanNL committed Nov 5, 2023
1 parent c5989aa commit c10cd8c
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 285 deletions.
5 changes: 4 additions & 1 deletion admin/i18n/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "IP-Adresse",
"Name": "Name",
"Show configuration as states": "Konfiguration als Zustände anzeigen",
"When Encryption Key is provided, API-Password will be ignored": "Wenn der Verschlüsselungsschlüssel bereitgestellt wird, wird das API-Passwort ignoriert",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Sie können entweder den Geräteverschlüsselungsschlüssel (bevorzugt) oder das API-Passwort (alt) verwenden.",
"device-pass": "Passwort",
"deviceEncryptionKey": "Geräteverschlüsselungsschlüssel (bevorzugt)",
"reconnect interval": "Intervall für erneutes Verbinden"
}
}
7 changes: 5 additions & 2 deletions admin/i18n/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "IP Address",
"Name": "Name",
"Show configuration as states": "Show configuration as states",
"device-pass": "Password",
"When Encryption Key is provided, API-Password will be ignored": "When Encryption Key is provided, API-Password will be ignored",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)",
"device-pass": "Device API Password (legacy)",
"deviceEncryptionKey": "Device EncryptionKey (preferred)",
"reconnect interval": "Reconnect Interval"
}
}
3 changes: 3 additions & 0 deletions admin/i18n/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "Dirección IP",
"Name": "Nombre",
"Show configuration as states": "Mostrar configuración como estados",
"When Encryption Key is provided, API-Password will be ignored": "Cuando se proporciona la clave de cifrado, se ignorará la contraseña API",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Puede optar por utilizar la clave de cifrado del dispositivo (preferida) o la contraseña API (heredada)",
"device-pass": "Contraseña",
"deviceEncryptionKey": "Clave de cifrado del dispositivo (preferida)",
"reconnect interval": "intervalo de reconexión"
}
3 changes: 3 additions & 0 deletions admin/i18n/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "Adresse IP",
"Name": "Nom",
"Show configuration as states": "Afficher la configuration sous forme d'états",
"When Encryption Key is provided, API-Password will be ignored": "Lorsque la clé de cryptage est fournie, le mot de passe API sera ignoré",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Vous pouvez choisir d'utiliser la clé de chiffrement de l'appareil (de préférence) ou le mot de passe API (ancien)",
"device-pass": "Mot de passe",
"deviceEncryptionKey": "Clé de chiffrement de l'appareil (de préférence)",
"reconnect interval": "intervalle de reconnexion"
}
3 changes: 3 additions & 0 deletions admin/i18n/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "Indirizzo IP",
"Name": "Nome",
"Show configuration as states": "Mostra configurazione come stati",
"When Encryption Key is provided, API-Password will be ignored": "Quando viene fornita la chiave di crittografia, la password API verrà ignorata",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Puoi scegliere di utilizzare la chiave di crittografia del dispositivo (preferita) o la password API (legacy)",
"device-pass": "Parola d'ordine",
"deviceEncryptionKey": "Chiave di crittografia del dispositivo (preferita)",
"reconnect interval": "ricollegare l'intervallo"
}
3 changes: 3 additions & 0 deletions admin/i18n/nl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "IP adres",
"Name": "Naam",
"Show configuration as states": "Configuratie weergeven als toestanden",
"When Encryption Key is provided, API-Password will be ignored": "Wanneer de coderingssleutel wordt opgegeven, wordt het API-wachtwoord genegeerd",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "U kunt ervoor kiezen om de Device Encryption Key (bij voorkeur) of het API-wachtwoord (verouderd) te gebruiken",
"device-pass": "Wachtwoord",
"deviceEncryptionKey": "Apparaatcoderingssleutel (bij voorkeur)",
"reconnect interval": "interval voor opnieuw verbinden"
}
5 changes: 4 additions & 1 deletion admin/i18n/pl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "Adres IP",
"Name": "Nazwa",
"Show configuration as states": "Pokaż konfigurację jako stany",
"When Encryption Key is provided, API-Password will be ignored": "Po podaniu klucza szyfrowania hasło API zostanie zignorowane",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Możesz wybrać użycie klucza szyfrowania urządzenia (preferowany) lub hasła API (starsza wersja)",
"device-pass": "Hasło",
"deviceEncryptionKey": "Klucz szyfrowania urządzenia (preferowany)",
"reconnect interval": "interwał ponownego łączenia"
}
}
5 changes: 4 additions & 1 deletion admin/i18n/pt/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "Endereço de IP",
"Name": "Nome",
"Show configuration as states": "Mostrar configuração como estados",
"When Encryption Key is provided, API-Password will be ignored": "Quando a chave de criptografia for fornecida, a senha da API será ignorada",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Você pode optar por usar a chave de criptografia do dispositivo (preferencial) ou a senha da API (legado)",
"device-pass": "Senha",
"deviceEncryptionKey": "Chave de criptografia do dispositivo (preferencial)",
"reconnect interval": "intervalo de reconexão"
}
}
3 changes: 3 additions & 0 deletions admin/i18n/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "IP адрес",
"Name": "Имя",
"Show configuration as states": "Показать конфигурацию как состояния",
"When Encryption Key is provided, API-Password will be ignored": "Если предоставлен ключ шифрования, пароль API будет игнорироваться.",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "Вы можете использовать либо ключ шифрования устройства (предпочтительно), либо пароль API (устаревший вариант).",
"device-pass": "Пароль",
"deviceEncryptionKey": "Ключ шифрования устройства (предпочтительно)",
"reconnect interval": "Интервал повторного соединения"
}
3 changes: 3 additions & 0 deletions admin/i18n/zh-cn/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"IP-Address": "IP地址",
"Name": "姓名",
"Show configuration as states": "将配置显示为状态",
"When Encryption Key is provided, API-Password will be ignored": "当提供加密密钥时,API-密码将被忽略",
"You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)": "您可以选择使用设备加密密钥(首选)或 API 密码(旧版)",
"device-pass": "密码",
"deviceEncryptionKey": "设备加密密钥(首选)",
"reconnect interval": "重新连接间隔"
}
69 changes: 30 additions & 39 deletions admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,23 @@
console.log('Return of all devices : ' + JSON.stringify(_devices));

let text = '';
text += `
<div class="input-field ip col s4">
<input placeholder="192.168.0.1" class="center" id="device-ip" type="text" value='${_devices.rows[index].value.native.ip}'/>
<span class="translate">IP</span>
</div>
<div class="input-field pass col s4">
<input class="center" id="device-pass" type="password" value='${decryptManuell(secret, _devices.rows[index].value.native.passWord)}'/>
<span class="translate">device-pass</span>
</div>`;
text += `
<p class="translate">You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)</p>
<p class="translate">When Encryption Key is provided, API-Password will be ignored</p>
<div class="input-field ip col s8">
<label for="device-ip"></label><input placeholder="192.168.0.100" class="center" id="device-ip" type="text"/>
<span class="translate">IP</span>
</div>
<div class="input-field pass col s8">
<label for="deviceEncryptionKey"></label><input class="center" id="deviceEncryptionKey" type="password"/>
<span class="translate">deviceEncryptionKey</span>
</div>
<div class="input-field pass col s8">
<label for="device-pass"></label><input class="center" id="device-pass" type="password"/>
<span class="translate">device-pass</span>
</div>`;

$(`#edit_device_container`).html(text);
});
}
Expand Down Expand Up @@ -190,7 +198,8 @@
console.log('Add device button executed');
messageObj = {
'device-ip': $('#device-ip').val(),
'device-pass': encryptManuell(secret, $('#device-pass').val())
'device-pass': encryptManuell(secret, $('#device-pass').val()),
'deviceEncryptionKey': encryptManuell(secret, $('#deviceEncryptionKey').val())
};
sendTo(null, 'addDevice', messageObj, (data) => {
console.log('Message from backend : ' + data);
Expand All @@ -210,7 +219,8 @@
messageObj = {
'device-ip': $('#device-ip').val(),
// 'device-pass': decryptManuell(secret, $('#device-pass').val())
'device-pass': encryptManuell(secret, $('#device-pass').val())
'device-pass': encryptManuell(secret, $('#device-pass').val()),
'deviceEncryptionKey': encryptManuell(secret, $('#deviceEncryptionKey').val())
};
sendTo(null, 'addDevice', messageObj, (data) => {
console.log('Message from backend : ' + data);
Expand Down Expand Up @@ -305,31 +315,6 @@ <h5 class="center ${data.type}">${data.type}</h5>
<input type="text" class="value" disabled="true" id="ESPHomeDashboardPort" />
<label for="ESPHomeDashboardPort" class="translate">ESPHomeDashboardPort</label>
</div>

<!-- <div class="input-field col s4">-->
<!-- <input placeholder="localhost" class="center" id="device-ip" type="text" id="ESPHomeDashboardEnabled" />-->
<!-- <span class="translate">ESPHome Dashboard IP</span>-->
<!-- </div>-->
<!-- <div class="input-field col s4">-->
<!-- <input type="number" class="value" id="ESPHomeDashboardPort" />-->
<!-- <span class="translate">Port</span>-->
<!-- </div>-->
<!-- <div class="input-field col s2">-->
<!-- <input type="checkbox" class="value" id="currentYearWeeks" />-->
<!-- <span class="translate">Week</span>-->
<!-- </div>-->
<!-- <div class="input-field col s2">-->
<!-- <input type="checkbox" class="value" id="currentYearMonth" />-->
<!-- <span class="translate">Month</span>-->
<!-- </div>-->
<!-- <div class="input-field col s2">-->
<!-- <input type="checkbox" class="value" id="currentYearQuarter" />-->
<!-- <span class="translate">Quarter</span>-->
<!-- </div>-->
<!-- <div class="input-field col s2">-->
<!-- <input type="checkbox" class="value" id="currentYearPrevious" />-->
<!-- <span class="translate">Previous</span>-->
<!-- </div>-->
</div>

<div class="row center">
Expand Down Expand Up @@ -407,11 +392,17 @@ <h5 class="translate center">Edit device</h5>
<div class="modal-content">
<h5 class="translate center">Add device manually</h5>
<div class="row center">
<div class="input-field ip col s4">
<label for="device-ip"></label><input placeholder="192.168.0.1" class="center" id="device-ip" type="text"/>
<p class="translate">You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)</p>
<p class="translate">When Encryption Key is provided, API-Password will be ignored</p>
<div class="input-field ip col s8">
<label for="device-ip"></label><input placeholder="192.168.0.100" class="center" id="device-ip" type="text"/>
<span class="translate">IP</span>
</div>
<div class="input-field pass col s4">
<div class="input-field pass col s8">
<label for="deviceEncryptionKey"></label><input class="center" id="deviceEncryptionKey" type="password"/>
<span class="translate">deviceEncryptionKey</span>
</div>
<div class="input-field pass col s8">
<label for="device-pass"></label><input class="center" id="device-pass" type="password"/>
<span class="translate">device-pass</span>
</div>
Expand Down
Loading

0 comments on commit c10cd8c

Please sign in to comment.