/* * Copyright (c) 2014 * * This file is licensed under the Affero General Public License version 3 * or later. * * See the COPYING-README file. * */ (function() { OC.SetupChecks = { /** * Check whether the WebDAV connection works. * * @return $.Deferred object resolved with an array of error messages */ checkWebDAV: function() { var deferred = $.Deferred(); var afterCall = function(xhr) { var messages = []; if (xhr.status !== 207 && xhr.status !== 401) { messages.push( t('core', 'Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.') ); } deferred.resolve(messages); }; $.ajax({ type: 'PROPFIND', url: OC.linkToRemoteBase('webdav'), data: '' + '' + '' + '', complete: afterCall }); return deferred.promise(); }, /** * Runs setup checks on the server side * * @return $.Deferred object resolved with an array of error messages */ checkSetup: function() { var deferred = $.Deferred(); var afterCall = function(data, statusText, xhr) { var messages = []; if (xhr.status === 200 && data) { if (!data.serverHasInternetConnection) { messages.push( t('core', 'This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps donĀ“t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features.') ); } if(!data.dataDirectoryProtected) { messages.push( t('core', 'Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.') ); } if(!data.hasCurlInstalled) { messages.push( t('core', 'cURL is not installed, some functionality might not work. Please install the PHP cURL extension. Future versions will require installed cURL.') ); } if(!data.isUrandomAvailable) { messages.push( t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our documentation.', {docLink: data.securityDocs}) ); } } else { messages.push(t('core', 'Error occurred while checking server setup')); } deferred.resolve(messages); }; $.ajax({ type: 'GET', url: OC.generateUrl('settings/ajax/checksetup') }).then(afterCall, afterCall); return deferred.promise(); } }; })();