summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2019-02-19 22:20:33 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-02-20 15:42:39 +0100
commit6360f1a3894b5c56e69825791cfd8cc39c44cb5a (patch)
treecfdfcecbda8d60d0bc0d105e49316800fc797514
parent2bf2633c0518b331bf7bf006d6c5327cad6ccbe9 (diff)
downloadnextcloud-server-6360f1a3894b5c56e69825791cfd8cc39c44cb5a.tar.gz
nextcloud-server-6360f1a3894b5c56e69825791cfd8cc39c44cb5a.zip
add setup check for ocm-provider route
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
-rw-r--r--core/js/setupchecks.js40
-rw-r--r--settings/js/admin.js1
2 files changed, 41 insertions, 0 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 025f58bca8a..f7b291b4706 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -91,6 +91,46 @@
return deferred.promise();
},
+
+ /**
+ * Check whether the .well-known URLs works.
+ *
+ * @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
+ */
+ checkProviderUrl: function(url, placeholderUrl, runCheck) {
+ var expectedStatus = [200];
+ var deferred = $.Deferred();
+
+ if(runCheck === false) {
+ deferred.resolve([]);
+ return deferred.promise();
+ }
+ var afterCall = function(xhr) {
+ var messages = [];
+ if (expectedStatus.indexOf(xhr.status) === -1) {
+ var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL');
+ messages.push({
+ msg: t('core', 'Your web server is not properly set up to resolve "{url}". Further information can be found in the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }),
+ type: OC.SetupChecks.MESSAGE_TYPE_INFO
+ });
+ }
+ deferred.resolve(messages);
+ };
+
+ $.ajax({
+ type: 'GET',
+ url: url,
+ complete: afterCall,
+ allowAuthErrors: true
+ });
+ return deferred.promise();
+ },
+
+
/**
* Check whether the WOFF2 URLs works.
*
diff --git a/settings/js/admin.js b/settings/js/admin.js
index 8c198bc7821..e1418349d24 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -250,6 +250,7 @@ $(document).ready(function(){
OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]),
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.checkProviderUrl('/ocm-provider/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
OC.SetupChecks.checkSetup(),
OC.SetupChecks.checkGeneric(),
OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl),