diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-15 02:08:04 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-15 02:17:20 +0100 |
commit | 398b042af79f3be8e65a1f142c362da4318fdf7c (patch) | |
tree | e85f9702f94adedd60530a8843ab4363cc45dc42 /core/js | |
parent | 096d66edc856be66d4c89c034e31f5b3b9170fd2 (diff) | |
download | nextcloud-server-398b042af79f3be8e65a1f142c362da4318fdf7c.tar.gz nextcloud-server-398b042af79f3be8e65a1f142c362da4318fdf7c.zip |
enh(settings): Migrate WOFF2 loading check to a SetupCheck
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/setupchecks.js | 34 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 27 |
2 files changed, 0 insertions, 61 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index fe6ab1105a2..be6dc747540 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -136,40 +136,6 @@ return deferred.promise(); }, - - /** - * Check whether the WOFF2 URLs works. - * - * @param url the URL to test - * @param placeholderUrl the placeholder URL - can be found at OC.theme.docPlaceholderUrl - * @return $.Deferred object resolved with an array of error messages - */ - checkWOFF2Loading: function(url, placeholderUrl) { - var deferred = $.Deferred(); - - var afterCall = function(xhr) { - var messages = []; - if (xhr.status !== 200) { - var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-nginx'); - messages.push({ - msg: t('core', 'Your web server is not properly set up to deliver .woff2 files. This is typically an issue with the Nginx configuration. For Nextcloud 15 it needs an adjustement to also deliver .woff2 files. Compare your Nginx configuration to the recommended configuration in our {linkstart}documentation ↗{linkend}.', { docLink: docUrl, url: url }) - .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + docUrl + '">') - .replace('{linkend}', '</a>'), - type: OC.SetupChecks.MESSAGE_TYPE_WARNING - }); - } - deferred.resolve(messages); - }; - - $.ajax({ - type: 'GET', - url: url, - complete: afterCall, - allowAuthErrors: true - }); - return deferred.promise(); - }, - /** * Runs setup checks on the server side * diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 9ac31ce8acb..378bd4d7f39 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -143,33 +143,6 @@ describe('OC.SetupChecks tests', function() { }); }); - 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/NotoSans-Regular-latin.woff2'), 'http://example.org/PLACEHOLDER'); - - 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 deliver .woff2 files. This is typically an issue with the Nginx configuration. For Nextcloud 15 it needs an adjustement to also deliver .woff2 files. Compare your Nginx configuration to the recommended configuration in our <a target="_blank" rel="noreferrer noopener" class="external" href="http://example.org/admin-nginx">documentation ↗</a>.', - type: OC.SetupChecks.MESSAGE_TYPE_WARNING - }]); - done(); - }); - }); - - it('should return no error with the expected response status code', function(done) { - var async = OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), 'http://example.org/PLACEHOLDER'); - - suite.server.requests[0].respond(200); - - async.done(function( data, s, x ){ - expect(data).toEqual([]); - done(); - }); - }); - }); - describe('checkDataProtected', function() { oc_dataURL = "data"; |