fix: index

- fixed problem with files not pulling from server correct with MIME types
This commit is contained in:
2025-08-11 13:00:55 -04:00
parent 50f62535e6
commit 24a0892160

View File

@@ -3,6 +3,35 @@
use App\Kernel;
if (file_exists(__DIR__.$_SERVER['REQUEST_URI']) && is_readable(__DIR__.$_SERVER['REQUEST_URI']) && is_file(__DIR__.$_SERVER['REQUEST_URI'])) {
$header = 'text/html';
if (substr($_SERVER['REQUEST_URI'], -4) == '.css')
$header = 'text/css';
elseif (substr($_SERVER['REQUEST_URI'], -3) == '.js')
$header = 'text/javascript';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.ico')
$header = 'image/x-icon';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.png')
$header = 'image/png';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.jpg')
$header = 'image/jpeg';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.gif')
$header = 'image/gif';
elseif (substr($_SERVER['REQUEST_URI'], -3) == '.wo' || substr($_SERVER['REQUEST_URI'], -6) == '.woff2')
$header = 'font/woff2';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.ttf')
$header = 'font/truetype';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.eot' || substr($_SERVER['REQUEST_URI'], -5) == '.ttf-')
$header = 'application/vnd.ms-fontobject';
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.svg')
$header = 'image/svg+xml';
elseif (substr($_SERVER['REQUEST_URI'], -5) == '.json')
$header = 'application/json';
elseif (substr($_SERVER['REQUEST_URI'], -3) == '.otf')
$header = 'font/opentype';
elseif (substr($_SERVER['REQUEST_URI'], -5) == '.woff')
$header = 'font/woff';
print header("Content-Type: $header; charset=UTF-8");
print file_get_contents(__DIR__.$_SERVER['REQUEST_URI']);
exit;
}