Update index.html
This commit is contained in:
parent
ded8856bc7
commit
35e0c58c8e
448
admin/index.html
448
admin/index.html
@ -1,224 +1,224 @@
|
||||
<html>
|
||||
<!-- DEPRECATED FROM ADMIN 3 -->
|
||||
<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-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="../../js/adapter-settings.js"></script>
|
||||
<script type="text/javascript" src="words.js"></script>
|
||||
|
||||
<style>
|
||||
.number {
|
||||
width: 70px
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
var oldBind;
|
||||
var oldSecure;
|
||||
var oldPort;
|
||||
|
||||
function showHideSettings() {
|
||||
var $secure = $('#secure');
|
||||
var $auth = $('#auth');
|
||||
if ($secure.prop('checked')) {
|
||||
$('#_certPublic').show();
|
||||
$('#_certPrivate').show();
|
||||
$('#_certChained').show();
|
||||
$('.le-settings').show();
|
||||
|
||||
if ($('#leEnabled').prop('checked')) {
|
||||
$('.le-sub-settings').show();
|
||||
if ($('#leUpdate').prop('checked')) {
|
||||
$('.le-sub-settings-update').show();
|
||||
} else {
|
||||
$('.le-sub-settings-update').hide();
|
||||
}
|
||||
} else {
|
||||
$('.le-sub-settings').hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
$('#_certPublic').hide();
|
||||
$('#_certPrivate').hide();
|
||||
$('#_certChained').hide();
|
||||
$auth.prop('checked', false);
|
||||
$('.le-settings').hide();
|
||||
}
|
||||
if ($auth.prop('checked')) {
|
||||
$secure.prop('checked', true);
|
||||
$('#defaultUser').val('admin');
|
||||
$('.defaultUser').hide();
|
||||
$('#_ttl').show();
|
||||
} else {
|
||||
$('.defaultUser').show();
|
||||
$('#_ttl').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the function loadSettings has to exist ...
|
||||
function load(settings, onChange) {
|
||||
if (!settings) return;
|
||||
|
||||
if (!settings.thresholdValue) {
|
||||
settings.thresholdValue = 200;
|
||||
}
|
||||
|
||||
getIPs(function(ips) {
|
||||
for (var i = 0; i < ips.length; i++) {
|
||||
$('#bind').append('<option value="' + ips[i].address + '">' + ips[i].name + '</option>');
|
||||
}
|
||||
$('#bind.value').val(settings.bind);
|
||||
});
|
||||
|
||||
oldBind = settings.bind;
|
||||
oldSecure = settings.secure;
|
||||
oldPort = settings.port;
|
||||
|
||||
if (settings.autoUpdate === undefined) settings.autoUpdate = 24;
|
||||
if (!settings.lePort) settings.lePort = 80;
|
||||
|
||||
$('.value').each(function () {
|
||||
var key = $(this).attr('id');
|
||||
var $value = $('#' + key + '.value');
|
||||
if ($value.attr('type') === 'checkbox') {
|
||||
$value.prop('checked', settings[key]).on('change', function() {
|
||||
showHideSettings();
|
||||
onChange();
|
||||
});
|
||||
} else {
|
||||
$value.val(settings[key]).on('change', onChange).on('keyup', function() {
|
||||
onChange();
|
||||
// Chack that only numbers entered
|
||||
if ($(this).hasClass('number')) {
|
||||
var val = $(this).val();
|
||||
if (val) {
|
||||
var newVal = '';
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
if (val[i] >= '0' && val[i] <= '9') {
|
||||
newVal += val[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (val != newVal) {
|
||||
$(this).val(newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onChange(false);
|
||||
|
||||
fillSelectCertificates('#certPublic', 'public', settings.certPublic);
|
||||
fillSelectCertificates('#certPrivate', 'private', settings.certPrivate);
|
||||
fillSelectCertificates('#certChained', 'chained', settings.certChained);
|
||||
fillUsers('#defaultUser', settings.defaultUser);
|
||||
|
||||
showHideSettings();
|
||||
|
||||
$('#auth').change(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$('#secure').prop('checked', true);
|
||||
showHideSettings();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function save(callback) {
|
||||
var obj = {};
|
||||
$('.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();
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#secure').prop('checked') && (!$('#certPrivate').val() || !$('#certPublic').val())) {
|
||||
showMessage(_('Set certificates or load it first in the system settings (right top).'));
|
||||
return;
|
||||
}
|
||||
var isRedirect = false;
|
||||
var isHttp = false;
|
||||
if (oldBind !== obj.bind) {
|
||||
isRedirect = true;
|
||||
}
|
||||
if (oldSecure !== obj.secure) {
|
||||
isHttp = true;
|
||||
}
|
||||
if (oldPort !== obj.port) {
|
||||
isRedirect = true;
|
||||
}
|
||||
var href = '';
|
||||
if (isRedirect || isHttp) {
|
||||
href = obj.secure ? 'https://' : 'http://';
|
||||
|
||||
href += (obj.bind !== '0.0.0.0') ? obj.bind : document.location.hostname;
|
||||
href += ':' + obj.port;
|
||||
}
|
||||
|
||||
callback(obj, null, href);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- you have to put your config page in a div with id adapter-container -->
|
||||
<div id="adapter-container">
|
||||
|
||||
<table><tr><td><img src="admin.png"></td><td><h3 class="translate">Admin adapter settings</h3></td></tr></table>
|
||||
|
||||
<table>
|
||||
<tr><td><label class="translate" for="bind">IP:</label></td><td class="admin-icon"></td><td><select class="value" id="bind"></select></td><td class="admin-tooltip" data-id="bind"></td></tr>
|
||||
<tr><td><label class="translate" for="port">Port:</label></td><td class="admin-icon"></td><td><input class="value number" id="port" size="5" maxlength="5" type="number"/></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td><label class="translate" for="secure">Secure(HTTPS):</label></td><td class="admin-icon"></td><td><input class="value" id="secure" type="checkbox" /></td><td class="admin-tooltip"></td></tr>
|
||||
<tr id="_certPublic">
|
||||
<td><label class="translate" for="certPublic">Public certificate:</label></td>
|
||||
<td class="admin-icon"></td>
|
||||
<td><select id="certPublic" class="value"></select></td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr id="_certPrivate">
|
||||
<td><label class="translate" for="certPrivate">Private certificate:</label></td>
|
||||
<td class="admin-icon"></td>
|
||||
<td><select id="certPrivate" class="value"></select></td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr id="_certChained">
|
||||
<td><label class="translate" for="certChained">Chained certificate:</label></td>
|
||||
<td class="admin-icon"></td>
|
||||
<td><select id="certChained" class="value"></select></td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr><td><label class="translate" for="auth">Authentication:</label></td><td class="admin-icon"></td><td><input class="value" id="auth" type="checkbox" /></td><td class="admin-text"></td></tr>
|
||||
<tr id="_ttl"><td><label class="translate" for="ttl">Login timeout(sec):</label></td><td class="admin-icon"></td><td><input class="value" id="ttl" /></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td><label class="translate" for="cache">Cache:</label></td><td class="admin-icon"></td><td><input class="value" id="cache" type="checkbox" /></td><td class="admin-tooltip"></td></tr>
|
||||
<tr class="defaultUser"><td><label class="translate" for="defaultUser">Run as:</label></td><td class="admin-icon"></td><td><select class="value" id="defaultUser"></select></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td><label class="translate" for="autoUpdate">Auto update:</label></td><td class="admin-icon"></td><td>
|
||||
<select class="value" id="autoUpdate">
|
||||
<option value="0" class="translate">manually</option>
|
||||
<option value="12" class="translate">every 12 hours</option>
|
||||
<option value="24" class="translate">every day</option>
|
||||
<option value="48" class="translate">every 2 days</option>
|
||||
<option value="72" class="translate">every 3 days</option>
|
||||
<option value="168" class="translate">every week</option>
|
||||
<option value="336" class="translate">every 2 weeks</option>
|
||||
<option value="720" class="translate">monthly</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr><td><label class="translate" for="thresholdValue">Events threshold value:</label></td><td class="admin-icon"></td><td><input class="value" id="thresholdValue" type="number" min="50"/></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr class="le-settings"><td colspan="2"><h3 class="translate">Let's Encrypt settings</h3></tr>
|
||||
<tr class="le-settings"><td><label for="leEnabled" class="translate">Use Lets Encrypt certificates:</label></td><td class="admin-icon"></td><td><input class="value" id="leEnabled" type="checkbox" /></td><td class="admin-tooltip" data-link="lets-encrypt-certificates"></td></tr>
|
||||
<tr class="le-settings le-sub-settings"><td><label for="leUpdate" class="translate">Use this instance for automatic update:</label></td><td class="admin-icon"></td><td><input class="value" id="leUpdate" type="checkbox" /></td><td class="admin-tooltip" data-link="lets-encrypt-certificates"></td></tr>
|
||||
<tr class="le-settings le-sub-settings le-sub-settings-update"><td><label for="lePort" class="translate">Port to check the domain:</label></td><td class="admin-icon"></td><td><input class="value number" id="lePort" type="number" size="5" maxlength="5" /></td><td class="admin-tooltip" data-link="lets-encrypt-certificates"></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</html>
|
||||
<html>
|
||||
<!-- DEPRECATED FROM ADMIN 3 -->
|
||||
<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-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="../../js/adapter-settings.js"></script>
|
||||
<script type="text/javascript" src="words.js"></script>
|
||||
|
||||
<style>
|
||||
.number {
|
||||
width: 70px
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
var oldBind;
|
||||
var oldSecure;
|
||||
var oldPort;
|
||||
|
||||
function showHideSettings() {
|
||||
var $secure = $('#secure');
|
||||
var $auth = $('#auth');
|
||||
if ($secure.prop('checked')) {
|
||||
$('#_certPublic').show();
|
||||
$('#_certPrivate').show();
|
||||
$('#_certChained').show();
|
||||
$('.le-settings').show();
|
||||
|
||||
if ($('#leEnabled').prop('checked')) {
|
||||
$('.le-sub-settings').show();
|
||||
if ($('#leUpdate').prop('checked')) {
|
||||
$('.le-sub-settings-update').show();
|
||||
} else {
|
||||
$('.le-sub-settings-update').hide();
|
||||
}
|
||||
} else {
|
||||
$('.le-sub-settings').hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
$('#_certPublic').hide();
|
||||
$('#_certPrivate').hide();
|
||||
$('#_certChained').hide();
|
||||
$auth.prop('checked', false);
|
||||
$('.le-settings').hide();
|
||||
}
|
||||
if ($auth.prop('checked')) {
|
||||
$secure.prop('checked', true);
|
||||
$('#defaultUser').val('admin');
|
||||
$('.defaultUser').hide();
|
||||
$('#_ttl').show();
|
||||
} else {
|
||||
$('.defaultUser').show();
|
||||
$('#_ttl').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the function loadSettings has to exist ...
|
||||
function load(settings, onChange) {
|
||||
if (!settings) return;
|
||||
|
||||
if (!settings.thresholdValue) {
|
||||
settings.thresholdValue = 200;
|
||||
}
|
||||
|
||||
getIPs(function(ips) {
|
||||
for (var i = 0; i < ips.length; i++) {
|
||||
$('#bind').append('<option value="' + ips[i].address + '">' + ips[i].name + '</option>');
|
||||
}
|
||||
$('#bind.value').val(settings.bind);
|
||||
});
|
||||
|
||||
oldBind = settings.bind;
|
||||
oldSecure = settings.secure;
|
||||
oldPort = settings.port;
|
||||
|
||||
if (settings.autoUpdate === undefined) settings.autoUpdate = 24;
|
||||
if (!settings.lePort) settings.lePort = 80;
|
||||
|
||||
$('.value').each(function () {
|
||||
var key = $(this).attr('id');
|
||||
var $value = $('#' + key + '.value');
|
||||
if ($value.attr('type') === 'checkbox') {
|
||||
$value.prop('checked', settings[key]).on('change', function() {
|
||||
showHideSettings();
|
||||
onChange();
|
||||
});
|
||||
} else {
|
||||
$value.val(settings[key]).on('change', onChange).on('keyup', function() {
|
||||
onChange();
|
||||
// Chack that only numbers entered
|
||||
if ($(this).hasClass('number')) {
|
||||
var val = $(this).val();
|
||||
if (val) {
|
||||
var newVal = '';
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
if (val[i] >= '0' && val[i] <= '9') {
|
||||
newVal += val[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (val != newVal) {
|
||||
$(this).val(newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onChange(false);
|
||||
|
||||
fillSelectCertificates('#certPublic', 'public', settings.certPublic);
|
||||
fillSelectCertificates('#certPrivate', 'private', settings.certPrivate);
|
||||
fillSelectCertificates('#certChained', 'chained', settings.certChained);
|
||||
fillUsers('#defaultUser', settings.defaultUser);
|
||||
|
||||
showHideSettings();
|
||||
|
||||
$('#auth').change(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$('#secure').prop('checked', true);
|
||||
showHideSettings();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function save(callback) {
|
||||
var obj = {};
|
||||
$('.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();
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#secure').prop('checked') && (!$('#certPrivate').val() || !$('#certPublic').val())) {
|
||||
showMessage(_('Set certificates or load it first in the system settings (right top).'));
|
||||
return;
|
||||
}
|
||||
var isRedirect = false;
|
||||
var isHttp = false;
|
||||
if (oldBind !== obj.bind) {
|
||||
isRedirect = true;
|
||||
}
|
||||
if (oldSecure !== obj.secure) {
|
||||
isHttp = true;
|
||||
}
|
||||
if (oldPort !== obj.port) {
|
||||
isRedirect = true;
|
||||
}
|
||||
var href = '';
|
||||
if (isRedirect || isHttp) {
|
||||
href = obj.secure ? 'https://' : 'http://';
|
||||
|
||||
href += (obj.bind !== '0.0.0.0') ? obj.bind : document.location.hostname;
|
||||
href += ':' + obj.port;
|
||||
}
|
||||
|
||||
callback(obj, null, href);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- you have to put your config page in a div with id adapter-container -->
|
||||
<div id="adapter-container">
|
||||
|
||||
<table><tr><td><img src="admin.png"></td><td><h3 class="translate">Admin adapter settings</h3></td></tr></table>
|
||||
|
||||
<table>
|
||||
<tr><td><label class="translate" for="bind">IP:</label></td><td class="admin-icon"></td><td><select class="value" id="bind"></select></td><td class="admin-tooltip" data-id="bind"></td></tr>
|
||||
<tr><td><label class="translate" for="port">Port:</label></td><td class="admin-icon"></td><td><input class="value number" id="port" size="5" maxlength="5" type="number"/></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td><label class="translate" for="secure">Secure(HTTPS):</label></td><td class="admin-icon"></td><td><input class="value" id="secure" type="checkbox" /></td><td class="admin-tooltip"></td></tr>
|
||||
<tr id="_certPublic">
|
||||
<td><label class="translate" for="certPublic">Public certificate:</label></td>
|
||||
<td class="admin-icon"></td>
|
||||
<td><select id="certPublic" class="value"></select></td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr id="_certPrivate">
|
||||
<td><label class="translate" for="certPrivate">Private certificate:</label></td>
|
||||
<td class="admin-icon"></td>
|
||||
<td><select id="certPrivate" class="value"></select></td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr id="_certChained">
|
||||
<td><label class="translate" for="certChained">Chained certificate:</label></td>
|
||||
<td class="admin-icon"></td>
|
||||
<td><select id="certChained" class="value"></select></td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr><td><label class="translate" for="auth">Authentication:</label></td><td class="admin-icon"></td><td><input class="value" id="auth" type="checkbox" /></td><td class="admin-text"></td></tr>
|
||||
<tr id="_ttl"><td><label class="translate" for="ttl">Login timeout(sec):</label></td><td class="admin-icon"></td><td><input class="value" id="ttl" /></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td><label class="translate" for="cache">Cache:</label></td><td class="admin-icon"></td><td><input class="value" id="cache" type="checkbox" /></td><td class="admin-tooltip"></td></tr>
|
||||
<tr class="defaultUser"><td><label class="translate" for="defaultUser">Run as:</label></td><td class="admin-icon"></td><td><select class="value" id="defaultUser"></select></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td><label class="translate" for="autoUpdate">Auto update:</label></td><td class="admin-icon"></td><td>
|
||||
<select class="value" id="autoUpdate">
|
||||
<option value="0" class="translate">manually</option>
|
||||
<option value="12" class="translate">every 12 hours</option>
|
||||
<option value="24" class="translate">every day</option>
|
||||
<option value="48" class="translate">every 2 days</option>
|
||||
<option value="72" class="translate">every 3 days</option>
|
||||
<option value="168" class="translate">every week</option>
|
||||
<option value="336" class="translate">every 2 weeks</option>
|
||||
<option value="720" class="translate">monthly</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="admin-tooltip"></td>
|
||||
</tr>
|
||||
<tr><td><label class="translate" for="thresholdValue">Events threshold value:</label></td><td class="admin-icon"></td><td><input class="value" id="thresholdValue" type="number" min="50"/></td><td class="admin-tooltip"></td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr class="le-settings"><td colspan="2"><h3 class="translate">Let's Encrypt settings</h3></tr>
|
||||
<tr class="le-settings"><td><label for="leEnabled" class="translate">Use Lets Encrypt certificates:</label></td><td class="admin-icon"></td><td><input class="value" id="leEnabled" type="checkbox" /></td><td class="admin-tooltip" data-link="lets-encrypt-certificates"></td></tr>
|
||||
<tr class="le-settings le-sub-settings"><td><label for="leUpdate" class="translate">Use this instance for automatic update:</label></td><td class="admin-icon"></td><td><input class="value" id="leUpdate" type="checkbox" /></td><td class="admin-tooltip" data-link="lets-encrypt-certificates"></td></tr>
|
||||
<tr class="le-settings le-sub-settings le-sub-settings-update"><td><label for="lePort" class="translate">Port to check the domain:</label></td><td class="admin-icon"></td><td><input class="value number" id="lePort" type="number" size="5" maxlength="5" /></td><td class="admin-tooltip" data-link="lets-encrypt-certificates"></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user