diff --git a/app/Client/Http/HttpClient.php b/app/Client/Http/HttpClient.php index e9146e5..2d12bda 100644 --- a/app/Client/Http/HttpClient.php +++ b/app/Client/Http/HttpClient.php @@ -92,7 +92,7 @@ class HttpClient ]) ->send($request) ->then(function (ResponseInterface $response) use ($proxyConnection) { - if (!isset($response->buffer)) { + if (! isset($response->buffer)) { $response = $this->rewriteResponseHeaders($response); $response->buffer = str($response); @@ -139,13 +139,13 @@ class HttpClient protected function rewriteResponseHeaders(ResponseInterface $response) { - if (!$response->hasHeader('Location')) { + if (! $response->hasHeader('Location')) { return $response; } $location = $response->getHeaderLine('Location'); - if (!strstr($location, $this->connectionData->host)) { + if (! strstr($location, $this->connectionData->host)) { return $response; } diff --git a/app/Commands/ShareCommand.php b/app/Commands/ShareCommand.php index 7375200..b671964 100644 --- a/app/Commands/ShareCommand.php +++ b/app/Commands/ShareCommand.php @@ -27,6 +27,7 @@ class ShareCommand extends Command { if (! empty($this->option('hostname')) && ! empty($this->option('subdomain'))) { $this->error('You can only specify one. Either a custom hostname or a subdomain.'); + return; } diff --git a/app/Server/Http/Controllers/Admin/DeleteHostnameController.php b/app/Server/Http/Controllers/Admin/DeleteHostnameController.php index 94f5f2f..7319b2e 100644 --- a/app/Server/Http/Controllers/Admin/DeleteHostnameController.php +++ b/app/Server/Http/Controllers/Admin/DeleteHostnameController.php @@ -3,7 +3,6 @@ namespace App\Server\Http\Controllers\Admin; use App\Contracts\HostnameRepository; -use App\Contracts\SubdomainRepository; use App\Contracts\UserRepository; use Illuminate\Http\Request; use Ratchet\ConnectionInterface; diff --git a/app/Server/Http/Controllers/Admin/StoreHostnameController.php b/app/Server/Http/Controllers/Admin/StoreHostnameController.php index 16d347c..4f49aad 100644 --- a/app/Server/Http/Controllers/Admin/StoreHostnameController.php +++ b/app/Server/Http/Controllers/Admin/StoreHostnameController.php @@ -3,7 +3,6 @@ namespace App\Server\Http\Controllers\Admin; use App\Contracts\HostnameRepository; -use App\Contracts\SubdomainRepository; use App\Contracts\UserRepository; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; diff --git a/app/Server/Http/Controllers/ControlMessageController.php b/app/Server/Http/Controllers/ControlMessageController.php index 0493c99..30c90ea 100644 --- a/app/Server/Http/Controllers/ControlMessageController.php +++ b/app/Server/Http/Controllers/ControlMessageController.php @@ -3,8 +3,8 @@ namespace App\Server\Http\Controllers; use App\Contracts\ConnectionManager; -use App\Contracts\SubdomainRepository; use App\Contracts\HostnameRepository; +use App\Contracts\SubdomainRepository; use App\Contracts\UserRepository; use App\Http\QueryParameters; use App\Server\Connections\ConnectionConfiguration; @@ -14,9 +14,9 @@ use Ratchet\ConnectionInterface; use Ratchet\WebSocket\MessageComponentInterface; use React\Promise\Deferred; use React\Promise\PromiseInterface; -use stdClass; use function React\Promise\reject; use function React\Promise\resolve as resolvePromise; +use stdClass; class ControlMessageController implements MessageComponentInterface { @@ -116,23 +116,23 @@ class ControlMessageController implements MessageComponentInterface { $this->hasValidConfiguration($connection, $data, $user) ->then(function (ConnectionConfiguration $configuration) use ($data, $connection) { - $data->subdomain = $configuration->getSubdomain(); - $data->hostname = $configuration->getHostname(); + $data->subdomain = $configuration->getSubdomain(); + $data->hostname = $configuration->getHostname(); - $connectionInfo = $this->connectionManager->storeConnection($data->host, $data->subdomain, $data->hostname, $connection); + $connectionInfo = $this->connectionManager->storeConnection($data->host, $data->subdomain, $data->hostname, $connection); - $this->connectionManager->limitConnectionLength($connectionInfo, config('expose.admin.maximum_connection_length')); + $this->connectionManager->limitConnectionLength($connectionInfo, config('expose.admin.maximum_connection_length')); - $connection->send(json_encode([ - 'event' => 'authenticated', - 'data' => [ - 'message' => config('expose.admin.messages.message_of_the_day'), - 'subdomain' => $connectionInfo->subdomain, - 'hostname' => $connectionInfo->hostname, - 'client_id' => $connectionInfo->client_id, - ], + $connection->send(json_encode([ + 'event' => 'authenticated', + 'data' => [ + 'message' => config('expose.admin.messages.message_of_the_day'), + 'subdomain' => $connectionInfo->subdomain, + 'hostname' => $connectionInfo->hostname, + 'client_id' => $connectionInfo->client_id, + ], ])); - }); + }); } protected function handleTcpConnection(ConnectionInterface $connection, $data, $user = null) @@ -301,7 +301,7 @@ class ControlMessageController implements MessageComponentInterface * Check if the given hostname is reserved for a different user. */ return $this->hostnameRepository->getHostnamesByUserId($user['id']) - ->then(function ($foundHostnames) use ($connection, $hostname, $user) { + ->then(function ($foundHostnames) use ($connection, $hostname) { $foundHostname = collect($foundHostnames)->first(function ($foundHostname) use ($hostname) { return Str::is($foundHostname['hostname'], $hostname); });