]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add config switch to disable the .well-known URL check
authorMorris Jobke <hey@morrisjobke.de>
Tue, 12 Jan 2016 08:53:23 +0000 (09:53 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 12 Jan 2016 08:53:23 +0000 (09:53 +0100)
config/config.sample.php
core/js/setupchecks.js
core/js/tests/specs/setupchecksSpec.js
settings/admin.php
settings/js/admin.js
settings/templates/admin.php

index 7ba3977fe3acf58e52eb42bac11e73cd17b59e49..525a0895b074f098b0928a22700647b9640cc03a 100644 (file)
@@ -476,6 +476,13 @@ $CONFIG = array(
  */
 'check_for_working_webdav' => true,
 
+/**
+ * Allows ownCloud to verify a working .well-known URL redirects. This is done
+ * by attempting to make a request from JS to
+ * https://your-domain.com/.well-known/caldav/
+ */
+'check_for_working_wellknown_setup' => true,
+
 /**
  * This is a crucial security check on Apache servers that should always be set
  * to ``true``. This verifies that the ``.htaccess`` file is writable and works.
index b1b8dd358d24ef438b129e74b8967a6ba9c3028a..d178a7432b064dc287b9f74b61a2f83974959568 100644 (file)
                 *
                 * @param url the URL to test
                 * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl
+                * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned
                 * @return $.Deferred object resolved with an array of error messages
                 */
-               checkWellKnownUrl: function(url, placeholderUrl) {
+               checkWellKnownUrl: function(url, placeholderUrl, runCheck) {
                        var deferred = $.Deferred();
+
+                       if(runCheck === false) {
+                               deferred.resolve([]);
+                               return deferred.promise();
+                       }
                        var afterCall = function(xhr) {
                                var messages = [];
                                if (xhr.status !== 207) {
index 18ba44ac61b38945a29b72eba0e9c73cffd8fdf5..97f624cecaf2008ef5b2dcb6f3976771dce03222 100644 (file)
@@ -62,7 +62,7 @@ describe('OC.SetupChecks tests', function() {
 
        describe('checkWellKnownUrl', function() {
                it('should fail with another response status code than 207', function(done) {
-                       var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER');
+                       var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER', true);
 
                        suite.server.requests[0].respond(200);
 
@@ -76,7 +76,7 @@ describe('OC.SetupChecks tests', function() {
                });
 
                it('should return no error with a response status code of 207', function(done) {
-                       var async = OC.SetupChecks.checkWebDAV('/.well-known/caldav/', 'http://example.org/PLACEHOLDER');
+                       var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER', true);
 
                        suite.server.requests[0].respond(207);
 
@@ -85,6 +85,15 @@ describe('OC.SetupChecks tests', function() {
                                done();
                        });
                });
+
+               it('should return no error when no check should be run', function(done) {
+                       var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER', false);
+
+                       async.done(function( data, s, x ){
+                               expect(data).toEqual([]);
+                               done();
+                       });
+               });
        });
 
        describe('checkSetup', function() {
index d484d6a1e48cacfd2ce350c1ed3a565fba19e9f3..25db05d99aca3672d1791b91d9f03431fa833296 100644 (file)
@@ -75,6 +75,7 @@ $template->assign('showLog', $showLog);
 $template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
 $template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
 $template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
+$template->assign('checkForWorkingWellKnownSetup', $config->getSystemValue('check_for_working_wellknown_setup', true));
 $template->assign('has_fileinfo', OC_Util::fileInfoLoaded());
 $template->assign('backgroundjobs_mode', $appConfig->getValue('core', 'backgroundjobs_mode', 'ajax'));
 $template->assign('cron_log', $config->getSystemValue('cron_log', true));
index 48dfdc88246b93046dbdf42a20bafc8425065090..6660bfe9b480377082929fd33e3c684433c69066 100644 (file)
@@ -168,8 +168,8 @@ $(document).ready(function(){
        // run setup checks then gather error messages
        $.when(
                OC.SetupChecks.checkWebDAV(),
-               OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', oc_defaults.docPlaceholderUrl),
-               OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav/', oc_defaults.docPlaceholderUrl),
+               OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === 'true'),
+               OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === 'true'),
                OC.SetupChecks.checkSetup(),
                OC.SetupChecks.checkGeneric()
        ).then(function(check1, check2, check3, check4, check5) {
index a66851743e6b43f685a7ad703874ab3a9928b8ae..539e4b94b8bb2964b0cc61c93f0b4abaa75b8c4b 100644 (file)
@@ -177,7 +177,7 @@ if ($_['cronErrors']) {
 ?>
 </ul>
 
-<div id="postsetupchecks">
+<div id="postsetupchecks" data-check-wellknown="<?php if($_['checkForWorkingWellKnownSetup']) { p('true'); } else { p('false'); } ?>">
        <div class="loading"></div>
        <ul class="errors hidden"></ul>
        <ul class="warnings hidden"></ul>