* IMPORTANT: You need to re-enter the password once after installing this version!

* rework index_m
This commit is contained in:
Ingo Fischer
2022-03-22 22:57:40 +01:00
parent 0d28c7e54b
commit 5cb493481e
4 changed files with 124 additions and 153 deletions
+1
View File
@@ -32,6 +32,7 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista
## Changelog
### __WORK IN PROGRESS__
* IMPORTANT: You need to re-enter the password once after installing this version!
* (Apollon77) Implement Service triggers to use any value to trigger or stringified JSON to call with fields
* (Apollon77) Optimize unload handling
* (Apollon7) Add Sentry for crash reporting
-76
View File
@@ -1,76 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
<script type="text/javascript">
function load(settings, onChange) {
if (!settings) return;
if (settings.password === undefined) settings.password = '';
if (settings.prompt === undefined) settings.prompt = 'hass>';
$('.value').each(function () {
var key = $(this).attr('id');
var $value = $('#' + key + '.value');
if ($value.attr('type') === 'checkbox') {
$value.prop('checked', settings[key]).change(function() {
onChange();
});
} else {
$value.val(settings[key]).change(function() {
onChange();
}).keyup(function() {
onChange();
});
}
});
// Signal to admin, that no changes yet
onChange(false);
}
function save(callback) {
var obj = {};
if ($('#password').val() !== $('#passwordRepeat').val()) {
showMessage(_('Passwords missmatch!'), _('Warning'), 'alert');
return;
}
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else {
obj[$this.attr('id')] = $this.val();
}
});
callback(obj);
}
</script>
</head>
<body>
<div id="adapter-container">
<table><tr>
<td><img src="hass.png"/></td>
<td><h3 class="translate">FHEM adapter settings</h3></td>
</tr></table>
<table>
<tr><td><label class="translate" for="host">Home assistant IP:</label></td><td class="admin-icon"></td><td><input class="value" id="host" /></td></tr>
<tr><td><label class="translate" for="port">Home assistant WS Port:</label></td><td class="admin-icon"></td><td><input class="value" id="port" size="5" maxlength="5"/></td></tr>
<tr><td><label class="translate" for="password">Password:</label></td><td class="admin-icon"></td><td><input class="value" id="password" type="password"/></td></tr>
<tr><td><label class="translate" for="passwordRepeat">Password repeat:</label></td><td class="admin-icon"></td><td><input type="password" id="passwordRepeat"/></td></tr>
<tr><td><label class="translate" for="secure">Secure:</label></td><td class="admin-icon"></td><td><input class="value" id="secure" type="checkbox"/></td></tr>
</table>
</div>
</body>
</html>
+50 -15
View File
@@ -1,12 +1,15 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<meta charset="UTF-8">
<!-- Materialze style -->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css">
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
@@ -17,6 +20,7 @@
if (settings.password === undefined) settings.password = '';
if (settings.prompt === undefined) settings.prompt = 'hass>';
settings.passwordRepeat = settings.password;
$('.value').each(function () {
var key = $(this).attr('id');
@@ -53,23 +57,54 @@
obj[$this.attr('id')] = $this.val();
}
});
delete obj.passwordRepeat;
callback(obj);
}
</script>
</head>
<body>
<div id="adapter-container">
<table><tr>
<td><img src="hass.png" alt="logo"/></td>
<td><h3 class="translate">Home assistant adapter settings</h3></td>
</tr></table>
<table>
<tr><td><label class="translate" for="host">Home assistant IP:</label></td><td class="admin-icon"></td><td><input class="value" id="host" /></td></tr>
<tr><td><label class="translate" for="port">Home assistant WS Port:</label></td><td class="admin-icon"></td><td><input class="value" id="port" size="5" maxlength="5"/></td></tr>
<tr><td><label class="translate" for="password">Password:</label></td><td class="admin-icon"></td><td><input class="value" id="password" type="password"/></td></tr>
<tr><td><label class="translate" for="passwordRepeat">Password repeat:</label></td><td class="admin-icon"></td><td><input type="password" id="passwordRepeat"/></td></tr>
<tr><td><label class="translate" for="secure">Secure:</label></td><td class="admin-icon"></td><td><input class="value" id="secure" type="checkbox"/></td></tr>
</table>
<div id="m adapter-container">
<div class="row">
<div class="col s12 m4 l2">
<img src="hass.png" class="logo">
</div>
</div>
<div class="row">
<div class="col s6 m4 input-field">
<input type="text" class="value" id="host" />
<label for="host" class="translate">Home assistant IP:</label>
</div>
</div>
<div class="row">
<div class="col s6 m4 input-field">
<input type="text" class="value" id="port" size="5" maxlength="5"/>
<label for="port" class="translate">Home assistant WS Port:</label>
</div>
</div>
<div class="row">
<div class="col s6 m4 input-field">
<input type="text" class="value" id="password" />
<label for="password" class="translate">Password:</label>
</div>
</div>
<div class="row">
<div class="col s6 m4 input-field">
<input type="text" class="value" id="passwordRepeat" />
<label for="passwordRepeat" class="translate">Password repeat:</label>
</div>
</div>
<div class="row">
<div class="col s6 m4 input-field">
<input id="secure" type="checkbox" class="value" />
<span for="secure" class="translate">Secure:</span>
</div>
</div>
</div>
</body>
</html>
+12 -1
View File
@@ -87,7 +87,12 @@
],
"dependencies": [
{
"js-controller": ">=2.0.0"
"js-controller": ">=3.0.0"
}
],
"globalDependencies": [
{
"admin": ">=4.0.19"
}
],
"plugins": {
@@ -105,6 +110,12 @@
"password": "",
"secure": false
},
"protectedNative": [
"password"
],
"encryptedNative": [
"password"
],
"objects": [],
"instanceObjects": [
{