mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Client;
|
||||
use App\Client\Connections\ControlConnection;
|
||||
use App\Logger\CliRequestLogger;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Ratchet\Client\WebSocket;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\Promise\Deferred;
|
||||
@@ -38,11 +40,28 @@ class Client
|
||||
{
|
||||
$this->logger->info("Sharing http://{$sharedUrl}");
|
||||
|
||||
$sharedUrl = $this->prepareSharedUrl($sharedUrl);
|
||||
|
||||
foreach ($subdomains as $subdomain) {
|
||||
$this->connectToServer($sharedUrl, $subdomain, config('expose.auth_token'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function prepareSharedUrl(string $sharedUrl): string
|
||||
{
|
||||
if (! $parsedUrl = parse_url($sharedUrl)) {
|
||||
return $sharedUrl;
|
||||
}
|
||||
|
||||
$url = Arr::get($parsedUrl, 'host', Arr::get($parsedUrl, 'path'));
|
||||
|
||||
if (Arr::get($parsedUrl, 'scheme') === 'https') {
|
||||
$url .= ':443';
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function connectToServer(string $sharedUrl, $subdomain, $authToken = ''): PromiseInterface
|
||||
{
|
||||
$deferred = new \React\Promise\Deferred();
|
||||
|
||||
@@ -75,6 +75,8 @@ return [
|
||||
'user_repository' => \App\Server\UserRepository\DatabaseUserRepository::class,
|
||||
|
||||
'messages' => [
|
||||
'message_of_the_day' => 'Thank you for using expose.',
|
||||
|
||||
'invalid_auth_token' => 'Authentication failed. Please check your authentication token and try again.',
|
||||
|
||||
'subdomain_taken' => 'The chosen subdomain :subdomain is already taken. Please choose a different subdomain.',
|
||||
|
||||
Reference in New Issue
Block a user