aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-09-16 09:58:54 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-09-16 09:26:59 +0000
commit9371d93249e371b002a4529b5568a64237812bf1 (patch)
tree23ad5fd955af102e8310eac42600129df5a29898
parent32866bc7eefbc33722cbbee7a2550f2ac868da7b (diff)
downloadnextcloud-server-9371d93249e371b002a4529b5568a64237812bf1.tar.gz
nextcloud-server-9371d93249e371b002a4529b5568a64237812bf1.zip
fix(a11y): Add OTF font loading checkbackport/48063/stable30
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--.htaccess6
-rw-r--r--apps/settings/lib/SetupChecks/Woff2Loading.php27
-rw-r--r--lib/private/Setup.php2
3 files changed, 25 insertions, 10 deletions
diff --git a/.htaccess b/.htaccess
index f9908fe0b69..1406448db0a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -49,8 +49,8 @@
</Else>
</FilesMatch>
- # Let browsers cache WOFF files for a week
- <FilesMatch "\.woff2?$">
+ # Let browsers cache OTF and WOFF files for a week
+ <FilesMatch "\.(otf|woff2?)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
</IfModule>
@@ -106,7 +106,7 @@
SetEnvIf Transfer-Encoding "chunked" proxy-sendcl=1
</IfModule>
-# Apache disabled the sending of the server-side content-length header
+# Apache disabled the sending of the server-side content-length header
# in their 2.4.59 patch updated which breaks some use-cases in Nextcloud.
# Setting ap_trust_cgilike_cl allows to bring back the usual behaviour.
# See https://bz.apache.org/bugzilla/show_bug.cgi?id=68973
diff --git a/apps/settings/lib/SetupChecks/Woff2Loading.php b/apps/settings/lib/SetupChecks/Woff2Loading.php
index 5d8f23338e3..769653c4618 100644
--- a/apps/settings/lib/SetupChecks/Woff2Loading.php
+++ b/apps/settings/lib/SetupChecks/Woff2Loading.php
@@ -17,7 +17,7 @@ use OCP\SetupCheck\SetupResult;
use Psr\Log\LoggerInterface;
/**
- * Check whether the WOFF2 URLs works
+ * Check whether the OTF and WOFF2 URLs works
*/
class Woff2Loading implements ISetupCheck {
use CheckServerResponseTrait;
@@ -36,11 +36,18 @@ class Woff2Loading implements ISetupCheck {
}
public function getName(): string {
- return $this->l10n->t('WOFF2 file loading');
+ return $this->l10n->t('Font file loading');
}
public function run(): SetupResult {
- $url = $this->urlGenerator->linkTo('', 'core/fonts/NotoSans-Regular-latin.woff2');
+ $result = $this->checkFont('otf', $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.otf'));
+ if ($result->getSeverity() !== SetupResult::SUCCESS) {
+ return $result;
+ }
+ return $this->checkFont('woff2', $this->urlGenerator->linkTo('', 'core/fonts/NotoSans-Regular-latin.woff2'));
+ }
+
+ protected function checkFont(string $fileExtension, string $url): SetupResult {
$noResponse = true;
$responses = $this->runHEAD($url);
foreach ($responses as $response) {
@@ -52,14 +59,22 @@ class Woff2Loading implements ISetupCheck {
if ($noResponse) {
return SetupResult::info(
- $this->l10n->t('Could not check for WOFF2 loading support. Please check manually if your webserver serves `.woff2` files.') . "\n" . $this->serverConfigHelp(),
+ str_replace(
+ '{extension}',
+ $fileExtension,
+ $this->l10n->t('Could not check for {extension} loading support. Please check manually if your webserver serves `.{extension}` files.') . "\n" . $this->serverConfigHelp(),
+ ),
$this->urlGenerator->linkToDocs('admin-nginx'),
);
}
return SetupResult::warning(
- $this->l10n->t('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 documentation.'),
+ str_replace(
+ '{extension}',
+ $fileExtension,
+ $this->l10n->t('Your web server is not properly set up to deliver .{extension} files. This is typically an issue with the Nginx configuration. For Nextcloud 15 it needs an adjustment to also deliver .{extension} files. Compare your Nginx configuration to the recommended configuration in our documentation.'),
+ ),
$this->urlGenerator->linkToDocs('admin-nginx'),
);
-
+
}
}
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index 62db4879bbc..95775e36a3e 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -484,7 +484,7 @@ class Setup {
$content .= "\n Options -MultiViews";
$content .= "\n RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
$content .= "\n RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]";
- $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|ttf|woff2?|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$";
+ $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\\.php";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\\.ico|manifest\\.json)$";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\\.php";