mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
@@ -120,6 +120,8 @@ class Client
|
||||
$httpProtocol = $this->configuration->port() === 443 ? 'https' : 'http';
|
||||
$host = $data->server_host ?? $this->configuration->host();
|
||||
|
||||
$this->configuration->setServerHost($host);
|
||||
|
||||
$this->logger->info($data->message);
|
||||
$this->logger->info("Local-URL:\t\t{$sharedUrl}");
|
||||
$this->logger->info("Dashboard-URL:\t\thttp://127.0.0.1:".config()->get('expose.dashboard_port'));
|
||||
|
||||
@@ -6,6 +6,9 @@ class Configuration
|
||||
{
|
||||
/** @var string */
|
||||
protected $host;
|
||||
|
||||
/** @var string */
|
||||
protected $serverHost;
|
||||
|
||||
/** @var int */
|
||||
protected $port;
|
||||
@@ -15,7 +18,7 @@ class Configuration
|
||||
|
||||
public function __construct(string $host, int $port, ?string $auth = null)
|
||||
{
|
||||
$this->host = $host;
|
||||
$this->serverHost = $this->host = $host;
|
||||
|
||||
$this->port = $port;
|
||||
|
||||
@@ -27,6 +30,11 @@ class Configuration
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
public function serverHost(): string
|
||||
{
|
||||
return $this->serverHost;
|
||||
}
|
||||
|
||||
public function auth(): ?string
|
||||
{
|
||||
return $this->auth;
|
||||
@@ -37,10 +45,15 @@ class Configuration
|
||||
return intval($this->port);
|
||||
}
|
||||
|
||||
public function setServerHost($host)
|
||||
{
|
||||
$this->serverHost = $host;
|
||||
}
|
||||
|
||||
public function getUrl(string $subdomain): string
|
||||
{
|
||||
$httpProtocol = $this->port() === 443 ? 'https' : 'http';
|
||||
$host = $this->host();
|
||||
$host = $this->serverHost();
|
||||
|
||||
if ($httpProtocol !== 'https') {
|
||||
$host .= ":{$this->port()}";
|
||||
|
||||
@@ -29,7 +29,7 @@ abstract class ServerAwareCommand extends Command
|
||||
|
||||
protected function configureConnectionLogger()
|
||||
{
|
||||
app()->bind(CliRequestLogger::class, function () {
|
||||
app()->singleton(CliRequestLogger::class, function () {
|
||||
return new CliRequestLogger(new ConsoleOutput());
|
||||
});
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ class CliRequestLogger extends Logger
|
||||
|
||||
public function logRequest(LoggedRequest $loggedRequest)
|
||||
{
|
||||
$dashboardUrl = 'http://127.0.0.1:'.config('expose.dashboard_port');
|
||||
|
||||
if ($this->requests->has($loggedRequest->id())) {
|
||||
$this->requests[$loggedRequest->id()] = $loggedRequest;
|
||||
} else {
|
||||
@@ -78,11 +80,11 @@ class CliRequestLogger extends Logger
|
||||
|
||||
$this->section->clear();
|
||||
|
||||
$this->table->setRows($this->requests->map(function (LoggedRequest $loggedRequest) {
|
||||
$this->table->setRows($this->requests->map(function (LoggedRequest $loggedRequest) use ($dashboardUrl) {
|
||||
return [
|
||||
$loggedRequest->getRequest()->getMethod(),
|
||||
$loggedRequest->getRequest()->getUri(),
|
||||
'<href=foo;fg='.$this->getRequestColor($loggedRequest).';options=bold>'.
|
||||
'<href='.$dashboardUrl.'/#'.$loggedRequest->id().';fg='.$this->getRequestColor($loggedRequest).';options=bold>'.
|
||||
optional($loggedRequest->getResponse())->getStatusCode().' '.optional($loggedRequest->getResponse())->getReasonPhrase()
|
||||
.'</>'
|
||||
,
|
||||
|
||||
Reference in New Issue
Block a user