mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
@@ -31,6 +31,9 @@ class Client
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
protected $timeConnected = 0;
|
protected $timeConnected = 0;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
protected $shouldExit = true;
|
||||||
|
|
||||||
public static $user = [];
|
public static $user = [];
|
||||||
public static $subdomains = [];
|
public static $subdomains = [];
|
||||||
|
|
||||||
@@ -41,6 +44,11 @@ class Client
|
|||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function shouldExit($shouldExit = true)
|
||||||
|
{
|
||||||
|
$this->shouldExit = $shouldExit;
|
||||||
|
}
|
||||||
|
|
||||||
public function share(string $sharedUrl, array $subdomains = [], $serverHost = null)
|
public function share(string $sharedUrl, array $subdomains = [], $serverHost = null)
|
||||||
{
|
{
|
||||||
$sharedUrl = $this->prepareSharedUrl($sharedUrl);
|
$sharedUrl = $this->prepareSharedUrl($sharedUrl);
|
||||||
@@ -237,7 +245,9 @@ class Client
|
|||||||
$deferred->reject();
|
$deferred->reject();
|
||||||
|
|
||||||
$this->loop->futureTick(function () {
|
$this->loop->futureTick(function () {
|
||||||
exit(1);
|
if ($this->shouldExit) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,19 +155,6 @@ class TunnelTest extends TestCase
|
|||||||
$this->assertInstanceOf(Connection::class, $connection);
|
$this->assertInstanceOf(Connection::class, $connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function it_rejects_tcp_sharing_if_disabled()
|
|
||||||
{
|
|
||||||
$this->createTestTcpServer();
|
|
||||||
|
|
||||||
$this->app['config']['expose.admin.allow_tcp_port_sharing'] = false;
|
|
||||||
|
|
||||||
$this->expectException(\UnexpectedValueException::class);
|
|
||||||
|
|
||||||
$client = $this->createClient();
|
|
||||||
$this->await($client->connectToServerAndShareTcp(8085));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_rejects_tcp_sharing_if_forbidden()
|
public function it_rejects_tcp_sharing_if_forbidden()
|
||||||
{
|
{
|
||||||
@@ -707,7 +694,9 @@ class TunnelTest extends TestCase
|
|||||||
->setPort(8080)
|
->setPort(8080)
|
||||||
->createClient();
|
->createClient();
|
||||||
|
|
||||||
return app(Client::class);
|
$client = app(Client::class);
|
||||||
|
$client->shouldExit(false);
|
||||||
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createUser(array $data)
|
protected function createUser(array $data)
|
||||||
|
|||||||
Reference in New Issue
Block a user