This commit is contained in:
Marcel Pociot
2021-06-21 16:33:57 +02:00
parent 0b07c3b2a3
commit 4163975022
17 changed files with 216 additions and 37 deletions

View File

@@ -203,6 +203,10 @@ class Client
$this->logger->info($data->message);
});
$connection->on('warning', function ($data) {
$this->logger->warn($data->message);
});
$connection->on('error', function ($data) {
$this->logger->error($data->message);
});

View File

@@ -2,6 +2,7 @@
namespace App\Commands;
use Illuminate\Support\Str;
use App\Client\Factory;
use React\EventLoop\LoopInterface;
@@ -33,6 +34,16 @@ class ShareCommand extends ServerAwareCommand
$domain = $this->option('domain');
}
if (! is_null($this->option('subdomain'))) {
$subdomains = explode(',', $this->option('subdomain'));
$this->info('Trying to use custom domain: '.$subdomains[0]);
} else {
$host = Str::beforeLast($this->argument('host'), '.');
$host = Str::beforeLast($host, ':');
$subdomains = [Str::slug($host)];
$this->info('Trying to use custom domain: '.$subdomains[0].PHP_EOL);
}
(new Factory())
->setLoop(app(LoopInterface::class))
->setHost($this->getServerHost())
@@ -41,7 +52,7 @@ class ShareCommand extends ServerAwareCommand
->createClient()
->share(
$this->argument('host'),
explode(',', $this->option('subdomain')),
$subdomains,
$domain
)
->createHttpServer()

View File

@@ -312,7 +312,7 @@ class ControlMessageController implements MessageComponentInterface
*/
if (! is_null($user) && $user['can_specify_subdomains'] === 0 && ! is_null($subdomain)) {
$connection->send(json_encode([
'event' => 'info',
'event' => 'error',
'data' => [
'message' => config('expose.admin.messages.custom_subdomain_unauthorized').PHP_EOL,
],