|
|
|
@ -14,16 +14,19 @@
|
|
|
|
|
|
|
|
|
|
namespace Inforbank;
|
|
|
|
|
|
|
|
|
|
use Bat\MimeTypeTool;
|
|
|
|
|
|
|
|
|
|
class Proxy
|
|
|
|
|
{
|
|
|
|
|
public function __invoke($request, $response, $next)
|
|
|
|
|
{
|
|
|
|
|
$uri = $request->getUri();
|
|
|
|
|
$path = $uri->getPath();
|
|
|
|
|
if (strpos($path, 'assets/') !== false) {
|
|
|
|
|
if (file_exists($path)) {
|
|
|
|
|
$pa = explode('assets/', $path, 2);
|
|
|
|
|
|
|
|
|
|
if (isset($pa[1])) {
|
|
|
|
|
$path = __DIR__ . '/../assets/'.$pa[1];
|
|
|
|
|
$path = realpath($path);
|
|
|
|
|
|
|
|
|
|
if ($path) {
|
|
|
|
|
$ext = pathinfo($path, PATHINFO_EXTENSION);
|
|
|
|
|
$ext2Mime = array(
|
|
|
|
|
|
|
|
|
|