diff --git a/app/Console/Commands/InfoCommand.php b/app/Console/Commands/InfoCommand.php index 097de576a..24dceb5cf 100644 --- a/app/Console/Commands/InfoCommand.php +++ b/app/Console/Commands/InfoCommand.php @@ -3,7 +3,6 @@ namespace App\Console\Commands; use Illuminate\Console\Command; -use App\Services\Helpers\SoftwareVersionService; class InfoCommand extends Command { @@ -11,98 +10,8 @@ class InfoCommand extends Command protected $signature = 'p:info'; - /** - * InfoCommand constructor. - */ - public function __construct(private SoftwareVersionService $versionService) - { - parent::__construct(); - } - - /** - * Handle execution of command. - */ public function handle(): void { - $this->output->title('Version Information'); - $this->table([], [ - ['Panel Version', $this->versionService->currentPanelVersion()], - ['Latest Version', $this->versionService->latestPanelVersion()], - ['Up-to-Date', $this->versionService->isLatestPanel() ? 'Yes' : $this->formatText('No', 'bg=red')], - ], 'compact'); - - $this->output->title('Application Configuration'); - $this->table([], [ - ['Environment', config('app.env') === 'production' ? config('app.env') : $this->formatText(config('app.env'), 'bg=red')], - ['Debug Mode', config('app.debug') ? $this->formatText('Yes', 'bg=red') : 'No'], - ['Application Name', config('app.name')], - ['Application URL', config('app.url')], - ['Installation Directory', base_path()], - ['Cache Driver', config('cache.default')], - ['Queue Driver', config('queue.default') === 'sync' ? $this->formatText(config('queue.default'), 'bg=red') : config('queue.default')], - ['Session Driver', config('session.driver')], - ['Filesystem Driver', config('filesystems.default')], - ], 'compact'); - - $this->output->title('Database Configuration'); - $driver = config('database.default'); - if ($driver === 'sqlite') { - $this->table([], [ - ['Driver', $driver], - ['Database', config("database.connections.$driver.database")], - ], 'compact'); - } else { - $this->table([], [ - ['Driver', $driver], - ['Host', config("database.connections.$driver.host")], - ['Port', config("database.connections.$driver.port")], - ['Database', config("database.connections.$driver.database")], - ['Username', config("database.connections.$driver.username")], - ], 'compact'); - } - - $this->output->title('Email Configuration'); - $driver = config('mail.default'); - if ($driver === 'smtp') { - $this->table([], [ - ['Driver', $driver], - ['Host', config("mail.mailers.$driver.host")], - ['Port', config("mail.mailers.$driver.port")], - ['Username', config("mail.mailers.$driver.username")], - ['Encryption', config("mail.mailers.$driver.encryption")], - ['From Address', config('mail.from.address')], - ['From Name', config('mail.from.name')], - ], 'compact'); - } else { - $this->table([], [ - ['Driver', $driver], - ['From Address', config('mail.from.address')], - ['From Name', config('mail.from.name')], - ], 'compact'); - } - - $this->output->title('Backup Configuration'); - $driver = config('backups.default'); - if ($driver === 's3') { - $this->table([], [ - ['Driver', $driver], - ['Region', config("backups.disks.$driver.region")], - ['Bucket', config("backups.disks.$driver.bucket")], - ['Endpoint', config("backups.disks.$driver.endpoint")], - ['Use path style endpoint', config("backups.disks.$driver.use_path_style_endpoint") ? 'Yes' : 'No'], - ], 'compact'); - } else { - $this->table([], [ - ['Driver', $driver], - ], 'compact'); - } - } - - /** - * Format output in a Name: Value manner. - */ - private function formatText(string $value, string $opts = ''): string - { - return sprintf('<%s>%s', $opts, $value); + $this->call('about'); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index aa44d986c..6fdd39a08 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,6 +7,7 @@ use App\Models; use App\Models\ApiKey; use App\Models\Node; use App\Models\User; +use App\Services\Helpers\SoftwareVersionService; use Dedoc\Scramble\Scramble; use Dedoc\Scramble\Support\Generator\OpenApi; use Dedoc\Scramble\Support\Generator\SecurityScheme; @@ -16,6 +17,7 @@ use Filament\Support\Facades\FilamentView; use Filament\View\PanelsRenderHook; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Foundation\Application; +use Illuminate\Foundation\Console\AboutCommand; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Http; @@ -30,7 +32,7 @@ class AppServiceProvider extends ServiceProvider /** * Bootstrap any application services. */ - public function boot(Application $app): void + public function boot(Application $app, SoftwareVersionService $versionService): void { // If the APP_URL value is set with https:// make sure we force it here. Theoretically // this should just work with the proxy logic, but there are a lot of cases where it @@ -104,6 +106,16 @@ class AppServiceProvider extends ServiceProvider Gate::before(function (User $user, $ability) { return $user->isRootAdmin() ? true : null; }); + + AboutCommand::add('Pelican', [ + 'Panel Version' => $versionService->currentPanelVersion(), + 'Latest Version' => $versionService->latestPanelVersion(), + 'Up-to-Date' => $versionService->isLatestPanel() ? 'Yes' : 'No', + ]); + + AboutCommand::add('Drivers', 'Backups', config('backups.default')); + + AboutCommand::add('Environment', 'Installation Directory', base_path()); } /**