Improve CI reporting and Lighthouse checks
pauljd/davidson-ci: Davidson CI / ai-review (push) Successful in 1m0s
pauljd/davidson-ci: Davidson CI / quality (push) Successful in 1m18s

This commit is contained in:
2026-10-01 12:01:57 +01:00
parent fdbdcd71a7
commit 3068f739e4
7 changed files with 56 additions and 4 deletions
+22
View File
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
// Router for the Lighthouse static server.
// PHP's built-in server answers requests for missing files with index.html,
// which makes Lighthouse read HTML as robots.txt. Return a real 404 instead.
$path = rawurldecode((string) parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH));
$root = (string) realpath($_SERVER['DOCUMENT_ROOT'] ?? '.');
$target = realpath($root . $path);
$insideRoot = $target !== false
&& ($target === $root || str_starts_with($target, $root . DIRECTORY_SEPARATOR));
if ($insideRoot && (is_file($target) || is_file($target . '/index.html'))) {
return false;
}
http_response_code(404);
header('Content-Type: text/plain; charset=utf-8');
echo "404 Not Found\n";