aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/lib/SetupChecks/JavaScriptModules.php
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-01-21 20:13:47 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2024-01-21 20:20:53 +0100
commitd2cb90bda2df52c49a5a3e48fc0593ede2cc02ff (patch)
tree590b003799c5d9f833d998b9454c9478b8d2c608 /apps/settings/lib/SetupChecks/JavaScriptModules.php
parent1612d025cf21ac0ae70327c46dd59be66c096627 (diff)
downloadnextcloud-server-d2cb90bda2df52c49a5a3e48fc0593ede2cc02ff.tar.gz
nextcloud-server-d2cb90bda2df52c49a5a3e48fc0593ede2cc02ff.zip
fix(settings): Allow to connect to local address when checking for `.mjs` support
Also reduce the severity in case of a failed check to warning. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/settings/lib/SetupChecks/JavaScriptModules.php')
-rw-r--r--apps/settings/lib/SetupChecks/JavaScriptModules.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/settings/lib/SetupChecks/JavaScriptModules.php b/apps/settings/lib/SetupChecks/JavaScriptModules.php
index 151e04ecf2b..92e0035eedd 100644
--- a/apps/settings/lib/SetupChecks/JavaScriptModules.php
+++ b/apps/settings/lib/SetupChecks/JavaScriptModules.php
@@ -64,12 +64,18 @@ class JavaScriptModules implements ISetupCheck {
foreach ($testURLs as $testURL) {
try {
$client = $this->clientService->newClient();
- $response = $client->head($testURL, ['connect_timeout' => 10]);
+ $response = $client->head($testURL, [
+ 'connect_timeout' => 10,
+ 'nextcloud' => [
+ 'allow_local_address' => true,
+ ],
+ ]);
if (preg_match('/(text|application)\/javascript/i', $response->getHeader('Content-Type'))) {
return SetupResult::success();
}
} catch (\Throwable $e) {
$this->logger->debug('Can not connect to local server for checking JavaScript modules support', ['exception' => $e, 'url' => $testURL]);
+ return SetupResult::warning($this->l10n->t('Could not check for JavaScript support. Please check manually if your webserver serves `.mjs` files using the JavaScript MIME type.'));
}
}
return SetupResult::error($this->l10n->t('Your webserver does not serve `.mjs` files using the JavaScript MIME type. This will break some apps by preventing browsers from executing the JavaScript files. You should configure your webserver to serve `.mjs` files with either the `text/javascript` or `application/javascript` MIME type.'));