modulejs.define('info', ['$', 'config'], function ($, config) { var testsTemp = '
' + setup.INDEX_HREF + '
to your index file list',
setup.INDEX_HREF
);
addTest(
'Options parsable', 'File options.json
is readable and syntax is correct',
config.options !== null
);
addTest(
'Types parsable', 'File types.json
is readable and syntax is correct',
config.types !== null
);
addTest(
'Server software', 'Server is one of apache, lighttpd, nginx or cherokee',
setup.HAS_SERVER, setup.SERVER_NAME + ' ' + setup.SERVER_VERSION
);
addTest(
'PHP version', 'PHP version >= ' + setup.MIN_PHP_VERSION,
setup.HAS_PHP_VERSION, setup.PHP_VERSION
);
addTest(
'Cache directory', 'Web server has write access',
setup.HAS_WRITABLE_CACHE
);
addTest(
'Image thumbs', 'PHP GD extension with JPEG support available',
setup.HAS_PHP_JPG
);
addTest(
'Use EXIF thumbs', 'PHP EXIF extension available',
setup.HAS_PHP_EXIF
);
addTest(
'Movie thumbs', 'Command line program avconv
or ffmpeg
available',
setup.HAS_CMD_AVCONV || setup.HAS_CMD_FFMPEG
);
addTest(
'PDF thumbs', 'Command line program convert
available',
setup.HAS_CMD_CONVERT
);
addTest(
'Shell tar', 'Command line program tar
available',
setup.HAS_CMD_TAR
);
addTest(
'Shell zip', 'Command line program zip
available',
setup.HAS_CMD_ZIP
);
addTest(
'Shell du', 'Command line program du
available',
setup.HAS_CMD_DU
);
},
addLogin = function () {
var request = function (data) {
$.ajax({
url: 'server/php/index.php',
type: 'POST',
dataType: 'JSON',
data: data
})
.always(function () {
window.location.reload();
});
},
onLogin = function () {
request({
'action': 'login',
'pass': $('#pass').val()
});
},
onLogout = function () {
request({
'action': 'logout'
});
},
onKeydown = function (event) {
if (event.which === 13) {
onLogin();
}
};
$(loginTemp).appendTo('body');
if (setup.AS_ADMIN) {
$('#pass').remove();
$('#login').remove();
$('#logout').on('click', onLogout);
} else {
$('#pass').on('keydown', onKeydown).focus();
$('#login').on('click', onLogin);
$('#logout').remove();
}
if (setup.HAS_CUSTOM_PASSHASH) {
$('#hint').remove();
}
},
init = function () {
addLogin();
if (setup.AS_ADMIN) {
addTests();
}
};
init();
});