From f3f8ab1a196467825d133a28785503d13e751172 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Sun, 17 Feb 2019 17:15:07 +0100 Subject: adjust json to match the definition Signed-off-by: Bjoern Schiessle --- apps/cloud_federation_api/lib/Capabilities.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index a3db8530ef0..d614d7d4730 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -48,9 +48,10 @@ class Capabilities implements ICapability { 'enabled' => true, 'apiVersion' => '1.0-proposal1', 'endPoint' => substr($url, 0, strrpos($url, '/')), - 'shareTypes' => [ + 'resourceTypes' => [ [ 'name' => 'file', + 'shareTypes' => ['user', 'group'], 'protocols' => [ 'webdav' => '/public.php/webdav/', ] -- cgit v1.2.3 From 2bf2633c0518b331bf7bf006d6c5327cad6ccbe9 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Sun, 17 Feb 2019 17:18:21 +0100 Subject: make sure that the ocm end-point discovery /ocm-provider is not redirected to the index.php Signed-off-by: Bjoern Schiessle --- lib/private/Setup.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 0278191587a..5b2f71e69c5 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -517,6 +517,7 @@ class Setup { $content .= "\n RewriteCond %{REQUEST_FILENAME} !/robots.txt"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/updater/"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs-provider/"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocm-provider/"; $content .= "\n RewriteCond %{REQUEST_URI} !^/\\.well-known/(acme-challenge|pki-validation)/.*"; $content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]"; $content .= "\n RewriteBase " . $rewriteBase; -- cgit v1.2.3 From 6360f1a3894b5c56e69825791cfd8cc39c44cb5a Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 19 Feb 2019 22:20:33 +0100 Subject: add setup check for ocm-provider route Signed-off-by: Bjoern Schiessle --- core/js/setupchecks.js | 40 ++++++++++++++++++++++++++++++++++++++++ settings/js/admin.js | 1 + 2 files changed, 41 insertions(+) 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 documentation.', { 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), -- cgit v1.2.3 From 319a0f2e38cfe01e2871d48f53feebb567d1e081 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 19 Feb 2019 22:38:00 +0100 Subject: check ocs-provider route Signed-off-by: Bjoern Schiessle --- settings/js/admin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/settings/js/admin.js b/settings/js/admin.js index e1418349d24..b29f9fa8307 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -251,6 +251,7 @@ $(document).ready(function(){ 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.checkProviderUrl('/ocs-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), -- cgit v1.2.3 From 2e76bc31a908b18bcd2377e44c55bf9bf21c8efd Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 20 Feb 2019 10:54:39 +0100 Subject: Add unit tests and provide better message Signed-off-by: Morris Jobke --- core/js/setupchecks.js | 6 +++--- core/js/tests/specs/setupchecksSpec.js | 36 ++++++++++++++++++++++++++++++++++ settings/js/admin.js | 4 ++-- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index f7b291b4706..b1213c2c042 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -112,10 +112,10 @@ var afterCall = function(xhr) { var messages = []; if (expectedStatus.indexOf(xhr.status) === -1) { - var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL'); + var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-nginx'); messages.push({ - msg: t('core', 'Your web server is not properly set up to resolve "{url}". Further information can be found in the documentation.', { docLink: docUrl, url: url }), - type: OC.SetupChecks.MESSAGE_TYPE_INFO + msg: t('core', 'Your web server is not properly set up to resolve "{url}". This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in ".htaccess" for Apache or the provided one in the documentation for Nginx at it\'s documentation page. On Nginx those are typically the lines starting with "location ~" that need an update.', { docLink: docUrl, url: url }), + type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } deferred.resolve(messages); diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 05178a3e5cc..55122eda0f0 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -107,6 +107,42 @@ describe('OC.SetupChecks tests', function() { }); }); + describe('checkProviderUrl', function() { + it('should fail with another response status code than the expected one', function(done) { + var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true); + + suite.server.requests[0].respond(302); + + async.done(function( data, s, x ){ + expect(data).toEqual([{ + msg: 'Your web server is not properly set up to resolve "/ocm-provider/". This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in ".htaccess" for Apache or the provided one in the documentation for Nginx at it\'s documentation page. On Nginx those are typically the lines starting with "location ~" that need an update.', + type: OC.SetupChecks.MESSAGE_TYPE_WARNING + }]); + done(); + }); + }); + + it('should return no error with the expected response status code', function(done) { + var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true); + + suite.server.requests[0].respond(200); + + async.done(function( data, s, x ){ + expect(data).toEqual([]); + done(); + }); + }); + + it('should return no error when no check should be run', function(done) { + var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', false); + + async.done(function( data, s, x ){ + expect(data).toEqual([]); + done(); + }); + }); + }); + describe('checkWOFF2Loading', function() { it('should fail with another response status code than the expected one', function(done) { var async = OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), 'http://example.org/PLACEHOLDER'); diff --git a/settings/js/admin.js b/settings/js/admin.js index b29f9fa8307..feb61bf3f6c 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -256,8 +256,8 @@ $(document).ready(function(){ OC.SetupChecks.checkGeneric(), OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl), OC.SetupChecks.checkDataProtected() - ).then(function(check1, check2, check3, check4, check5, check6, check7, check8) { - var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8); + ).then(function(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10) { + var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10); var $el = $('#postsetupchecks'); $('#security-warning-state-loading').addClass('hidden'); -- cgit v1.2.3