Commit 31f128df authored by Markus Willman's avatar Markus Willman

site icon fixes, part 2

parent 62fab1e8
......@@ -18,12 +18,12 @@ if (!defined('IN_DCBASE')) exit;
* Top-level array keys contain the pattern to be matched, where <name> represents
* a named path segment and enclosing a section in parentheses makes it optional.
*
* Note: since this file contains references to php classes it can not be loaded before
* Note: since this file contains references to php classes it should not be loaded before
* the autoloader has been registered (see: bootstrap.php)
*/
return array(
// hardcoded files outside of normal content directory
'/DCBase/<filename>' => array(
// hardcoded files + fallback files for subdomains (robots.txt, favicon.ico)
'/<filename>' => array(
// required: set the handler for this dynamic path, must be a subclass of \DCBase\Handler\AbstractHandler
'handler' => \DCBase\Handler\ExtFileHandler::class,
......@@ -34,8 +34,8 @@ return array(
// optional: override the regex pattern used to match the named argument, the patterns are automatically enclosed in a capture group
'regex' => array(
// don't allow common characters not valid in filenames (path separators are allowed)
'filename' => '[^:\*\?<>\|"\n]++',
// these are files that should always exists
'filename' => '(?:DCBase/)?LICENSE|(?:DCBase/)?README|robots\.txt|favicon\.ico',
)
),
......
......@@ -2,10 +2,10 @@
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="img/icons/mstile-70x70.png" />
<square150x150logo src="img/icons/mstile-150x150.png" />
<wide310x150logo src="img/icons/mstile-310x150.png"/>
<square310x310logo src="img/icons/mstile-310x310.png" />
<square70x70logo src="//www.dcbase.org/style/img/icons/mstile-70x70.png" />
<square150x150logo src="//www.dcbase.org/style/img/icons/mstile-150x150.png" />
<wide310x150logo src="//www.dcbase.org/style/img/icons/mstile-310x150.png" />
<square310x310logo src="//www.dcbase.org/style/img/icons/mstile-310x310.png" />
<TileColor>#2b5797</TileColor>
</tile>
</msapplication>
......
......@@ -2,33 +2,33 @@
"name": "Direct Connect Network Foundation",
"icons": [
{
"src": "/img/icons/favicon-16x16.png",
"src": "//www.dcbase.org/style/img/icons/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "/img/icons/favicon-32x32.png",
"src": "//www.dcbase.org/style/img/icons/favicon-32x32.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "/img/icons/favicon-194x194.png",
"src": "//www.dcbase.org/style/img/icons/favicon-194x194.png",
"sizes": "194x194",
"type": "image/png"
},
{
"src": "/img/icons/android-chrome-192x192.png",
"src": "//www.dcbase.org/style/img/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/img/icons/android-chrome-512x512.png",
"src": "//www.dcbase.org/style/img/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "../?source=a2hs",
"start_url": "//www.dcbase.org/?source=a2hs",
"background_color": "#ffffff",
"theme_color": "#ffffff",
"display": "standalone",
......
......@@ -55,12 +55,12 @@
<!-- Site icons -->
<link rel="apple-touch-icon" sizes="180x180" href="{{ make_url(theme.assets_url ~ '/img/icons/apple-touch-icon.png') }}">
<link rel="mask-icon" href="{{ make_url(theme.assets_url ~ '/img/icons/safari-pinned-tab.svg') }}" color="#2b5797">
<link rel="icon" type="image/png" href="{{ make_url(theme.assets_url ~ '/img/icons/favicon-16x16.png') }}" sizes="16x16">
<link rel="icon" type="image/png" href="{{ make_url(theme.assets_url ~ '/img/icons/favicon-32x32.png') }}" sizes="32x32">
<link rel="icon" type="image/png" href="{{ make_url(theme.assets_url ~ '/img/icons/favicon-194x194.png') }}" sizes="194x194">
<link rel="icon" type="image/png" href="{{ make_url(theme.assets_url ~ '/img/icons/android-chrome-192x192.png') }}" sizes="192x192">
{% if is_root_domain %}<link rel="manifest" href="{{ make_url(theme.assets_url ~ '/manifest.json') }}">{% endif %}
<link rel="mask-icon" href="{{ make_url(theme.assets_url ~ '/img/icons/safari-pinned-tab.svg') }}" color="#2b5797">
<link rel="shortcut icon" href="{{ make_url('/favicon.ico') }}">
{% block styles -%}
......
......@@ -22,7 +22,7 @@ use DCBase\Response\ResponseHelper;
use DCBase\WebResponse;
/**
* Handler which serves fixed set of files outside of DCBASE_CONTENT_ROOT
* Handler which serves fixed set of files outside of DCBASE_CONTENT_ROOT and provides fallbacks for subdomains
*/
class ExtFileHandler extends AbstractHandler
{
......@@ -36,12 +36,26 @@ class ExtFileHandler extends AbstractHandler
*/
public function handleResource(WebRequest $request, string $relative_path, SplFileInfo $file = null)
{
// serve hardcoded files from git root
// if the file resolved by FrontController exists, prefer it instead
if ($file->isFile())
return false;
// fallback for subdomains, serve robots.txt and favicon.ico
$filename = $request->getPathSegment('filename');
if ($filename === 'LICENSE')
if ($filename === 'robots.txt' || $filename === 'favicon.ico')
{
$candidate = new SplFileInfo(DCBASE_CONTENT_ROOT . $filename);
if ($candidate->isFile())
return WebResponse::file($request, $candidate);
}
// serve hardcoded files from git root (request uri may be prefixed with 'DCBase/', see HandlerMap config file)
if ($filename === 'LICENSE' || $filename === 'DCBase/LICENSE')
{
return WebResponse::text($request, new SplFileInfo(DCBASE_ROOT_PATH . 'LICENSE'));
}
if ($filename === 'README')
if ($filename === 'README' || $filename === 'DCBase/README')
{
$response = ResponseHelper::serveMarkdownFile($request, new SplFileInfo(DCBASE_ROOT_PATH . 'README.md'));
if ($response instanceof WebResponse)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment