mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Server\Connections;
|
|||||||
|
|
||||||
use Evenement\EventEmitterTrait;
|
use Evenement\EventEmitterTrait;
|
||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Nyholm\Psr7\Factory\Psr17Factory;
|
use Nyholm\Psr7\Factory\Psr17Factory;
|
||||||
use Ratchet\Client\WebSocket;
|
use Ratchet\Client\WebSocket;
|
||||||
@@ -13,7 +14,7 @@ use Ratchet\WebSocket\WsConnection;
|
|||||||
use React\Stream\Util;
|
use React\Stream\Util;
|
||||||
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
|
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
|
||||||
|
|
||||||
class ControlConnection
|
class ControlConnection implements Arrayable
|
||||||
{
|
{
|
||||||
use EventEmitterTrait;
|
use EventEmitterTrait;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ class ControlConnection
|
|||||||
public $subdomain;
|
public $subdomain;
|
||||||
public $client_id;
|
public $client_id;
|
||||||
public $proxies = [];
|
public $proxies = [];
|
||||||
|
protected $shared_at;
|
||||||
|
|
||||||
public function __construct(ConnectionInterface $socket, string $host, string $subdomain, string $clientId)
|
public function __construct(ConnectionInterface $socket, string $host, string $subdomain, string $clientId)
|
||||||
{
|
{
|
||||||
@@ -58,4 +60,14 @@ class ControlConnection
|
|||||||
{
|
{
|
||||||
$this->socket->close();
|
$this->socket->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toArray()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'host' => $this->host,
|
||||||
|
'client_id' => $this->client_id,
|
||||||
|
'subdomain' => $this->subdomain,
|
||||||
|
'shared_at' => $this->shared_at,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ class GetSitesController extends AdminController
|
|||||||
{
|
{
|
||||||
$httpConnection->send(
|
$httpConnection->send(
|
||||||
respond_json([
|
respond_json([
|
||||||
'sites' => $this->connectionManager->getConnections()
|
'sites' => collect($this->connectionManager->getConnections())->map(function ($site, $siteId) {
|
||||||
|
$site = $site->toArray();
|
||||||
|
$site['id'] = $siteId;
|
||||||
|
|
||||||
|
return $site;
|
||||||
|
})->values()
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
CREATE TABLE IF NOT EXISTS users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
name STRING NOT NULL,
|
name STRING NOT NULL,
|
||||||
email STRING,
|
|
||||||
auth_token STRING,
|
auth_token STRING,
|
||||||
created_at DATETIME,
|
created_at DATETIME,
|
||||||
updated_at DATETIME
|
updated_at DATETIME
|
||||||
|
|||||||
@@ -113,10 +113,10 @@ class RequestLoggerTest extends TestCase
|
|||||||
|
|
||||||
$logger = new RequestLogger($browser, $cliLogger);
|
$logger = new RequestLogger($browser, $cliLogger);
|
||||||
|
|
||||||
foreach (range(1, 20) as $i) {
|
foreach (range(1, 50) as $i) {
|
||||||
$logger->logRequest($requestString, $parsedRequest);
|
$logger->logRequest($requestString, $parsedRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertCount(RequestLogger::MAX_LOGGED_REQUESTS, $logger->getData());
|
$this->assertCount(config('expose.max_logged_requests'), $logger->getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user