Dashboard UI updates, allow multiple expose servers, exclude subdomains

This commit is contained in:
Marcel Pociot
2021-05-19 20:21:19 +02:00
parent c1f7125f72
commit db57f83bdf
8 changed files with 150 additions and 99 deletions

View File

@@ -4,31 +4,17 @@ namespace App\Commands;
use App\Client\Factory;
use App\Logger\CliRequestLogger;
use LaravelZero\Framework\Commands\Command;
use React\EventLoop\LoopInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
class ShareCommand extends Command
class ShareCommand extends ServerAwareCommand
{
protected $signature = 'share {host} {--subdomain=} {--auth=} {--server-host=} {--server-port=} {--dns=}';
protected $signature = 'share {host} {--subdomain=} {--auth=} {--dns=}';
protected $description = 'Share a local url with a remote expose server';
protected function configureConnectionLogger()
{
app()->bind(CliRequestLogger::class, function () {
return new CliRequestLogger(new ConsoleOutput());
});
return $this;
}
public function handle()
{
$this->configureConnectionLogger();
$serverHost = $this->option('server-host') ?? config('expose.host', 'localhost');
$serverPort = $this->option('server-port') ?? config('expose.port', 8080);
$auth = $this->option('auth') ?? config('expose.auth_token', '');
if (strstr($this->argument('host'), 'host.docker.internal')) {
@@ -41,8 +27,8 @@ class ShareCommand extends Command
(new Factory())
->setLoop(app(LoopInterface::class))
->setHost($serverHost)
->setPort($serverPort)
->setHost($this->getServerHost())
->setPort($this->getServerPort())
->setAuth($auth)
->createClient()
->share($this->argument('host'), explode(',', $this->option('subdomain')))