This commit is contained in:
Bozhidar 2024-04-28 13:53:22 +03:00
parent 5ae25b5380
commit d5623b854f
5 changed files with 25 additions and 11 deletions

View file

@ -3,6 +3,7 @@
namespace Modules\Terminal\Filament\Pages;
use Filament\Pages\Page;
use Illuminate\Support\Str;
class Terminal extends Page
{
@ -20,8 +21,17 @@ class Terminal extends Page
{
$sessionId = session()->getId();
shell_exec('node /usr/local/phyre/web/nodejs/terminal/server.js >> /usr/local/phyre/web/storage/logs/terminal/server-terminal.log &');
$runNewTerminal = true;
$checkPort = shell_exec('netstat -tuln | grep 8449');
if (!empty($checkPort)) {
if (Str::contains($checkPort, 'LISTEN')) {
$runNewTerminal = false;
}
}
if ($runNewTerminal) {
$exec = shell_exec('node /usr/local/phyre/web/Modules/Terminal/nodejs/terminal/server.js >> /usr/local/phyre/web/storage/logs/terminal/server-terminal.log &');
}
return [
'title' => 'Terminal',
'sessionId' => $sessionId,

View file

@ -1,3 +1,5 @@
apt-get install npm nodejs -y
sudo apt-get install npm nodejs -y
cd /usr/local/phyre/web/Modules/Terminal/nodejs/terminal
npm i
echo "Done!"

View file

@ -102,16 +102,16 @@ class AdminPanelProvider extends PanelProvider
$findModules = Module::where('installed', 1)->get();
if ($findModules->count() > 0) {
foreach ($findModules as $module) {
$modulePath = module_path($module->name, 'Filament/Clusters');
if (is_dir($modulePath)) {
$panel->discoverClusters(in: $modulePath, for: 'Modules\\' . $module->name . '\\Filament\\Clusters');
$modulePathClusters = module_path($module->name, 'Filament/Clusters');
if (is_dir($modulePathClusters)) {
$panel->discoverClusters(in: $modulePathClusters, for: 'Modules\\' . $module->name . '\\Filament\\Clusters');
}
$modulePathPages = module_path($module->name, 'Filament/Pages');
if (is_dir($modulePathPages)) {
$panel->discoverPages(in: $modulePathPages, for: 'Modules\\' . $module->name . '\\Filament\\Pages');
}
}
}
// ->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: 'Modules\\Microweber\\Filament\\Clusters')
// ->discoverClusters(in: module_path('LetsEncrypt', 'Filament/Clusters'), for: 'Modules\\LetsEncrypt\\Filament\\Clusters')
// ->discoverClusters(in: module_path('Docker', 'Filament/Clusters'), for: 'Modules\\Docker\\Filament\\Clusters')
}
}

View file

@ -170,7 +170,9 @@ return [
App\Providers\Filament\AdminPanelProvider::class,
App\Providers\RouteServiceProvider::class,
\Modules\Customer\App\Providers\CustomerServiceProvider::class
\Modules\Customer\App\Providers\CustomerServiceProvider::class,
\Modules\Docker\App\Providers\DockerServiceProvider::class,
\Modules\Terminal\App\Providers\TerminalServiceProvider::class,
])->toArray(),