diff --git a/.htaccess b/.htaccess index 557844974a481..23bc9f75ff688 100644 --- a/.htaccess +++ b/.htaccess @@ -49,8 +49,8 @@ - # Let browsers cache WOFF files for a week - + # Let browsers cache OTF and WOFF files for a week + Header set Cache-Control "max-age=604800" @@ -106,7 +106,7 @@ SetEnvIf Transfer-Encoding "chunked" proxy-sendcl=1 -# 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 d54cbc908ef6f..38387ffb25d69 100644 --- a/apps/settings/lib/SetupChecks/Woff2Loading.php +++ b/apps/settings/lib/SetupChecks/Woff2Loading.php @@ -34,7 +34,7 @@ use Psr\Log\LoggerInterface; /** - * Check whether the WOFF2 URLs works + * Check whether the OTF and WOFF2 URLs works */ class Woff2Loading implements ISetupCheck { use CheckServerResponseTrait; @@ -53,11 +53,18 @@ public function getCategory(): string { } 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) { @@ -69,14 +76,22 @@ public function run(): SetupResult { 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/apps/theming/fonts/OpenDyslexic-Bold.otf b/apps/theming/fonts/OpenDyslexic-Bold.otf index 7d074cbddeef9..4c492e2fcc283 100644 Binary files a/apps/theming/fonts/OpenDyslexic-Bold.otf and b/apps/theming/fonts/OpenDyslexic-Bold.otf differ diff --git a/apps/theming/fonts/OpenDyslexic-Bold.ttf b/apps/theming/fonts/OpenDyslexic-Bold.ttf deleted file mode 100644 index 25cf37f99e21f..0000000000000 Binary files a/apps/theming/fonts/OpenDyslexic-Bold.ttf and /dev/null differ diff --git a/apps/theming/fonts/OpenDyslexic-Bold.woff b/apps/theming/fonts/OpenDyslexic-Bold.woff deleted file mode 100644 index 41886ae9ddaf2..0000000000000 Binary files a/apps/theming/fonts/OpenDyslexic-Bold.woff and /dev/null differ diff --git a/apps/theming/fonts/OpenDyslexic-Regular.otf b/apps/theming/fonts/OpenDyslexic-Regular.otf index ebef13c4ce374..1226d2ab28190 100644 Binary files a/apps/theming/fonts/OpenDyslexic-Regular.otf and b/apps/theming/fonts/OpenDyslexic-Regular.otf differ diff --git a/apps/theming/fonts/OpenDyslexic-Regular.ttf b/apps/theming/fonts/OpenDyslexic-Regular.ttf deleted file mode 100644 index 4b0cb8c46b79f..0000000000000 Binary files a/apps/theming/fonts/OpenDyslexic-Regular.ttf and /dev/null differ diff --git a/apps/theming/fonts/OpenDyslexic-Regular.woff b/apps/theming/fonts/OpenDyslexic-Regular.woff deleted file mode 100644 index 26a2934d64055..0000000000000 Binary files a/apps/theming/fonts/OpenDyslexic-Regular.woff and /dev/null differ diff --git a/apps/theming/lib/Themes/DyslexiaFont.php b/apps/theming/lib/Themes/DyslexiaFont.php index 3275a005c8d4a..9f8a0a048d694 100644 --- a/apps/theming/lib/Themes/DyslexiaFont.php +++ b/apps/theming/lib/Themes/DyslexiaFont.php @@ -61,30 +61,22 @@ public function getCSSVariables(): array { } public function getCustomCss(): string { - $fontPathWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.woff'); $fontPathOtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.otf'); - $fontPathTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.ttf'); - $boldFontPathWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.woff'); $boldFontPathOtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.otf'); - $boldFontPathTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.ttf'); return " @font-face { font-family: 'OpenDyslexic'; font-style: normal; font-weight: 400; - src: url('$fontPathWoff') format('woff'), - url('$fontPathOtf') format('opentype'), - url('$fontPathTtf') format('truetype'); + src: url('$fontPathOtf') format('opentype'); } - + @font-face { font-family: 'OpenDyslexic'; font-style: normal; font-weight: 700; - src: url('$boldFontPathWoff') format('woff'), - url('$boldFontPathOtf') format('opentype'), - url('$boldFontPathTtf') format('truetype'); + src: url('$boldFontPathOtf') format('opentype'); } "; } diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index a526f94d4aa1c..64aa770a9e608 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -170,7 +170,7 @@ public function testGetCustomCss($webRoot, $prettyUrlsEnabled) { ->with('htaccess.IgnoreFrontController', false) ->willReturn($prettyUrlsEnabled); - $this->assertStringContainsString("'$webRoot/apps/theming/fonts/OpenDyslexic-Regular.woff'", $this->dyslexiaFont->getCustomCss()); + $this->assertStringContainsString("'$webRoot/apps/theming/fonts/OpenDyslexic-Regular.otf'", $this->dyslexiaFont->getCustomCss()); $this->assertStringNotContainsString('index.php', $this->dyslexiaFont->getCustomCss()); } } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 0b7780c5cd0bc..6c0419ed6d652 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -523,7 +523,7 @@ public static function updateHtaccess(): bool { $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|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|mjs|svg|gif|png|html|otf|ttf|woff2?|ico|jpg|jpeg|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";