diff --git a/app/Client/Factory.php b/app/Client/Factory.php index 84bb5ca..3fa683d 100644 --- a/app/Client/Factory.php +++ b/app/Client/Factory.php @@ -17,7 +17,6 @@ use Ratchet\WebSocket\WsServer; use React\EventLoop\Factory as LoopFactory; use React\EventLoop\LoopInterface; -use Symfony\Component\Routing\Route; class Factory { diff --git a/app/Client/Http/Controllers/DashboardController.php b/app/Client/Http/Controllers/DashboardController.php index c6c9650..05bdad0 100644 --- a/app/Client/Http/Controllers/DashboardController.php +++ b/app/Client/Http/Controllers/DashboardController.php @@ -25,15 +25,17 @@ public function handle(Request $request, ConnectionInterface $httpConnection) )); } - private function getJsFilePath() { - return "/files/build/internal-dashboard/assets/" . collect(scandir(app()->basePath() . "/public/build/internal-dashboard/assets/"))->filter(function($file) { - return str($file)->startsWith("index-") && str($file)->endsWith(".js"); + private function getJsFilePath() + { + return '/files/build/internal-dashboard/assets/'.collect(scandir(app()->basePath().'/public/build/internal-dashboard/assets/'))->filter(function ($file) { + return str($file)->startsWith('index-') && str($file)->endsWith('.js'); })->first(); } - private function getCssFilePath() { - return "/files/build/internal-dashboard/assets/" . collect(scandir(app()->basePath() . "/public/build/internal-dashboard/assets/"))->filter(function($file) { - return str($file)->startsWith("index-") && str($file)->endsWith(".css"); + private function getCssFilePath() + { + return '/files/build/internal-dashboard/assets/'.collect(scandir(app()->basePath().'/public/build/internal-dashboard/assets/'))->filter(function ($file) { + return str($file)->startsWith('index-') && str($file)->endsWith('.css'); })->first(); } } diff --git a/app/Client/Http/Controllers/FileController.php b/app/Client/Http/Controllers/FileController.php index a3b0ceb..a3ed8c8 100644 --- a/app/Client/Http/Controllers/FileController.php +++ b/app/Client/Http/Controllers/FileController.php @@ -3,33 +3,34 @@ namespace App\Client\Http\Controllers; use App\Http\Controllers\Controller; -use Illuminate\Http\Request; -use Ratchet\ConnectionInterface; use GuzzleHttp\Psr7\Message; use GuzzleHttp\Psr7\Response; +use Illuminate\Http\Request; +use Ratchet\ConnectionInterface; class FileController extends Controller { public function handle(Request $request, ConnectionInterface $httpConnection) { - $file = $request->get("path"); + $file = $request->get('path'); - $filePath = app()->basePath() . "/public/" . $file; + $filePath = app()->basePath().'/public/'.$file; - if(!file_exists($filePath)) { + if (! file_exists($filePath)) { $httpConnection->send(Message::toString(new Response( 404, ['Content-Type' => 'text/html'], - "File not found" + 'File not found' ))); + return; } $file = file_get_contents($filePath); $contentType = mime_content_type($filePath); - if(str($filePath)->endsWith(".css")) { - $contentType = "text/css"; + if (str($filePath)->endsWith('.css')) { + $contentType = 'text/css'; } $httpConnection->send(Message::toString(new Response( diff --git a/app/Commands/ServerAwareCommand.php b/app/Commands/ServerAwareCommand.php index b9ed4ab..4291808 100644 --- a/app/Commands/ServerAwareCommand.php +++ b/app/Commands/ServerAwareCommand.php @@ -94,7 +94,7 @@ protected function lookupRemoteServers() ])->get( // config('expose.server_endpoint', static::DEFAULT_SERVER_ENDPOINT) 'https://expose-platform.test/api/servers' - )->json(); + )->json(); } catch (\Throwable $e) { return []; } diff --git a/app/Http/Controllers/Concerns/LoadsViews.php b/app/Http/Controllers/Concerns/LoadsViews.php index 452217a..fd95f4c 100644 --- a/app/Http/Controllers/Concerns/LoadsViews.php +++ b/app/Http/Controllers/Concerns/LoadsViews.php @@ -31,7 +31,8 @@ protected function getView(?ConnectionInterface $connection, string $view, array } } - protected function getBlade(?ConnectionInterface $connection, string $view, array $data = []) { + protected function getBlade(?ConnectionInterface $connection, string $view, array $data = []) + { return stream_for(view($view, $data)); // TODO: deprecated } } diff --git a/app/Http/RouteGenerator.php b/app/Http/RouteGenerator.php index 277be35..fc2a5e2 100644 --- a/app/Http/RouteGenerator.php +++ b/app/Http/RouteGenerator.php @@ -2,9 +2,9 @@ namespace App\Http; +use App\Client\Http\Controllers\FileController; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use App\Client\Http\Controllers\FileController; class RouteGenerator { @@ -56,7 +56,8 @@ public function addSymfonyRoute(string $name, Route $route) $this->routes->add($name, $route); } - public function addPublicFilesystem() { + public function addPublicFilesystem() + { $this->routes->add('get-files', new Route( '/files/{path}', ['_controller' => FileController::class],