mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-15 06:25:56 +00:00
wip
This commit is contained in:
@@ -14,8 +14,15 @@ class ServeCommand extends Command
|
||||
|
||||
public function handle()
|
||||
{
|
||||
/** @var LoopInterface $loop */
|
||||
$loop = app(LoopInterface::class);
|
||||
|
||||
$loop->futureTick(function () {
|
||||
$this->info("Expose server running.");
|
||||
});
|
||||
|
||||
(new Factory())
|
||||
->setLoop(app(LoopInterface::class))
|
||||
->setLoop($loop)
|
||||
->setHost($this->argument('host'))
|
||||
->setHostname($this->argument('hostname'))
|
||||
->validateAuthTokens($this->option('validateAuthTokens'))
|
||||
|
||||
@@ -11,7 +11,7 @@ use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
class ShareCommand extends Command
|
||||
{
|
||||
protected $signature = 'share {host} {--subdomain=} {--auth=} {--token=}';
|
||||
protected $signature = 'share {host} {--subdomain=} {--auth=}';
|
||||
|
||||
protected $description = 'Share a local url with a remote shaft server';
|
||||
|
||||
@@ -33,7 +33,6 @@ class ShareCommand extends Command
|
||||
// ->setHost('beyond.sh') // TODO: Read from (local/global) config file
|
||||
// ->setPort(8080) // TODO: Read from (local/global) config file
|
||||
->setAuth($this->option('auth'))
|
||||
->setAuthToken($this->option('token'))
|
||||
->createClient($this->argument('host'), explode(',', $this->option('subdomain')))
|
||||
->createHttpServer()
|
||||
->run();
|
||||
|
||||
40
app/Commands/StoreAuthenticationTokenCommand.php
Normal file
40
app/Commands/StoreAuthenticationTokenCommand.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class StoreAuthenticationTokenCommand extends Command
|
||||
{
|
||||
protected $signature = 'token {token?}';
|
||||
|
||||
protected $description = 'Set or retrieve the authentication token to use with expose.';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$config = config('expose', []);
|
||||
|
||||
if (!is_null($this->argument('token'))) {
|
||||
$this->info('Setting the expose authentication token to "' . $this->argument('token') . '"');
|
||||
|
||||
$config['auth_token'] = $this->argument('token');
|
||||
|
||||
$configFile = implode(DIRECTORY_SEPARATOR, [
|
||||
$_SERVER['HOME'],
|
||||
'.expose',
|
||||
'config.php'
|
||||
]);
|
||||
|
||||
@mkdir(dirname($configFile), 0777, true);
|
||||
|
||||
file_put_contents($configFile, '<?php return ' . var_export($config, true) . ';');
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_null($token = config('expose.auth_token'))) {
|
||||
$this->info('There is no authentication token specified.');
|
||||
} else {
|
||||
$this->info('Current authentication token: ' . $token);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user