modulejs.define('main/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_MIN_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_JPEG
);
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
);
}
function request(data) {
$.ajax({
url: 'server/php/index.php',
type: 'post',
dataType: 'json',
data: data
})
.always(function () {
window.location.reload();
});
}
function onLogin() {
request({
action: 'login',
pass: $('#pass').val()
});
}
function onLogout() {
request({
action: 'logout'
});
}
function onKeydown(event) {
if (event.which === 13) {
onLogin();
}
}
function addLogin() {
$(loginTemp).appendTo('#content');
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();
}
}
function init() {
addLogin();
if (setup.AS_ADMIN) {
addTests();
}
}
init();
});