diff options
author | Vincent Chan <plus.vincchan@gmail.com> | 2016-02-01 18:14:10 +0100 |
---|---|---|
committer | Vincent Chan <plus.vincchan@gmail.com> | 2016-02-01 18:57:58 +0100 |
commit | faf48e42b7a9bf208bd2e16baa0a9cc4c602dce3 (patch) | |
tree | 89c4bfa4e2bc5458847fe45b3741b10b0cf3f586 /core/js/setupchecks.js | |
parent | a2e13aea1513de2667a70d224396ed641a5dd179 (diff) | |
download | nextcloud-server-faf48e42b7a9bf208bd2e16baa0a9cc4c602dce3.tar.gz nextcloud-server-faf48e42b7a9bf208bd2e16baa0a9cc4c602dce3.zip |
Move data protection check to javascript
fixes #20199
Diffstat (limited to 'core/js/setupchecks.js')
-rw-r--r-- | core/js/setupchecks.js | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 2fa119334db..bc49c61a5aa 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -15,7 +15,6 @@ MESSAGE_TYPE_INFO:0, MESSAGE_TYPE_WARNING:1, MESSAGE_TYPE_ERROR:2, - /** * Check whether the WebDAV connection works. * @@ -97,12 +96,6 @@ type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } - if(!data.dataDirectoryProtected) { - messages.push({ - msg: 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 web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.'), - type: OC.SetupChecks.MESSAGE_TYPE_ERROR - }); - } if(!data.isMemcacheConfigured) { messages.push({ msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}), @@ -194,6 +187,30 @@ return deferred.promise(); }, + checkDataProtected: function() { + var deferred = $.Deferred(); + if(oc_dataURL === false){ + return deferred.resolve([]); + } + var afterCall = function(xhr) { + var messages = []; + if (xhr.status !== 403 && xhr.status !== 307 && xhr.status !== 301) { + messages.push({ + msg: 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 web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.'), + type: OC.SetupChecks.MESSAGE_TYPE_ERROR + }); + } + deferred.resolve(messages); + }; + + $.ajax({ + type: 'GET', + url: OC.linkTo('', oc_dataURL+'/.ocdata'), + complete: afterCall + }); + return deferred.promise(); + }, + /** * Runs check for some generic security headers on the server side * |