aboutsummaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-03-01 15:02:48 +0100
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-03-07 14:06:08 +0100
commit3056bc4962bd3a6f3a42bf5670256afa5076ee54 (patch)
tree348547e6db9dfb453a82f6f0614b66f68cf41e7d /core/js
parent1ea88a73f6343a9b39b30736086484d0c072ae46 (diff)
downloadnextcloud-server-3056bc4962bd3a6f3a42bf5670256afa5076ee54.tar.gz
nextcloud-server-3056bc4962bd3a6f3a42bf5670256afa5076ee54.zip
fix(settings): Remove migrated SetupCheck from legacy JS code
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/setupchecks.js48
-rw-r--r--core/js/tests/specs/setupchecksSpec.js81
2 files changed, 0 insertions, 129 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index bf126f8ba4f..00120d678a8 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -48,54 +48,6 @@
},
/**
- * Check whether the .well-known URLs works.
- *
- * @param url the URL to test
- * @param placeholderUrl the placeholder URL - can be found at OC.theme.docPlaceholderUrl
- * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned
- * @param {int|int[]} expectedStatus the expected HTTP status to be returned by the URL, 207 by default
- * @return $.Deferred object resolved with an array of error messages
- */
- checkWellKnownUrl: function(verb, url, placeholderUrl, runCheck, expectedStatus, checkCustomHeader) {
- if (expectedStatus === undefined) {
- expectedStatus = [207];
- }
-
- if (!Array.isArray(expectedStatus)) {
- expectedStatus = [expectedStatus];
- }
-
- var deferred = $.Deferred();
-
- if(runCheck === false) {
- deferred.resolve([]);
- return deferred.promise();
- }
- var afterCall = function(xhr) {
- var messages = [];
- var customWellKnown = xhr.getResponseHeader('X-NEXTCLOUD-WELL-KNOWN')
- if (expectedStatus.indexOf(xhr.status) === -1 || (checkCustomHeader && !customWellKnown)) {
- 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 {linkstart}documentation ↗{linkend}.', { url: url })
- .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + docUrl + '">')
- .replace('{linkend}', '</a>'),
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- });
- }
- deferred.resolve(messages);
- };
-
- $.ajax({
- type: verb,
- url: url,
- complete: afterCall,
- allowAuthErrors: true
- });
- return deferred.promise();
- },
-
- /**
* Runs setup checks on the server side
*
* @return $.Deferred object resolved with an array of error messages
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index a0d6f69e1d9..bef316b16c9 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -60,53 +60,6 @@ describe('OC.SetupChecks tests', function() {
});
});
- describe('checkWellKnownUrl', function() {
- it('should fail with another response status code than the expected one', function(done) {
- var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', true, 207);
-
- suite.server.requests[0].respond(200);
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="http://example.org/admin-setup-well-known-URL">documentation ↗</a>.',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- }]);
- done();
- });
- });
-
- it('should return no error with the expected response status code', function(done) {
- var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', true, 207);
-
- suite.server.requests[0].respond(207);
-
- async.done(function( data, s, x ){
- expect(data).toEqual([]);
- done();
- });
- });
-
- it('should return no error with the default expected response status code', function(done) {
- var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', true);
-
- suite.server.requests[0].respond(207);
-
- 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.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', false);
-
- async.done(function( data, s, x ){
- expect(data).toEqual([]);
- done();
- });
- });
- });
-
describe('checkSetup', function() {
it('should return an error if server has no internet connection', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -303,40 +256,6 @@ describe('OC.SetupChecks tests', function() {
});
});
- // THe following test is invalid as the code in core/js/setupchecks.js is calling
- // window.location.protocol which always return http during tests
- // if there is a way to trick window.location.protocol during test, then we could re-activate it
- /*
- it('should return an error if the protocol is https but the server generates http links', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This most likely means that you are behind a reverse proxy and the overwrite config variables are not set correctly. Please read <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/foo/bar.html">the documentation page about this ↗</a>.',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- }]);
- done();
- });
- });
- */
it('should not return an error if the protocol is http and the server generates http links', function(done) {
var async = OC.SetupChecks.checkSetup();