mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-14 22:15:55 +00:00
Allow users to specify custom hostnames
This commit is contained in:
@@ -43,16 +43,23 @@ class ConnectionManager implements ConnectionManagerContract
|
||||
});
|
||||
}
|
||||
|
||||
public function storeConnection(string $host, ?string $subdomain, ConnectionInterface $connection): ControlConnection
|
||||
public function storeConnection(string $host, ?string $subdomain, ?string $hostname, ConnectionInterface $connection): ControlConnection
|
||||
{
|
||||
$clientId = (string) uniqid();
|
||||
|
||||
$connection->client_id = $clientId;
|
||||
|
||||
if (! is_null($hostname) && $hostname !== '') {
|
||||
$subdomain = '';
|
||||
} else {
|
||||
$subdomain = $subdomain ?? $this->subdomainGenerator->generateSubdomain();
|
||||
}
|
||||
|
||||
$storedConnection = new ControlConnection(
|
||||
$connection,
|
||||
$host,
|
||||
$subdomain ?? $this->subdomainGenerator->generateSubdomain(),
|
||||
$subdomain,
|
||||
$hostname,
|
||||
$clientId,
|
||||
$this->getAuthTokenFromConnection($connection)
|
||||
);
|
||||
@@ -150,6 +157,13 @@ class ConnectionManager implements ConnectionManagerContract
|
||||
});
|
||||
}
|
||||
|
||||
public function findControlConnectionForHostname($hostname): ?ControlConnection
|
||||
{
|
||||
return collect($this->connections)->last(function ($connection) use ($hostname) {
|
||||
return $connection->hostname == $hostname;
|
||||
});
|
||||
}
|
||||
|
||||
public function findControlConnectionForClientId(string $clientId): ?ControlConnection
|
||||
{
|
||||
return collect($this->connections)->last(function ($connection) use ($clientId) {
|
||||
|
||||
Reference in New Issue
Block a user