summaryrefslogtreecommitdiffstats
path: root/core
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 10:38:16 +0100
commit7c31c9a7486b055de008364be2d5a1176a45c43b (patch)
tree6293349fa3b84bd41fc1bb2b104ad513bd41416c /core
parentbdf48d8b4ed3d4a78f133331ccf3a536358638f4 (diff)
downloadnextcloud-server-7c31c9a7486b055de008364be2d5a1176a45c43b.tar.gz
nextcloud-server-7c31c9a7486b055de008364be2d5a1176a45c43b.zip
add setup check for ocm-provider route
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'core')
-rw-r--r--core/js/setupchecks.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 4aa60912c37..da5dc68b166 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.
*