更新 index_m.html

This commit is contained in:
钟进 2019-02-02 14:51:18 +00:00
parent 6715c34018
commit 2c7d2b292c

View File

@ -87,6 +87,7 @@
<!-- you have to define 2 functions in the global scope: --> <!-- you have to define 2 functions in the global scope: -->
<script type="text/javascript"> <script type="text/javascript">
var oldPass = ''; var oldPass = '';
var ui_oldPass = '';
function setValue(id, value, onChange) { function setValue(id, value, onChange) {
var $value = $('#' + id + '.value'); var $value = $('#' + id + '.value');
if ($value.attr('type') === 'checkbox') { if ($value.attr('type') === 'checkbox') {
@ -136,6 +137,14 @@
if (settings.pass === undefined) { if (settings.pass === undefined) {
settings.pass = ''; settings.pass = '';
} }
if (settings.ui_user === undefined) {
settings.ui_user = '';
}
if (settings.ui_pass === undefined) {
settings.ui_pass = '';
}
if (settings.bind === undefined) { if (settings.bind === undefined) {
settings.bind = '0.0.0.0'; settings.bind = '0.0.0.0';
} }
@ -143,10 +152,16 @@
settings.maxMemory = 128; settings.maxMemory = 128;
} }
oldPass = settings.pass; oldPass = settings.pass;
if (settings.pass) { if (settings.pass) {
settings.pass = '__pass__'; settings.pass = '__pass__';
} }
ui_oldPass = settings.ui_pass;
if (settings.ui_pass) {
settings.ui_pass = '__pass__';
}
for (var key in settings) { for (var key in settings) {
if (settings.hasOwnProperty(key)) { if (settings.hasOwnProperty(key)) {
setValue(key, settings[key], onChange); setValue(key, settings[key], onChange);
@ -201,6 +216,13 @@
} }
} }
if (obj.ui_pass) {
if (obj.ui_pass !== '__pass__') {
obj.ui_pass = MD5(obj.ui_pass);
} else {
obj.ui_pass = ui_oldPass;
}
}
common.npmLibs = chips2list('.libraries'); common.npmLibs = chips2list('.libraries');
callback(obj, {localLink: 'http://%ip%:' + obj.port, npmLibs: common.npmLibs}); callback(obj, {localLink: 'http://%ip%:' + obj.port, npmLibs: common.npmLibs});