update
This commit is contained in:
parent
000a0db564
commit
67cd7ec58b
103 changed files with 383 additions and 517 deletions
|
@ -5,7 +5,6 @@ namespace Modules\LetsEncrypt\App\Http\Controllers;
|
|||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LetsEncryptController extends Controller
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ class LetsEncryptServiceProvider extends ServiceProvider
|
|||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||
|
||||
// Event::listen(HostingAccountIsCreated::class,HostingAccountIsCreatedListener::class);
|
||||
// Event::listen(HostingAccountIsCreated::class,HostingAccountIsCreatedListener::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,6 @@ class LetsEncryptServiceProvider extends ServiceProvider
|
|||
$this->app->register(RouteServiceProvider::class);
|
||||
$this->app->register(AdminPanelProvider::class);
|
||||
|
||||
|
||||
app()->virtualHostManager->registerConfig(LetsEncryptApacheVirtualHostConfig::class, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Modules\LetsEncrypt\App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ use App\VirtualHosts\ApacheVirtualHostConfigBase;
|
|||
class LetsEncryptApacheVirtualHostConfig extends ApacheVirtualHostConfigBase
|
||||
{
|
||||
public array $phpAdminValueOpenBaseDirs = [
|
||||
'/usr/share/letsencrypt'
|
||||
'/usr/share/letsencrypt',
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ use App\Actions\ApacheWebsiteApplySSLVirtualHost;
|
|||
use App\ApiClient;
|
||||
use App\Events\HostingAccountIsCreated;
|
||||
use App\FileManagerApi;
|
||||
use App\Models\HostingPlan;
|
||||
use App\Models\DomainSslCertificate;
|
||||
use App\Models\HostingPlan;
|
||||
use App\Settings;
|
||||
use App\ShellApi;
|
||||
|
||||
|
@ -27,16 +27,16 @@ class HostingAccountIsCreatedListener
|
|||
public function handle(HostingAccountIsCreated $event): void
|
||||
{
|
||||
$findWebsite = \App\Models\Domain::where('id', $event->model->id)->first();
|
||||
if (!$findWebsite) {
|
||||
if (! $findWebsite) {
|
||||
return;
|
||||
}
|
||||
|
||||
$findHostingPlan = HostingPlan::where('id', $findWebsite->hosting_plan_id)->first();
|
||||
if (!$findHostingPlan) {
|
||||
if (! $findHostingPlan) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array('letsencrypt', $findHostingPlan->additional_services)) {
|
||||
if (! in_array('letsencrypt', $findHostingPlan->additional_services)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ class HostingAccountIsCreatedListener
|
|||
])->render();
|
||||
|
||||
$fmApi = new FileManagerApi();
|
||||
$fmApi->filePutContents($event->model->domain_root . '/acme-config.yaml', $acmeConfigYaml);
|
||||
$fmApi->filePutContents($event->model->domain_root.'/acme-config.yaml', $acmeConfigYaml);
|
||||
|
||||
$amePHPPharFile = base_path() . '/Modules/LetsEncrypt/Actions/acmephp.phar';
|
||||
$amePHPPharFile = base_path().'/Modules/LetsEncrypt/Actions/acmephp.phar';
|
||||
|
||||
$phyrePHP = ApiClient::getPhyrePHP();
|
||||
|
||||
$command = $phyrePHP . ' ' . $amePHPPharFile . ' run ' . $event->model->domain_root . '/acme-config.yaml';
|
||||
$command = $phyrePHP.' '.$amePHPPharFile.' run '.$event->model->domain_root.'/acme-config.yaml';
|
||||
ShellApi::exec($command);
|
||||
|
||||
$validateCertificates = [];
|
||||
|
@ -71,13 +71,13 @@ class HostingAccountIsCreatedListener
|
|||
$sslCertificateKeyFileContent = $fmApi->fileGetContents($sslCertificateKeyFilePath);
|
||||
$sslCertificateChainFileContent = $fmApi->fileGetContents($sslCertificateChainFilePath);
|
||||
|
||||
if (!empty($sslCertificateChainFileContent)) {
|
||||
if (! empty($sslCertificateChainFileContent)) {
|
||||
$validateCertificates['certificate'] = $sslCertificateFileContent;
|
||||
}
|
||||
if (!empty($sslCertificateKeyFileContent)) {
|
||||
if (! empty($sslCertificateKeyFileContent)) {
|
||||
$validateCertificates['private_key'] = $sslCertificateKeyFileContent;
|
||||
}
|
||||
if (!empty($sslCertificateChainFileContent)) {
|
||||
if (! empty($sslCertificateChainFileContent)) {
|
||||
$validateCertificates['certificate_chain'] = $sslCertificateChainFileContent;
|
||||
}
|
||||
if (count($validateCertificates) !== 3) {
|
||||
|
@ -106,6 +106,5 @@ class HostingAccountIsCreatedListener
|
|||
$applySSLVirtualHost->setSslCertificateChainFilePath($sslCertificateChainFilePath);
|
||||
$applySSLVirtualHost->handle();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,12 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
|
|||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
private string $module = "LetsEncrypt";
|
||||
private string $module = 'LetsEncrypt';
|
||||
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
$moduleNamespace = $this->getModuleNamespace();
|
||||
|
||||
return $panel
|
||||
->id('Lets Encrypt ::admin')
|
||||
->path('admin/modules/letsencrypt')
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Modules\Microweber\App\Http\Controllers;
|
|||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class MicroweberController extends Controller
|
||||
{
|
||||
|
|
|
@ -3,18 +3,15 @@
|
|||
namespace Modules\Microweber\App\Models;
|
||||
|
||||
use App\Models\Domain;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Microweber\Database\factories\MicroweberInstallationFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MicroweberInstallation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
public function domain()
|
||||
{
|
||||
return $this->hasOne(Domain::class, 'id', 'domain_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
namespace Modules\Microweber\App\Providers;
|
||||
|
||||
use App\Events\DomainIsCreated;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Events\DomainIsCreated;
|
||||
use Modules\Microweber\Listeners\DomainIsCreatedListener;
|
||||
use App\VirtualHosts\ApacheVirtualHostManager;
|
||||
use Modules\Microweber\MicroweberApacheVirtualHostConfig;
|
||||
|
||||
class MicroweberServiceProvider extends ServiceProvider
|
||||
|
@ -28,7 +27,7 @@ class MicroweberServiceProvider extends ServiceProvider
|
|||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||
|
||||
Event::listen(DomainIsCreated::class,DomainIsCreatedListener::class);
|
||||
Event::listen(DomainIsCreated::class, DomainIsCreatedListener::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Modules\Microweber\App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Pages;
|
||||
|
||||
use Filament\Forms\Components\Card;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Tabs;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
||||
|
@ -21,7 +18,6 @@ class Settings extends BaseSettings
|
|||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
|
||||
public function schema(): array
|
||||
{
|
||||
return [
|
||||
|
@ -71,7 +67,6 @@ class Settings extends BaseSettings
|
|||
])
|
||||
->label('Allow customers to choose installation type'),
|
||||
|
||||
|
||||
Select::make('microweber.allow_customers_to_choose_installation_database_driver')
|
||||
->options([
|
||||
'yes' => 'Yes',
|
||||
|
@ -133,6 +128,6 @@ class Settings extends BaseSettings
|
|||
->label('Allow resellers to use their own White Label'),
|
||||
|
||||
]),
|
||||
];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,12 +24,14 @@ class Version extends Page
|
|||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public $currentVersionOfApp = 0;
|
||||
|
||||
public $latestVersionOfApp = 0;
|
||||
|
||||
public $latestDownloadDateOfApp = 0;
|
||||
|
||||
public $supportedTemplates = [];
|
||||
public $supportedLanguages = [];
|
||||
|
||||
public $supportedLanguages = [];
|
||||
|
||||
protected function getViewData(): array
|
||||
{
|
||||
|
@ -51,7 +53,7 @@ class Version extends Page
|
|||
'totalAppTemplates' => count($this->supportedTemplates),
|
||||
'appTemplates' => $this->supportedTemplates,
|
||||
'supportedLanguages' => $this->supportedLanguages,
|
||||
'supportedTemplates' => $this->supportedTemplates
|
||||
'supportedTemplates' => $this->supportedTemplates,
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -60,12 +62,12 @@ class Version extends Page
|
|||
{
|
||||
$sharedAppPath = config('microweber.sharedPaths.app');
|
||||
|
||||
if (!is_dir(dirname($sharedAppPath))) {
|
||||
if (! is_dir(dirname($sharedAppPath))) {
|
||||
mkdir(dirname($sharedAppPath));
|
||||
}
|
||||
|
||||
$shellPath = '/usr/local/phyre/web/vendor/microweber-packages/shared-server-scripts/shell-scripts';
|
||||
ShellApi::exec('chmod +x ' . $shellPath . '/*');
|
||||
ShellApi::exec('chmod +x '.$shellPath.'/*');
|
||||
|
||||
// Download core app
|
||||
$status = $this->__getMicroweberDownloaderInstance()
|
||||
|
@ -88,7 +90,7 @@ class Version extends Page
|
|||
// The module connector must have own instance of composer client
|
||||
$composerClient = new Client();
|
||||
$composerClient->packageServers = [
|
||||
'https://market.microweberapi.com/packages/microweberserverpackages/packages.json'
|
||||
'https://market.microweberapi.com/packages/microweberserverpackages/packages.json',
|
||||
];
|
||||
|
||||
return $composerClient;
|
||||
|
@ -97,11 +99,11 @@ class Version extends Page
|
|||
private function __getComposerLicensedInstance()
|
||||
{
|
||||
$composerClientLicensed = new Client();
|
||||
// if (Option::getOption('license_key_status', 'whitelabel_license') == 'valid') {
|
||||
// $composerClientLicensed->addLicense([
|
||||
// 'local_key' => Option::getOption('license_key', 'whitelabel_license')
|
||||
// ]);
|
||||
// }
|
||||
// if (Option::getOption('license_key_status', 'whitelabel_license') == 'valid') {
|
||||
// $composerClientLicensed->addLicense([
|
||||
// 'local_key' => Option::getOption('license_key', 'whitelabel_license')
|
||||
// ]);
|
||||
// }
|
||||
|
||||
return $composerClientLicensed;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ use Filament\Forms\Components\Checkbox;
|
|||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Pages\Page;
|
||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
||||
|
||||
|
@ -22,13 +21,12 @@ class Whitelabel extends BaseSettings
|
|||
|
||||
protected static ?string $navigationLabel = 'Whitelabel';
|
||||
|
||||
|
||||
public static function getNavigationLabel() : string
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return self::$navigationLabel;
|
||||
}
|
||||
|
||||
public function getTitle() : string
|
||||
public function getTitle(): string
|
||||
{
|
||||
return self::$navigationLabel;
|
||||
}
|
||||
|
@ -84,12 +82,10 @@ class Whitelabel extends BaseSettings
|
|||
Checkbox::make('microweber.whitelabel.enable_microweber_service_links')
|
||||
->label('Enable Microweber Service Links'),
|
||||
|
||||
|
||||
Textarea::make('microweber.whitelabel.admin_colors_sass')
|
||||
->label('Enter "Admin colors" sass'),
|
||||
|
||||
|
||||
])
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources;
|
||||
|
||||
use Modules\Microweber\App\Models\MicroweberInstallation;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Modules\Microweber\App\Models\MicroweberInstallation;
|
||||
use Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages\ListInstallations;
|
||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||
|
||||
|
@ -27,7 +24,6 @@ class InstallationResource extends Resource
|
|||
|
||||
protected static ?int $navigationSort = 0;
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
@ -44,9 +40,9 @@ class InstallationResource extends Resource
|
|||
Tables\Columns\TextColumn::make('website.domain')->label('Domain'),
|
||||
Tables\Columns\TextColumn::make('app_version')->label('Version'),
|
||||
Tables\Columns\TextColumn::make('installation_type')->label('Type'),
|
||||
// Tables\Columns\TextColumn::make('installation_path')->label('Path'),
|
||||
// Tables\Columns\TextColumn::make('installation_path')->label('Path'),
|
||||
Tables\Columns\TextColumn::make('template')->label('Template'),
|
||||
// Tables\Columns\TextColumn::make('admin_email')->label('Admin Email'),
|
||||
// Tables\Columns\TextColumn::make('admin_email')->label('Admin Email'),
|
||||
|
||||
])
|
||||
->filters([
|
||||
|
@ -73,8 +69,8 @@ class InstallationResource extends Resource
|
|||
{
|
||||
return [
|
||||
'index' => ListInstallations::route('/'),
|
||||
// 'create' => Pages\CreateInstallation::route('/create'),
|
||||
// 'edit' => Pages\EditInstallation::route('/{record}/edit'),
|
||||
// 'create' => Pages\CreateInstallation::route('/create'),
|
||||
// 'edit' => Pages\EditInstallation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages;
|
||||
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages;
|
||||
|
||||
use Modules\Microweber\Filament\Admin\Resources\InstallationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Modules\Microweber\Filament\Admin\Resources\InstallationResource;
|
||||
|
||||
class EditInstallation extends EditRecord
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ class ListInstallations extends ListRecords
|
|||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
Actions\Action::make('Scan for installations')->action('scanForInstallations')
|
||||
Actions\Action::make('Scan for installations')->action('scanForInstallations'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -31,14 +31,14 @@ class ListInstallations extends ListRecords
|
|||
|
||||
$installations = $scan->scanRecusrive();
|
||||
|
||||
if (!empty($installations)) {
|
||||
if (! empty($installations)) {
|
||||
foreach ($installations as $installation) {
|
||||
|
||||
$findInstallation = MicroweberInstallation::where('installation_path', $installation['path'])
|
||||
->where('domain_id', $domain->id)
|
||||
->first();
|
||||
|
||||
if (!$findInstallation) {
|
||||
if (! $findInstallation) {
|
||||
$findInstallation = new MicroweberInstallation();
|
||||
$findInstallation->domain_id = $domain->id;
|
||||
$findInstallation->installation_path = $installation['path'];
|
||||
|
@ -62,7 +62,7 @@ class ListInstallations extends ListRecords
|
|||
$getAppInstallations = MicroweberInstallation::get();
|
||||
if ($getAppInstallations != null) {
|
||||
foreach ($getAppInstallations as $appInstallation) {
|
||||
if (!is_file($appInstallation['installation_path'] . '/config/microweber.php')) {
|
||||
if (! is_file($appInstallation['installation_path'].'/config/microweber.php')) {
|
||||
$appInstallation->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,5 +9,4 @@ class MicroweberCluster extends Cluster
|
|||
protected static ?string $navigationIcon = 'heroicon-o-squares-2x2';
|
||||
|
||||
protected static ?string $navigationGroup = 'Server Management';
|
||||
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ use App\Events\DomainIsCreated;
|
|||
use App\Models\Domain;
|
||||
use App\Models\HostingPlan;
|
||||
use App\Models\HostingSubscription;
|
||||
use App\ShellApi;
|
||||
use Modules\Microweber\App\Models\MicroweberInstallation;
|
||||
use Psy\Shell;
|
||||
|
||||
class DomainIsCreatedListener
|
||||
{
|
||||
|
@ -26,20 +24,20 @@ class DomainIsCreatedListener
|
|||
public function handle(DomainIsCreated $event): void
|
||||
{
|
||||
$findDomain = Domain::where('id', $event->model->id)->first();
|
||||
if (!$findDomain) {
|
||||
if (! $findDomain) {
|
||||
return;
|
||||
}
|
||||
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
||||
if (!$findHostingSubscription) {
|
||||
if (! $findHostingSubscription) {
|
||||
return;
|
||||
}
|
||||
|
||||
$findHostingPlan = HostingPlan::where('id', $findHostingSubscription->hosting_plan_id)->first();
|
||||
if (!$findHostingPlan) {
|
||||
if (! $findHostingPlan) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array('microweber', $findHostingPlan->additional_services)) {
|
||||
if (! in_array('microweber', $findHostingPlan->additional_services)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +58,7 @@ class DomainIsCreatedListener
|
|||
$install->setLanguage($installationLanguage);
|
||||
$install->setTemplate($installationTemplate);
|
||||
|
||||
// $install->setStandaloneInstallation();
|
||||
// $install->setStandaloneInstallation();
|
||||
$install->setSymlinkInstallation();
|
||||
$install->setDatabaseDriver('sqlite');
|
||||
|
||||
|
@ -68,33 +66,32 @@ class DomainIsCreatedListener
|
|||
$install->setAdminUsername('bojotjo');
|
||||
$install->setAdminPassword('bojotjo');
|
||||
|
||||
$status = $install->run();
|
||||
$status = $install->run();
|
||||
|
||||
if (isset($status['success']) && $status['success']) {
|
||||
if (isset($status['success']) && $status['success']) {
|
||||
|
||||
$findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public)
|
||||
->where('domain_id', $findDomain->id)
|
||||
->first();
|
||||
$findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public)
|
||||
->where('domain_id', $findDomain->id)
|
||||
->first();
|
||||
|
||||
if (!$findInstallation) {
|
||||
$findInstallation = new MicroweberInstallation();
|
||||
$findInstallation->domain_id = $findDomain->id;
|
||||
$findInstallation->installation_path = $findDomain->domain_public;
|
||||
}
|
||||
if (! $findInstallation) {
|
||||
$findInstallation = new MicroweberInstallation();
|
||||
$findInstallation->domain_id = $findDomain->id;
|
||||
$findInstallation->installation_path = $findDomain->domain_public;
|
||||
}
|
||||
|
||||
$findInstallation->app_version = 'latest';
|
||||
$findInstallation->template = $installationTemplate;
|
||||
$findInstallation->app_version = 'latest';
|
||||
$findInstallation->template = $installationTemplate;
|
||||
|
||||
if ($installationType == 'symlink') {
|
||||
$findInstallation->installation_type = 'symlink';
|
||||
} else {
|
||||
$findInstallation->installation_type = 'standalone';
|
||||
}
|
||||
if ($installationType == 'symlink') {
|
||||
$findInstallation->installation_type = 'symlink';
|
||||
} else {
|
||||
$findInstallation->installation_type = 'standalone';
|
||||
}
|
||||
|
||||
$findInstallation->save();
|
||||
|
||||
}
|
||||
$findInstallation->save();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ use App\VirtualHosts\ApacheVirtualHostConfigBase;
|
|||
class MicroweberApacheVirtualHostConfig extends ApacheVirtualHostConfigBase
|
||||
{
|
||||
public array $phpAdminValueOpenBaseDirs = [
|
||||
'/usr/share/microweber'
|
||||
'/usr/share/microweber',
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -20,10 +20,12 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
|
|||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
private string $module = "Microweber";
|
||||
private string $module = 'Microweber';
|
||||
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
$moduleNamespace = $this->getModuleNamespace();
|
||||
|
||||
return $panel
|
||||
->id('microweber::admin')
|
||||
->path('microweber/admin')
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Microweber\Shell\Adapters;
|
||||
|
||||
use App\ShellApi;
|
||||
use MicroweberPackages\SharedServerScripts\Shell\Adapters\IShellExecutor;
|
||||
use MicroweberPackages\SharedServerScripts\Shell\Adapters\pm_ApiCli;
|
||||
|
||||
class PhyreShellExecutor implements IShellExecutor
|
||||
{
|
||||
/**
|
||||
* @param string $file
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function executeFile(string $file, array $args)
|
||||
|
@ -23,12 +21,12 @@ class PhyreShellExecutor implements IShellExecutor
|
|||
{
|
||||
$commandAsLine = implode(' ', $command);
|
||||
|
||||
// dd([
|
||||
// 'command' => $command,
|
||||
// 'path' => $path,
|
||||
// 'args' => $args,
|
||||
// 'commandAsLine' => $commandAsLine
|
||||
// ]);
|
||||
// dd([
|
||||
// 'command' => $command,
|
||||
// 'path' => $path,
|
||||
// 'args' => $args,
|
||||
// 'commandAsLine' => $commandAsLine
|
||||
// ]);
|
||||
return ShellApi::exec($commandAsLine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
return [
|
||||
'name' => 'Microweber',
|
||||
'sharedPaths'=>[
|
||||
'app'=>'/usr/share/microweber/latest',
|
||||
'modules'=>'/usr/share/microweber/latest/userfiles/modules',
|
||||
'templates'=>'/usr/share/microweber/latest/userfiles/templates'
|
||||
'sharedPaths' => [
|
||||
'app' => '/usr/share/microweber/latest',
|
||||
'modules' => '/usr/share/microweber/latest/userfiles/modules',
|
||||
'templates' => '/usr/share/microweber/latest/userfiles/templates',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -8,12 +8,15 @@ use App\ShellApi;
|
|||
class ApacheWebsiteApplySSLVirtualHost
|
||||
{
|
||||
public $domain;
|
||||
|
||||
public $domainRoot;
|
||||
|
||||
public $domainPublic;
|
||||
|
||||
public $sslCertificateFilePath;
|
||||
|
||||
public $sslCertificateKeyFilePath;
|
||||
|
||||
public $sslCertificateChainFilePath;
|
||||
|
||||
public function setSslCertificateFilePath($sslCertificateFilePath)
|
||||
|
@ -49,7 +52,7 @@ class ApacheWebsiteApplySSLVirtualHost
|
|||
public function handle()
|
||||
{
|
||||
$settings = [
|
||||
'port'=> 443,
|
||||
'port' => 443,
|
||||
'domain' => $this->domain,
|
||||
'domainRoot' => $this->domainRoot,
|
||||
'domainPublic' => $this->domainPublic,
|
||||
|
@ -58,16 +61,16 @@ class ApacheWebsiteApplySSLVirtualHost
|
|||
'sslCertificateKeyFilePath' => $this->sslCertificateKeyFilePath,
|
||||
'sslCertificateChainFilePath' => $this->sslCertificateChainFilePath,
|
||||
];
|
||||
$apache2SSLSample = view('actions.samples.ubuntu.apache2-ssl-conf',$settings)->render();
|
||||
$apache2SSLSample = view('actions.samples.ubuntu.apache2-ssl-conf', $settings)->render();
|
||||
|
||||
$fileManagerApi = new FileManagerApi();
|
||||
|
||||
$apache2SSLOptionsSample = view('actions.samples.ubuntu.apache2-ssl-options-conf')->render();
|
||||
$apache2SSLOptionsFilePath = '/etc/apache2/phyre/options-ssl-apache.conf';
|
||||
if (!$fileManagerApi->isDir('/etc/apache2/phyre')) {
|
||||
if (! $fileManagerApi->isDir('/etc/apache2/phyre')) {
|
||||
$fileManagerApi->mkdir('/etc/apache2/phyre');
|
||||
}
|
||||
if (!$fileManagerApi->fileExists($apache2SSLOptionsFilePath)) {
|
||||
if (! $fileManagerApi->fileExists($apache2SSLOptionsFilePath)) {
|
||||
$fileManagerApi->filePutContents($apache2SSLOptionsFilePath, $apache2SSLOptionsSample);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,18 +2,20 @@
|
|||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\FileManagerApi;
|
||||
use App\ShellApi;
|
||||
use App\VirtualHosts\ApacheVirtualHostManager;
|
||||
|
||||
class ApacheWebsiteCreate
|
||||
{
|
||||
public $domain;
|
||||
|
||||
public $user;
|
||||
|
||||
public $email;
|
||||
|
||||
public $password;
|
||||
|
||||
public $isMainDomain = false;
|
||||
|
||||
public $additionalServices = [];
|
||||
|
||||
public $features = [];
|
||||
|
||||
public function setDomain($domain)
|
||||
|
@ -62,15 +64,15 @@ class ApacheWebsiteCreate
|
|||
}
|
||||
|
||||
if ($this->isMainDomain) {
|
||||
$allDomainsRoot = '/home/' . $this->user . '/public_html';
|
||||
$domainRoot = '/home/' . $this->user;
|
||||
$domainPublic = '/home/' . $this->user . '/public_html';
|
||||
$homeRoot = '/home/' . $this->user;
|
||||
$allDomainsRoot = '/home/'.$this->user.'/public_html';
|
||||
$domainRoot = '/home/'.$this->user;
|
||||
$domainPublic = '/home/'.$this->user.'/public_html';
|
||||
$homeRoot = '/home/'.$this->user;
|
||||
} else {
|
||||
$allDomainsRoot = '/home/' . $this->user . '/domains';
|
||||
$domainRoot = '/home/' . $this->user . '/domains/' . $this->domain;
|
||||
$domainPublic = $domainRoot . '/public_html';
|
||||
$homeRoot = '/home/' . $this->user;
|
||||
$allDomainsRoot = '/home/'.$this->user.'/domains';
|
||||
$domainRoot = '/home/'.$this->user.'/domains/'.$this->domain;
|
||||
$domainPublic = $domainRoot.'/public_html';
|
||||
$homeRoot = '/home/'.$this->user;
|
||||
}
|
||||
|
||||
$apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);
|
||||
|
@ -89,23 +91,22 @@ class ApacheWebsiteCreate
|
|||
$settings = array_merge($settings, $apacheVirtualHostConfigs);
|
||||
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
||||
|
||||
if (!is_dir($homeRoot)) {
|
||||
if (! is_dir($homeRoot)) {
|
||||
mkdir($homeRoot);
|
||||
}
|
||||
if (!is_dir($allDomainsRoot)) {
|
||||
if (! is_dir($allDomainsRoot)) {
|
||||
mkdir($allDomainsRoot);
|
||||
}
|
||||
if (!is_dir($domainRoot)) {
|
||||
if (! is_dir($domainRoot)) {
|
||||
mkdir($domainRoot);
|
||||
}
|
||||
if (!is_dir($domainPublic)) {
|
||||
if (! is_dir($domainPublic)) {
|
||||
mkdir($domainPublic);
|
||||
}
|
||||
|
||||
shell_exec('chmod -R 775 /etc/apache2/sites-available/');
|
||||
|
||||
file_put_contents('/etc/apache2/sites-available/' . $settings['domain'] . '.conf', $apache2Sample);
|
||||
|
||||
file_put_contents('/etc/apache2/sites-available/'.$settings['domain'].'.conf', $apache2Sample);
|
||||
|
||||
$indexContent = '
|
||||
|
||||
|
@ -115,22 +116,21 @@ class ApacheWebsiteCreate
|
|||
|
||||
';
|
||||
|
||||
file_put_contents($settings['domainPublic'].'/index.php', $indexContent);
|
||||
|
||||
file_put_contents($settings['domainPublic'] . '/index.php', $indexContent);
|
||||
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$allDomainsRoot);
|
||||
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$homeRoot);
|
||||
|
||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $allDomainsRoot);
|
||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $homeRoot);
|
||||
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$settings['domainRoot']);
|
||||
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$settings['domainPublic']);
|
||||
|
||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $settings['domainRoot']);
|
||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $settings['domainPublic']);
|
||||
shell_exec('chmod -R 775 '.$allDomainsRoot);
|
||||
shell_exec('chmod -R 775 '.$homeRoot);
|
||||
|
||||
shell_exec('chmod -R 775 ' . $allDomainsRoot);
|
||||
shell_exec('chmod -R 775 ' . $homeRoot);
|
||||
shell_exec('chmod -R 775 '.$settings['domainRoot']);
|
||||
shell_exec('chmod -R 775 '.$settings['domainPublic']);
|
||||
|
||||
shell_exec('chmod -R 775 ' . $settings['domainRoot']);
|
||||
shell_exec('chmod -R 775 ' . $settings['domainPublic']);
|
||||
|
||||
shell_exec('a2ensite ' . $settings['domain'] . '.conf');
|
||||
shell_exec('a2ensite '.$settings['domain'].'.conf');
|
||||
shell_exec('systemctl reload apache2');
|
||||
|
||||
return [
|
||||
|
@ -141,7 +141,7 @@ class ApacheWebsiteCreate
|
|||
'user' => $this->user,
|
||||
'email' => $this->email,
|
||||
'linuxUser' => $linuxUser,
|
||||
'apache2Sample' => $apache2Sample
|
||||
'apache2Sample' => $apache2Sample,
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -16,18 +16,17 @@ class ApacheWebsiteDelete
|
|||
public function handle()
|
||||
{
|
||||
$apacheConf = '/etc/apache2/sites-available/'.$this->domain.'.conf';
|
||||
ShellApi::exec('rm -rf ' . $apacheConf);
|
||||
ShellApi::exec('rm -rf '.$apacheConf);
|
||||
|
||||
$apacheConfEnabled = '/etc/apache2/sites-enabled/'.$this->domain.'.conf';
|
||||
ShellApi::exec('rm -rf ' . $apacheConfEnabled);
|
||||
|
||||
ShellApi::exec('rm -rf '.$apacheConfEnabled);
|
||||
|
||||
// SSL
|
||||
$apacheSSLConf = '/etc/apache2/sites-available/'.$this->domain.'-ssl.conf';
|
||||
ShellApi::exec('rm -rf ' . $apacheSSLConf);
|
||||
ShellApi::exec('rm -rf '.$apacheSSLConf);
|
||||
|
||||
$apacheSSLConfEnabled = '/etc/apache2/sites-enabled/'.$this->domain.'-ssl.conf';
|
||||
ShellApi::exec('rm -rf ' . $apacheSSLConfEnabled);
|
||||
ShellApi::exec('rm -rf '.$apacheSSLConfEnabled);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ use App\ShellApi;
|
|||
class CreateLinuxUser
|
||||
{
|
||||
public $username;
|
||||
|
||||
public $email;
|
||||
|
||||
public $password;
|
||||
|
||||
public function setUsername($username)
|
||||
|
@ -29,6 +31,7 @@ class CreateLinuxUser
|
|||
{
|
||||
$this->isWebUser = true;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$output = '';
|
||||
|
@ -41,7 +44,7 @@ class CreateLinuxUser
|
|||
$output .= ShellApi::exec($command);
|
||||
|
||||
$command = 'echo '.$username.':'.$password.' | sudo chpasswd -e';
|
||||
$output .= ShellApi::exec($command);
|
||||
$output .= ShellApi::exec($command);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ use App\ShellApi;
|
|||
class CreateLinuxWebUser
|
||||
{
|
||||
public $username;
|
||||
|
||||
public $email;
|
||||
|
||||
public $password;
|
||||
|
||||
public function setUsername($username)
|
||||
|
@ -33,7 +35,7 @@ class CreateLinuxWebUser
|
|||
$command = 'groupadd '.$username;
|
||||
$output .= ShellApi::exec($command);
|
||||
|
||||
$command = 'usermod -a -G www-data ' . $username;
|
||||
$command = 'usermod -a -G www-data '.$username;
|
||||
$output .= ShellApi::exec($command);
|
||||
|
||||
$command = 'echo '.$username.':'.$password.' | chpasswd -e';
|
||||
|
|
|
@ -6,6 +6,6 @@ class ApiClient
|
|||
{
|
||||
public static function getPhyrePHP()
|
||||
{
|
||||
return "/usr/local/phyre/php/bin/php";
|
||||
return '/usr/local/phyre/php/bin/php';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class ApachePingWebsitesWithCurl extends Command
|
|||
}
|
||||
|
||||
// Retrieve all website configurations from the database
|
||||
$websiteConfigs = Domain::get();
|
||||
$websiteConfigs = Domain::get();
|
||||
|
||||
foreach ($websiteConfigs as $config) {
|
||||
$domain = $config->domain;
|
||||
|
@ -57,8 +57,6 @@ class ApachePingWebsitesWithCurl extends Command
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -15,6 +12,7 @@ class ModelCustomerDeleting
|
|||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -15,6 +12,7 @@ class ModelDomainDeleting
|
|||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -15,6 +12,7 @@ class ModelHostingSubscriptionCreated
|
|||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -15,6 +12,7 @@ class ModelHostingSubscriptionDeleting
|
|||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
|
|
|
@ -16,47 +16,45 @@ class Modules extends Page
|
|||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
|
||||
protected function getViewData(): array
|
||||
{
|
||||
return [
|
||||
'categories' => [
|
||||
'Security'=>[
|
||||
'Security' => [
|
||||
[
|
||||
'name' => 'Lets Encrypt',
|
||||
'description' => 'Automatically secure your website with a free SSL certificate from Lets Encrypt.',
|
||||
'url' => url('admin/letsencrypt'),
|
||||
'iconUrl' => url('images/modules/letsencrypt.png'),
|
||||
'category' => 'Security'
|
||||
'category' => 'Security',
|
||||
],
|
||||
],
|
||||
'Content Management'=>[
|
||||
'Content Management' => [
|
||||
[
|
||||
'name' => 'Microweber',
|
||||
'description' => 'A drag and drop website builder and a powerful next-generation CMS.',
|
||||
'url' => url('admin/microweber'),
|
||||
'iconUrl' => url('images/modules/microweber.png'),
|
||||
'category' => 'Content Management'
|
||||
'category' => 'Content Management',
|
||||
],
|
||||
[
|
||||
'name'=>'WordPress',
|
||||
'description'=>'WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.',
|
||||
'name' => 'WordPress',
|
||||
'description' => 'WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.',
|
||||
'url' => url('admin/wordpress'),
|
||||
'iconUrl'=>url('images/modules/wordpress.svg'),
|
||||
'category'=>'Content Management'
|
||||
]
|
||||
],
|
||||
'E-Commerce'=>[
|
||||
[
|
||||
'name'=>'OpenCart',
|
||||
'description'=>'A free shopping cart system. OpenCart is an open source PHP-based online e-commerce solution.',
|
||||
'url' => url('admin/opencart'),
|
||||
'iconUrl'=>url('images/modules/opencart.png'),
|
||||
'category'=>'E-Commerce'
|
||||
'iconUrl' => url('images/modules/wordpress.svg'),
|
||||
'category' => 'Content Management',
|
||||
],
|
||||
],
|
||||
]
|
||||
'E-Commerce' => [
|
||||
[
|
||||
'name' => 'OpenCart',
|
||||
'description' => 'A free shopping cart system. OpenCart is an open source PHP-based online e-commerce solution.',
|
||||
'url' => url('admin/opencart'),
|
||||
'iconUrl' => url('images/modules/opencart.png'),
|
||||
'category' => 'E-Commerce',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Settings;
|
||||
|
||||
use Closure;
|
||||
|
@ -8,7 +9,6 @@ use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
|||
|
||||
class Settings extends BaseSettings
|
||||
{
|
||||
|
||||
protected static ?string $navigationGroup = 'Server Management';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
|
|
@ -3,15 +3,11 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\BackupResource\Pages;
|
||||
use App\Filament\Resources\BackupResource\RelationManagers;
|
||||
use App\Models\Backup;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class BackupResource extends Resource
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\BackupResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BackupResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBackup extends CreateRecord
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\CronJobResource\Pages;
|
||||
use App\Filament\Resources\CronJobResource\RelationManagers;
|
||||
use App\Models\CronJob;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CronJobResource extends Resource
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\CronJobResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CronJobResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCronJob extends CreateRecord
|
||||
|
|
|
@ -3,16 +3,12 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\CustomerResource\Pages;
|
||||
use App\Filament\Resources\CustomerResource\RelationManagers;
|
||||
use App\Models\Customer;
|
||||
use Faker\Provider\Text;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CustomerResource extends Resource
|
||||
{
|
||||
|
@ -71,7 +67,7 @@ class CustomerResource extends Resource
|
|||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('email')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->sortable(),
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
|
@ -99,9 +95,9 @@ class CustomerResource extends Resource
|
|||
{
|
||||
return [
|
||||
'index' => Pages\ManageCustomers::route('/'),
|
||||
// 'index' => Pages\ListCustomers::route('/'),
|
||||
// 'create' => Pages\CreateCustomer::route('/create'),
|
||||
// 'edit' => Pages\EditCustomer::route('/{record}/edit'),
|
||||
// 'index' => Pages\ListCustomers::route('/'),
|
||||
// 'create' => Pages\CreateCustomer::route('/create'),
|
||||
// 'edit' => Pages\EditCustomer::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\CustomerResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CustomerResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCustomer extends CreateRecord
|
||||
|
|
|
@ -25,7 +25,7 @@ class EditCustomer extends EditRecord
|
|||
->send();
|
||||
$action->cancel();
|
||||
}
|
||||
})
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Filament\Resources\CustomerResource\Pages;
|
||||
|
||||
|
||||
use App\Filament\Resources\CustomerResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
|
|
@ -3,16 +3,11 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DomainResource\Pages;
|
||||
use App\Filament\Resources\DomainResource\RelationManagers;
|
||||
use App\Models\Domain;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DomainResource extends Resource
|
||||
{
|
||||
|
@ -29,7 +24,6 @@ class DomainResource extends Resource
|
|||
return $form
|
||||
->schema([
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -41,13 +35,13 @@ class DomainResource extends Resource
|
|||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
// Tables\Columns\TextColumn::make('hostingPlan.name')
|
||||
// ->searchable()
|
||||
// ->sortable(),
|
||||
// Tables\Columns\TextColumn::make('hostingPlan.name')
|
||||
// ->searchable()
|
||||
// ->sortable(),
|
||||
|
||||
// Tables\Columns\TextColumn::make('customer.name')
|
||||
// ->searchable()
|
||||
// ->sortable(),
|
||||
// Tables\Columns\TextColumn::make('customer.name')
|
||||
// ->searchable()
|
||||
// ->sortable(),
|
||||
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
|
@ -59,11 +53,11 @@ class DomainResource extends Resource
|
|||
->label('Open website')
|
||||
->icon('heroicon-m-arrow-top-right-on-square')
|
||||
->color('gray')
|
||||
->url(fn ($record): string => 'http://' . $record->domain, true),
|
||||
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
@ -79,8 +73,8 @@ class DomainResource extends Resource
|
|||
{
|
||||
return [
|
||||
'index' => Pages\ListWebsites::route('/'),
|
||||
// 'create' => Pages\CreateWebsite::route('/create'),
|
||||
// 'edit' => Pages\EditWebsite::route('/{record}/edit'),
|
||||
// 'create' => Pages\CreateWebsite::route('/create'),
|
||||
// 'edit' => Pages\EditWebsite::route('/{record}/edit'),
|
||||
'view' => Pages\ViewWebsite::route('/{record}'),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\DomainResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DomainResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateWebsite extends CreateRecord
|
||||
|
|
|
@ -13,7 +13,7 @@ class EditWebsite extends EditRecord
|
|||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// Actions\DeleteAction::make(),
|
||||
// Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\DomainResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DomainResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewWebsite extends ViewRecord
|
||||
|
@ -11,5 +10,4 @@ class ViewWebsite extends ViewRecord
|
|||
protected static string $resource = DomainResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.website.pages.view-website';
|
||||
|
||||
}
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\HostingPlanResource\Pages;
|
||||
use App\Filament\Resources\HostingPlanResource\RelationManagers;
|
||||
use App\Models\HostingPlan;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class HostingPlanResource extends Resource
|
||||
{
|
||||
|
@ -108,11 +105,10 @@ class HostingPlanResource extends Resource
|
|||
->label('Features')
|
||||
->options([
|
||||
'ssl' => 'SSL',
|
||||
'backup' => 'Backup'
|
||||
'backup' => 'Backup',
|
||||
])
|
||||
->multiple(),
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\HostingPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\HostingPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateHostingPlan extends CreateRecord
|
||||
|
|
|
@ -3,16 +3,12 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||
use App\Filament\Resources\HostingSubscriptionResource\RelationManagers;
|
||||
use App\Models\HostingSubscription;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Field;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class HostingSubscriptionResource extends Resource
|
||||
|
@ -41,8 +37,8 @@ class HostingSubscriptionResource extends Resource
|
|||
}
|
||||
})
|
||||
->content(fn ($record) => new HtmlString('
|
||||
<a href="http://' . $record->domain . '" target="_blank" class="text-sm font-medium text-primary-600 dark:text-primary-400">
|
||||
http://' . $record->domain . '
|
||||
<a href="http://'.$record->domain.'" target="_blank" class="text-sm font-medium text-primary-600 dark:text-primary-400">
|
||||
http://'.$record->domain.'
|
||||
</a>')),
|
||||
|
||||
Forms\Components\TextInput::make('domain')
|
||||
|
@ -56,7 +52,7 @@ class HostingSubscriptionResource extends Resource
|
|||
}
|
||||
})
|
||||
->suffixIcon('heroicon-m-globe-alt')
|
||||
->columnSpanFull(),
|
||||
->columnSpanFull(),
|
||||
|
||||
Forms\Components\Select::make('customer_id')
|
||||
->label('Customer')
|
||||
|
@ -94,20 +90,20 @@ class HostingSubscriptionResource extends Resource
|
|||
})
|
||||
->suffixIcon('heroicon-m-user'),
|
||||
|
||||
Forms\Components\TextInput::make('system_password')
|
||||
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
||||
->disabled(function ($record) {
|
||||
if (isset($record->exists)) {
|
||||
return $record->exists;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
->suffixIcon('heroicon-m-lock-closed'),
|
||||
Forms\Components\TextInput::make('system_password')
|
||||
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
||||
->disabled(function ($record) {
|
||||
if (isset($record->exists)) {
|
||||
return $record->exists;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
->suffixIcon('heroicon-m-lock-closed'),
|
||||
|
||||
Forms\Components\Textarea::make('description')
|
||||
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
||||
->columnSpanFull(),
|
||||
Forms\Components\Textarea::make('description')
|
||||
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
||||
->columnSpanFull(),
|
||||
|
||||
]);
|
||||
}
|
||||
|
@ -143,7 +139,7 @@ class HostingSubscriptionResource extends Resource
|
|||
->label('Open website')
|
||||
->icon('heroicon-m-arrow-top-right-on-square')
|
||||
->color('gray')
|
||||
->url(fn ($record): string => 'http://' . $record->domain, true),
|
||||
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
|
@ -165,9 +161,9 @@ class HostingSubscriptionResource extends Resource
|
|||
{
|
||||
return [
|
||||
'index' => Pages\ManageHostingSubscriptions::route('/'),
|
||||
// 'index' => Pages\ListHostingSubscriptions::route('/'),
|
||||
// 'create' => Pages\CreateHostingSubscription::route('/create'),
|
||||
// 'edit' => Pages\EditHostingSubscription::route('/{record}/edit'),
|
||||
// 'index' => Pages\ListHostingSubscriptions::route('/'),
|
||||
// 'create' => Pages\CreateHostingSubscription::route('/create'),
|
||||
// 'edit' => Pages\EditHostingSubscription::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\HostingSubscriptionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateHostingSubscription extends CreateRecord
|
||||
{
|
||||
protected static string $resource = HostingSubscriptionResource::class;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||
|
||||
|
||||
use App\Filament\Resources\HostingSubscriptionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\UserResource\Pages;
|
||||
use App\Filament\Resources\UserResource\RelationManagers;
|
||||
use App\Models\User;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Resources\UserResource\Pages;
|
||||
|
||||
use App\Filament\Resources\UserResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUser extends CreateRecord
|
||||
|
|
|
@ -16,22 +16,20 @@ class CustomersCount extends BaseWidget
|
|||
protected function getStats(): array
|
||||
{
|
||||
|
||||
// $serverStatistic = new \App\Statistics\ServerStatistic();
|
||||
// $serverStats = $serverStatistic->getCurrentStats();
|
||||
|
||||
// $serverStatistic = new \App\Statistics\ServerStatistic();
|
||||
// $serverStats = $serverStatistic->getCurrentStats();
|
||||
|
||||
$customersCount = Customer::count();
|
||||
$websiteCount = Domain::count();
|
||||
|
||||
return [
|
||||
// Stat::make('Total Memory', $serverStats['memory']['total']),
|
||||
// Stat::make('Used Memory', $serverStats['memory']['used']),
|
||||
// Stat::make('Free Memory', $serverStats['memory']['free']),
|
||||
// Stat::make('Shared Memory', $serverStats['memory']['shared']),
|
||||
// Stat::make('Buffer Cache', $serverStats['memory']['buffCache']),
|
||||
// Stat::make('Available Memory', $serverStats['memory']['available']),
|
||||
//
|
||||
|
||||
// Stat::make('Total Memory', $serverStats['memory']['total']),
|
||||
// Stat::make('Used Memory', $serverStats['memory']['used']),
|
||||
// Stat::make('Free Memory', $serverStats['memory']['free']),
|
||||
// Stat::make('Shared Memory', $serverStats['memory']['shared']),
|
||||
// Stat::make('Buffer Cache', $serverStats['memory']['buffCache']),
|
||||
// Stat::make('Available Memory', $serverStats['memory']['available']),
|
||||
//
|
||||
|
||||
Stat::make('Websites', $websiteCount)->icon('heroicon-o-globe-alt'),
|
||||
Stat::make('Customers', $customersCount)->icon('heroicon-o-users'),
|
||||
|
|
|
@ -8,27 +8,21 @@ class ServerDiskUsageStatistic extends ApexChartWidget
|
|||
{
|
||||
/**
|
||||
* Chart Id
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static ?string $chartId = 'serverDiskUsageStatisticChart';
|
||||
|
||||
/**
|
||||
* Widget Title
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected static ?string $heading = 'Disk Usage';
|
||||
|
||||
protected static ?int $sort = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Widget content height
|
||||
*/
|
||||
protected static ?int $contentHeight = 100;
|
||||
|
||||
|
||||
/**
|
||||
* Widget Footer
|
||||
*/
|
||||
|
@ -40,7 +34,6 @@ class ServerDiskUsageStatistic extends ApexChartWidget
|
|||
return view('charts.order-status.footer', ['data' => $serverStats]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Chart options (series, labels, types, size, animations...)
|
||||
* https://apexcharts.com/docs/options
|
||||
|
|
|
@ -8,27 +8,21 @@ class ServerMemoryStatistic extends ApexChartWidget
|
|||
{
|
||||
/**
|
||||
* Chart Id
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static ?string $chartId = 'serverMemoryStatisticChart';
|
||||
|
||||
/**
|
||||
* Widget Title
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected static ?string $heading = 'RAM Usage';
|
||||
|
||||
protected static ?int $sort = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Widget content height
|
||||
*/
|
||||
protected static ?int $contentHeight = 100;
|
||||
|
||||
|
||||
/**
|
||||
* Widget Footer
|
||||
*/
|
||||
|
@ -40,7 +34,6 @@ class ServerMemoryStatistic extends ApexChartWidget
|
|||
return view('filament.widgets.server-memory-statistic', ['data' => $serverStats]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Chart options (series, labels, types, size, animations...)
|
||||
* https://apexcharts.com/docs/options
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\Domain;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class ServerMemoryStatisticCount extends BaseWidget
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\Domain;
|
||||
use Faker\Provider\Text;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Widgets\TableWidget as BaseWidget;
|
||||
|
@ -14,9 +13,9 @@ class Websites extends BaseWidget
|
|||
|
||||
protected static ?string $heading = 'Last created websites';
|
||||
|
||||
protected int | string | array $columnSpan = 2;
|
||||
protected int|string|array $columnSpan = 2;
|
||||
|
||||
protected static ?int $sort =5;
|
||||
protected static ?int $sort = 5;
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
|
@ -29,12 +28,12 @@ class Websites extends BaseWidget
|
|||
->label('Open website')
|
||||
->icon('heroicon-m-arrow-top-right-on-square')
|
||||
->color('gray')
|
||||
->url(fn ($record): string => 'http://' . $record->domain, true),
|
||||
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||
])
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('domain'),
|
||||
Tables\Columns\TextColumn::make('hostingPlan.name'),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
Tables\Columns\TextColumn::make('created_at'),
|
||||
])->defaultSort('id', 'desc');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ class FileManagerApi
|
|||
{
|
||||
return is_file($path);
|
||||
}
|
||||
|
||||
public function isWritable($path)
|
||||
{
|
||||
return is_writable($path);
|
||||
|
@ -37,10 +38,9 @@ class FileManagerApi
|
|||
{
|
||||
return file_exists($file);
|
||||
}
|
||||
|
||||
public function filePutContents($file, $data)
|
||||
{
|
||||
return file_put_contents($file, $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,17 +6,18 @@ use App\Http\Controllers\Api\Request\CustomerCreateRequest;
|
|||
use App\Http\Controllers\ApiController;
|
||||
use App\Models\Customer;
|
||||
use App\Models\HostingSubscription;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomersController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/customers",
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Successful operation",
|
||||
* ),
|
||||
*
|
||||
* @OA\PathItem (
|
||||
* ),
|
||||
* )
|
||||
|
@ -30,7 +31,7 @@ class CustomersController extends ApiController
|
|||
'message' => 'Customers found',
|
||||
'data' => [
|
||||
'customers' => $findCustomers,
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
@ -38,16 +39,21 @@ class CustomersController extends ApiController
|
|||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/customers",
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Successful operation",
|
||||
* ),
|
||||
*
|
||||
* @OA\PathItem (
|
||||
* ),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* required={"name","email","phone"},
|
||||
*
|
||||
* @OA\Property(property="name", type="string", example="John Doe", description="Name of the customer"),
|
||||
* @OA\Property(property="email", type="string", example="jhon@gmail.com", description="Email of the customer"),
|
||||
* @OA\Property(property="phone", type="string", example="1234567890", description="Phone of the customer")
|
||||
|
@ -67,14 +73,14 @@ class CustomersController extends ApiController
|
|||
'message' => 'Customer created',
|
||||
'data' => [
|
||||
'customer' => $customer,
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getHostingSubscriptionsByCustomerId($customerId)
|
||||
{
|
||||
$findCustomer = Customer::where('id', $customerId)->first();
|
||||
if (!$findCustomer) {
|
||||
if (! $findCustomer) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Customer not found',
|
||||
|
@ -94,7 +100,7 @@ class CustomersController extends ApiController
|
|||
'message' => 'Hosting subscriptions found',
|
||||
'data' => [
|
||||
'hostingSubscriptions' => $findHostingSubscriptions,
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
|
||||
use App\Http\Controllers\ApiController;
|
||||
use App\ShellApi;
|
||||
|
||||
class HealthController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/health",
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Successful operation",
|
||||
* ),
|
||||
*
|
||||
* @OA\PathItem (
|
||||
* ),
|
||||
* )
|
||||
|
@ -23,7 +23,7 @@ class HealthController extends ApiController
|
|||
{
|
||||
return response()->json([
|
||||
'status' => 'ok',
|
||||
'message' => 'API is running.'
|
||||
'message' => 'API is running.',
|
||||
]);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,17 +6,18 @@ use App\Http\Controllers\Api\Request\CustomerCreateRequest;
|
|||
use App\Http\Controllers\ApiController;
|
||||
use App\Models\Customer;
|
||||
use App\Models\HostingPlan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HostingPlansController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/hosting-plans",
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Successful operation",
|
||||
* ),
|
||||
*
|
||||
* @OA\PathItem (
|
||||
* ),
|
||||
* )
|
||||
|
@ -29,8 +30,8 @@ class HostingPlansController extends ApiController
|
|||
'status' => 'ok',
|
||||
'message' => 'Hosting Plans found',
|
||||
'data' => [
|
||||
'hostingPlans' => $findHostingPlans->toArray()
|
||||
]
|
||||
'hostingPlans' => $findHostingPlans->toArray(),
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
@ -38,16 +39,21 @@ class HostingPlansController extends ApiController
|
|||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/customers",
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Successful operation",
|
||||
* ),
|
||||
*
|
||||
* @OA\PathItem (
|
||||
* ),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* required={"name","email","phone"},
|
||||
*
|
||||
* @OA\Property(property="name", type="string", example="John Doe", description="Name of the customer"),
|
||||
* @OA\Property(property="email", type="string", example="jhon@gmail.com", description="Email of the customer"),
|
||||
* @OA\Property(property="phone", type="string", example="1234567890", description="Phone of the customer")
|
||||
|
@ -68,7 +74,7 @@ class HostingPlansController extends ApiController
|
|||
'message' => 'Customer created',
|
||||
'data' => [
|
||||
'customer' => $customer,
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class HostingSubscriptionsController extends ApiController
|
|||
'message' => 'Hosting subscriptions found',
|
||||
'data' => [
|
||||
'HostingSubscriptions' => $findHostingSubscription,
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ class HostingSubscriptionsController extends ApiController
|
|||
$hostingSubscription->customer_id = $request->customer_id;
|
||||
$hostingSubscription->hosting_plan_id = $request->hosting_plan_id;
|
||||
$hostingSubscription->domain = $request->domain;
|
||||
// $hostingSubscription->username = $request->username;
|
||||
// $hostingSubscription->password = $request->password;
|
||||
// $hostingSubscription->description = $request->description;
|
||||
// $hostingSubscription->username = $request->username;
|
||||
// $hostingSubscription->password = $request->password;
|
||||
// $hostingSubscription->description = $request->description;
|
||||
$hostingSubscription->setup_date = Carbon::now();
|
||||
$hostingSubscription->save();
|
||||
|
||||
|
@ -40,7 +40,7 @@ class HostingSubscriptionsController extends ApiController
|
|||
'message' => 'Hosting subscription created',
|
||||
'data' => [
|
||||
'hostingSubscription' => $hostingSubscription,
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ class HostingSubscriptionsController extends ApiController
|
|||
$findHostingSubscription = HostingSubscription::where('id', $id)->first();
|
||||
if ($findHostingSubscription) {
|
||||
$findHostingSubscription->delete();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'ok',
|
||||
'message' => 'Hosting subscription deleted',
|
||||
|
|
|
@ -14,7 +14,7 @@ class AuthLoginRequest extends ApiRequest
|
|||
return [
|
||||
'email' => 'required|string|email',
|
||||
'password' => 'required|string',
|
||||
// 'browserAgent' => 'required|string',
|
||||
// 'browserAgent' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Request;
|
||||
|
||||
class CustomerCreateRequest extends AuthorizedApiRequest
|
||||
|
@ -12,7 +13,7 @@ class CustomerCreateRequest extends AuthorizedApiRequest
|
|||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email|unique:customers,email'
|
||||
'email' => 'required|email|unique:customers,email',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Illuminate\Routing\Controller as BaseController;
|
|||
* @OA\Info(
|
||||
* title="PhyrePanel - API Documentation",
|
||||
* version="0.1",
|
||||
*
|
||||
* @OA\Contact(
|
||||
* email="info@phyrepanel.com"
|
||||
* ),
|
||||
|
@ -17,8 +18,6 @@ use Illuminate\Routing\Controller as BaseController;
|
|||
*/
|
||||
class ApiController extends BaseController
|
||||
{
|
||||
// use AuthorizesRequests, ValidatesRequests;
|
||||
// use AuthorizesRequests, ValidatesRequests;
|
||||
use ValidatesRequests;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,16 +5,9 @@ namespace App\Listeners;
|
|||
use App\Actions\ApacheWebsiteCreate;
|
||||
use App\Events\DomainIsCreated;
|
||||
use App\Events\ModelDomainCreated;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Domain;
|
||||
use App\Models\HostingPackage;
|
||||
use App\Models\HostingPlan;
|
||||
use App\Models\HostingSubscription;
|
||||
use Cassandra\Custom;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Str;
|
||||
use function Symfony\Component\String\u;
|
||||
|
||||
class ModelDomainCreatedListener
|
||||
{
|
||||
|
@ -32,16 +25,16 @@ class ModelDomainCreatedListener
|
|||
public function handle(ModelDomainCreated $event): void
|
||||
{
|
||||
$findDomain = Domain::where('id', $event->model->id)->first();
|
||||
if (!$findDomain) {
|
||||
if (! $findDomain) {
|
||||
return;
|
||||
}
|
||||
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
||||
if (!$findHostingSubscription) {
|
||||
if (! $findHostingSubscription) {
|
||||
return;
|
||||
}
|
||||
|
||||
$findHostingPlan = HostingPlan::where('id', $findHostingSubscription->hosting_plan_id)->first();
|
||||
if (!$findHostingPlan) {
|
||||
if (! $findHostingPlan) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,9 +47,9 @@ class ModelDomainCreatedListener
|
|||
$newApacheWebsite->setIsMainDomain(true);
|
||||
}
|
||||
|
||||
$create = $newApacheWebsite->handle();
|
||||
$create = $newApacheWebsite->handle();
|
||||
|
||||
if (!empty($create)) {
|
||||
if (! empty($create)) {
|
||||
|
||||
$findDomain->home_root = $create['homeRoot'];
|
||||
$findDomain->domain_root = $create['domainRoot'];
|
||||
|
|
|
@ -5,8 +5,6 @@ namespace App\Listeners;
|
|||
use App\Actions\ApacheWebsiteDelete;
|
||||
use App\Events\ModelDomainDeleting;
|
||||
use App\ShellApi;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class ModelDomainDeletingListener
|
||||
{
|
||||
|
@ -25,7 +23,7 @@ class ModelDomainDeletingListener
|
|||
{
|
||||
$domainRoot = '/home/'.$event->model->domain_username.'/domains/'.$event->model->domain;
|
||||
|
||||
ShellApi::exec('rm -rf ' . $domainRoot);
|
||||
ShellApi::exec('rm -rf '.$domainRoot);
|
||||
|
||||
$deleteApacheWebsite = new ApacheWebsiteDelete();
|
||||
$deleteApacheWebsite->setDomain($event->model->domain);
|
||||
|
|
|
@ -27,24 +27,24 @@ class ModelHostingSubscriptionCreatedListener
|
|||
{
|
||||
|
||||
$findHostingSubscription = HostingSubscription::where('id', $event->model->id)->first();
|
||||
if (!$findHostingSubscription) {
|
||||
if (! $findHostingSubscription) {
|
||||
return;
|
||||
}
|
||||
$findCustomer = Customer::where('id', $event->model->customer_id)->first();
|
||||
if (!$findCustomer) {
|
||||
if (! $findCustomer) {
|
||||
return;
|
||||
}
|
||||
|
||||
$systemUsername = $this->_generateUsername($event->model->domain);
|
||||
$systemUsername = $systemUsername . $findCustomer->id . $findHostingSubscription->id;
|
||||
$systemUsername = $systemUsername.$findCustomer->id.$findHostingSubscription->id;
|
||||
|
||||
$getLinuxUser = new GetLinuxUser();
|
||||
$getLinuxUser->setUsername($systemUsername);
|
||||
$linuxUser = $getLinuxUser->handle();
|
||||
|
||||
if (!empty($linuxUser)) {
|
||||
if (! empty($linuxUser)) {
|
||||
$systemUsername = $this->_generateUsername(Str::random(10));
|
||||
$systemUsername = $systemUsername . $findCustomer->id . $findHostingSubscription->id;
|
||||
$systemUsername = $systemUsername.$findCustomer->id.$findHostingSubscription->id;
|
||||
}
|
||||
|
||||
$systemPassword = Str::random(14);
|
||||
|
@ -75,13 +75,13 @@ class ModelHostingSubscriptionCreatedListener
|
|||
$removedMultispace = preg_replace('/\s+/', ' ', $string);
|
||||
$sanitized = preg_replace('/[^A-Za-z0-9\ ]/', '', $removedMultispace);
|
||||
$lowercased = strtolower($sanitized);
|
||||
$lowercased = str_replace(" ", "", $lowercased);
|
||||
$lowercased = str_replace(' ', '', $lowercased);
|
||||
$lowercased = trim($lowercased);
|
||||
if (strlen($lowercased) > 10) {
|
||||
$lowercased = substr($lowercased, 0, 10);
|
||||
}
|
||||
|
||||
$username = $lowercased . rand(1111,9999) . Str::random(4);
|
||||
$username = $lowercased.rand(1111, 9999).Str::random(4);
|
||||
$username = strtolower($username);
|
||||
|
||||
return $username;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Listeners;
|
||||
|
||||
use App\Actions\GetLinuxUser;
|
||||
use App\Events\ModelHostingSubscriptionCreated;
|
||||
use App\Events\ModelHostingSubscriptionDeleting;
|
||||
use App\Models\Domain;
|
||||
|
||||
|
@ -26,9 +25,9 @@ class ModelHostingSubscriptionDeletingListener
|
|||
$getLinuxUser->setUsername($event->model->system_username);
|
||||
$getLinuxUserStatus = $getLinuxUser->handle();
|
||||
|
||||
if (!empty($getLinuxUserStatus)) {
|
||||
shell_exec('userdel ' . $event->model->system_username);
|
||||
shell_exec('rm -rf /home/' . $event->model->system_username);
|
||||
if (! empty($getLinuxUserStatus)) {
|
||||
shell_exec('userdel '.$event->model->system_username);
|
||||
shell_exec('rm -rf /home/'.$event->model->system_username);
|
||||
}
|
||||
$findRelatedDomains = Domain::where('hosting_subscription_id', $event->model->id)->get();
|
||||
if ($findRelatedDomains->count() > 0) {
|
||||
|
@ -38,5 +37,4 @@ class ModelHostingSubscriptionDeletingListener
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Livewire\Component;
|
||||
|
||||
class Installer extends Component
|
||||
|
@ -11,8 +10,11 @@ class Installer extends Component
|
|||
public $step = 1;
|
||||
|
||||
public $name;
|
||||
|
||||
public $email;
|
||||
|
||||
public $password;
|
||||
|
||||
public $password_confirmation;
|
||||
|
||||
public function install()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Sushi\Sushi;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\ShellApi;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Sushi\Sushi;
|
||||
|
||||
|
@ -64,20 +63,20 @@ class CronJob extends Model
|
|||
$user = ShellApi::exec('whoami');
|
||||
|
||||
$cronList = ShellApi::callBin('cron-jobs-list', [
|
||||
$user
|
||||
$user,
|
||||
]);
|
||||
|
||||
$rows = [];
|
||||
if (!empty($cronList)) {
|
||||
if (! empty($cronList)) {
|
||||
$cronList = json_decode($cronList, true);
|
||||
if (!empty($cronList)) {
|
||||
if (! empty($cronList)) {
|
||||
foreach ($cronList as $cron) {
|
||||
if (isset($cron['schedule'])) {
|
||||
$rows[] = [
|
||||
'schedule' => $cron['schedule'],
|
||||
'command' => $cron['command'],
|
||||
'user' => $user,
|
||||
'time'=> time(),
|
||||
'time' => time(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Models;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
@ -28,5 +27,4 @@ class Customer extends Model
|
|||
{
|
||||
return $this->hasMany(HostingSubscription::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@ namespace App\Models;
|
|||
|
||||
use App\Events\ModelDomainCreated;
|
||||
use App\Events\ModelDomainDeleting;
|
||||
use App\ShellApi;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Domain extends Model
|
||||
|
@ -30,5 +28,4 @@ class Domain extends Model
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,5 +23,4 @@ class DomainSslCertificate extends Model
|
|||
'renewed_date',
|
||||
'renewed_until_date',
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class HostingDatabase extends Model
|
|||
protected $fillable = [
|
||||
'database_name',
|
||||
'database_username',
|
||||
'database_password'
|
||||
'database_password',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
|
@ -22,7 +22,7 @@ class HostingDatabase extends Model
|
|||
$createDbAndUser = ShellApi::callBin('mysql-create-db-and-user', [
|
||||
$model->database_name,
|
||||
$model->database_username,
|
||||
$model->database_password
|
||||
$model->database_password,
|
||||
]);
|
||||
|
||||
if (empty($createDbAndUser)) {
|
||||
|
@ -35,5 +35,4 @@ class HostingDatabase extends Model
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,5 +34,4 @@ class HostingPlan extends Model
|
|||
'features' => 'array',
|
||||
'limitations' => 'array',
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class HostingSubscription extends Model
|
|||
'description',
|
||||
'setup_date',
|
||||
'expiry_date',
|
||||
'renewal_date'
|
||||
'renewal_date',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
|
@ -44,5 +44,4 @@ class HostingSubscription extends Model
|
|||
{
|
||||
return $this->belongsTo(HostingPlan::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use Rappasoft\LaravelAuthenticationLog\Traits\AuthenticationLoggable;
|
|||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable, AuthenticationLoggable;
|
||||
use AuthenticationLoggable, HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
|
|
@ -8,7 +8,6 @@ use Illuminate\Foundation\Application;
|
|||
* @property \App\FileManagerApi $file_manager_api
|
||||
* @property \App\VirtualHosts\ApacheVirtualHostManager $virtualHostManager
|
||||
*/
|
||||
class PhyreLaravelApplication extends Application {
|
||||
|
||||
class PhyreLaravelApplication extends Application
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace App\Policies;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\User;
|
||||
use App\Models\Domain;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class CustomerPolicy
|
||||
|
@ -12,7 +12,7 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user) : bool
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Customer $customer) : bool
|
||||
public function view(User $user, Customer $customer): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user) : bool
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Customer $customer) : bool
|
||||
public function update(User $user, Customer $customer): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Customer $customer) : bool
|
||||
public function delete(User $user, Customer $customer): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, Customer $customer) : bool
|
||||
public function restore(User $user, Customer $customer): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -60,13 +60,15 @@ class CustomerPolicy
|
|||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, Customer $customer) : bool
|
||||
public function forceDelete(User $user, Customer $customer): bool
|
||||
{
|
||||
$findWebsites = Domain::where('customer_id', $customer->id)->count();
|
||||
if ($findWebsites > 0) {
|
||||
Response::deny('Customer has websites, please delete them first.');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,18 +2,14 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
|
||||
use App\Events\ModelHostingSubscriptionCreated;
|
||||
use App\Events\ModelHostingSubscriptionDeleting;
|
||||
|
||||
use App\Listeners\ModelHostingSubscriptionCreatedListener;
|
||||
use App\Listeners\ModelHostingSubscriptionDeletingListener;
|
||||
|
||||
use App\Events\ModelDomainCreated;
|
||||
use App\Events\ModelDomainDeleting;
|
||||
use App\Events\ModelHostingSubscriptionCreated;
|
||||
use App\Events\ModelHostingSubscriptionDeleting;
|
||||
use App\Listeners\ModelDomainCreatedListener;
|
||||
use App\Listeners\ModelDomainDeletingListener;
|
||||
|
||||
use App\Listeners\ModelHostingSubscriptionCreatedListener;
|
||||
use App\Listeners\ModelHostingSubscriptionDeletingListener;
|
||||
use App\Policies\CustomerPolicy;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
@ -49,10 +45,10 @@ class AppServiceProvider extends ServiceProvider
|
|||
|
||||
Gate::define('delete-customer', [CustomerPolicy::class, 'delete']);
|
||||
|
||||
Event::listen(ModelDomainCreated::class,ModelDomainCreatedListener::class);
|
||||
Event::listen(ModelDomainDeleting::class,ModelDomainDeletingListener::class);
|
||||
Event::listen(ModelDomainCreated::class, ModelDomainCreatedListener::class);
|
||||
Event::listen(ModelDomainDeleting::class, ModelDomainDeletingListener::class);
|
||||
|
||||
Event::listen(ModelHostingSubscriptionCreated::class,ModelHostingSubscriptionCreatedListener::class);
|
||||
Event::listen(ModelHostingSubscriptionDeleting::class,ModelHostingSubscriptionDeletingListener::class);
|
||||
Event::listen(ModelHostingSubscriptionCreated::class, ModelHostingSubscriptionCreatedListener::class);
|
||||
Event::listen(ModelHostingSubscriptionDeleting::class, ModelHostingSubscriptionDeletingListener::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class AdminPanelProvider extends PanelProvider
|
|||
->brandLogo(asset('images/phyre-logo.svg'))
|
||||
->brandLogoHeight('2.4rem')
|
||||
->colors([
|
||||
Color::Yellow
|
||||
Color::Yellow,
|
||||
])
|
||||
// ->colors([
|
||||
// 'primary' => [
|
||||
|
@ -67,27 +67,27 @@ class AdminPanelProvider extends PanelProvider
|
|||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||
|
||||
->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: "Modules\\Microweber\\Filament\\Clusters")
|
||||
->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: 'Modules\\Microweber\\Filament\\Clusters')
|
||||
|
||||
->pages([
|
||||
Pages\Dashboard::class,
|
||||
])
|
||||
->plugins([
|
||||
// FilamentAuthenticationLogPlugin::make(),
|
||||
// FilamentAuthenticationLogPlugin::make(),
|
||||
FilamentApexChartsPlugin::make(),
|
||||
FilamentSettingsPlugin::make()->pages([
|
||||
Settings::class,
|
||||
])
|
||||
]),
|
||||
])
|
||||
// ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
->widgets([
|
||||
ServerDiskUsageStatistic::class,
|
||||
ServerMemoryStatistic::class,
|
||||
// ServerMemoryStatisticCount::class,
|
||||
// ServerMemoryStatisticCount::class,
|
||||
CustomersCount::class,
|
||||
Websites::class,
|
||||
// Widgets\AccountWidget::class,
|
||||
// Widgets\FilamentInfoWidget::class,
|
||||
// Widgets\AccountWidget::class,
|
||||
// Widgets\FilamentInfoWidget::class,
|
||||
])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
|
|
|
@ -16,7 +16,7 @@ class Settings
|
|||
public static function general()
|
||||
{
|
||||
$settings = setting('general');
|
||||
if (!empty($settings)) {
|
||||
if (! empty($settings)) {
|
||||
foreach ($settings as $key => $value) {
|
||||
if (isset(self::$general[$key])) {
|
||||
self::$general[$key] = $value;
|
||||
|
@ -26,5 +26,4 @@ class Settings
|
|||
|
||||
return self::$general;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,16 +7,16 @@ class ShellApi
|
|||
public static function exec($command, $argsArray = [])
|
||||
{
|
||||
$args = '';
|
||||
if (!empty($argsArray)) {
|
||||
if (! empty($argsArray)) {
|
||||
foreach ($argsArray as $arg) {
|
||||
$args .= escapeshellarg($arg) . ' ';
|
||||
$args .= escapeshellarg($arg).' ';
|
||||
}
|
||||
}
|
||||
|
||||
$fullCommand = $command . ' ' . $args;
|
||||
$fullCommand = $command.' '.$args;
|
||||
|
||||
// Run the command as sudo "/usr/bin/sudo "
|
||||
$execOutput = shell_exec("/usr/bin/sudo " . $fullCommand);
|
||||
$execOutput = shell_exec('/usr/bin/sudo '.$fullCommand);
|
||||
$execOutput = str_replace(PHP_EOL, '', $execOutput);
|
||||
|
||||
return $execOutput;
|
||||
|
@ -25,14 +25,14 @@ class ShellApi
|
|||
public static function callBin($command, $argsArray = [])
|
||||
{
|
||||
$args = '';
|
||||
if (!empty($argsArray)) {
|
||||
if (! empty($argsArray)) {
|
||||
foreach ($argsArray as $arg) {
|
||||
$args .= escapeshellarg($arg) . ' ';
|
||||
$args .= escapeshellarg($arg).' ';
|
||||
}
|
||||
}
|
||||
|
||||
$fullCommand = escapeshellarg('/usr/local/phyre/bin/' . $command . '.sh') . ' ' . $args;
|
||||
$commandAsSudo = '/usr/bin/sudo ' . $fullCommand;
|
||||
$fullCommand = escapeshellarg('/usr/local/phyre/bin/'.$command.'.sh').' '.$args;
|
||||
$commandAsSudo = '/usr/bin/sudo '.$fullCommand;
|
||||
|
||||
$execOutput = shell_exec($commandAsSudo);
|
||||
|
||||
|
|
|
@ -2,19 +2,17 @@
|
|||
|
||||
namespace App\Statistics;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class ServerStatistic
|
||||
{
|
||||
public function getCurrentStats()
|
||||
{
|
||||
$memory =[
|
||||
$memory = [
|
||||
'total' => 0,
|
||||
'used' => 0,
|
||||
'free' => 0,
|
||||
'shared' => 0,
|
||||
'buffCache' => 0,
|
||||
'available' => 0
|
||||
'available' => 0,
|
||||
];
|
||||
|
||||
$freeMemoryExec = shell_exec('free -m | grep Mem | awk \'{print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7}\'');
|
||||
|
@ -52,16 +50,16 @@ class ServerStatistic
|
|||
'used' => 0,
|
||||
'free' => 0,
|
||||
'usedPercentage' => 0,
|
||||
'mountedOn' => ''
|
||||
'mountedOn' => '',
|
||||
];
|
||||
if (isset($diskMemoryExp[0])) {
|
||||
$diskMemory['total'] = $diskMemoryExp[0]. 'B';
|
||||
$diskMemory['total'] = $diskMemoryExp[0].'B';
|
||||
}
|
||||
if (isset($diskMemoryExp[1])) {
|
||||
$diskMemory['used'] = $diskMemoryExp[1]. 'B';
|
||||
$diskMemory['used'] = $diskMemoryExp[1].'B';
|
||||
}
|
||||
if (isset($diskMemoryExp[2])) {
|
||||
$diskMemory['free'] = $diskMemoryExp[2]. 'B';
|
||||
$diskMemory['free'] = $diskMemoryExp[2].'B';
|
||||
}
|
||||
if (isset($diskMemoryExp[3])) {
|
||||
$diskMemory['usedPercentage'] = $diskMemoryExp[3];
|
||||
|
@ -70,7 +68,7 @@ class ServerStatistic
|
|||
$cpuLoad = [
|
||||
'1min' => 0,
|
||||
'5min' => 0,
|
||||
'15min' => 0
|
||||
'15min' => 0,
|
||||
];
|
||||
$cpuLoadExec = shell_exec('uptime');
|
||||
$cpuLoadExp = explode('load average:', $cpuLoadExec);
|
||||
|
@ -98,28 +96,26 @@ class ServerStatistic
|
|||
'disk' => $diskMemory,
|
||||
'cpu' => $cpuLoad,
|
||||
'totalTasks' => $totalTasks,
|
||||
'uptime' => $uptime
|
||||
'uptime' => $uptime,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function getFormattedFileSize($size, $precision) {
|
||||
switch (true)
|
||||
{
|
||||
case ($size/1024 < 1):
|
||||
public function getFormattedFileSize($size, $precision)
|
||||
{
|
||||
switch (true) {
|
||||
case $size / 1024 < 1:
|
||||
return $size.'B';
|
||||
case ($size/pow(1024, 2) < 1):
|
||||
return round($size/1024, $precision).'KB';
|
||||
case ($size/pow(1024, 3) < 1):
|
||||
return round($size/pow(1024, 2), $precision).'MB';
|
||||
case ($size/pow(1024, 4) < 1):
|
||||
return round($size/pow(1024, 3), $precision).'GB';
|
||||
case ($size/pow(1024, 5) < 1):
|
||||
return round($size/pow(1024, 4), $precision).'TB';
|
||||
case $size / pow(1024, 2) < 1:
|
||||
return round($size / 1024, $precision).'KB';
|
||||
case $size / pow(1024, 3) < 1:
|
||||
return round($size / pow(1024, 2), $precision).'MB';
|
||||
case $size / pow(1024, 4) < 1:
|
||||
return round($size / pow(1024, 3), $precision).'GB';
|
||||
case $size / pow(1024, 5) < 1:
|
||||
return round($size / pow(1024, 4), $precision).'TB';
|
||||
default:
|
||||
return 'Error: invalid input or file is too large.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,5 +14,4 @@ abstract class ApacheVirtualHostConfigBase
|
|||
|
||||
return $configValues;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,16 +15,16 @@ class ApacheVirtualHostManager
|
|||
{
|
||||
$allConfigs = [];
|
||||
foreach ($this->registerConfigs as $module => $configs) {
|
||||
if (!in_array($module, $forModules)) {
|
||||
if (! in_array($module, $forModules)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($configs as $config) {
|
||||
try {
|
||||
$registerConfigInstance = app()->make($config);
|
||||
$getConfig = $registerConfigInstance->getConfig();
|
||||
if (!empty($getConfig)) {
|
||||
if (! empty($getConfig)) {
|
||||
foreach ($getConfig as $key => $value) {
|
||||
if (!isset($allConfigs[$key])) {
|
||||
if (! isset($allConfigs[$key])) {
|
||||
$allConfigs[$key] = [];
|
||||
}
|
||||
$allConfigs[$key] = array_merge($allConfigs[$key], $value);
|
||||
|
@ -38,5 +38,4 @@ class ApacheVirtualHostManager
|
|||
|
||||
return $allConfigs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/pint": "^1.15",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
|
|
2
web/composer.lock
generated
2
web/composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "bb37d9fbda9151cc830ea85df5e6d431",
|
||||
"content-hash": "4abe345fdbef63cc6393bf28582dc8cf",
|
||||
"packages": [
|
||||
{
|
||||
"name": "acmephp/core",
|
||||
|
|
|
@ -35,13 +35,13 @@ return [
|
|||
|
||||
'connections' => [
|
||||
|
||||
// 'sqlite' => [
|
||||
// 'driver' => 'sqlite',
|
||||
// 'url' => env('DATABASE_URL'),
|
||||
// 'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
// 'prefix' => '',
|
||||
// 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
// ],
|
||||
// 'sqlite' => [
|
||||
// 'driver' => 'sqlite',
|
||||
// 'url' => env('DATABASE_URL'),
|
||||
// 'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
// 'prefix' => '',
|
||||
// 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
// ],
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
|
|
|
@ -4,45 +4,45 @@ return [
|
|||
|
||||
'notifications' => [
|
||||
|
||||
// 'new-device' => [
|
||||
//
|
||||
// // Send the NewDevice notification
|
||||
//
|
||||
// 'enabled' => env('NEW_DEVICE_NOTIFICATION', true),
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Use torann/geoip to attempt to get a location
|
||||
//
|
||||
// 'location' => true,
|
||||
//
|
||||
//
|
||||
//
|
||||
// // The Notification class to send
|
||||
//
|
||||
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\NewDevice::class,
|
||||
//
|
||||
// ],
|
||||
//
|
||||
// 'failed-login' => [
|
||||
//
|
||||
// // Send the FailedLogin notification
|
||||
//
|
||||
// 'enabled' => env('FAILED_LOGIN_NOTIFICATION', false),
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Use torann/geoip to attempt to get a location
|
||||
//
|
||||
// 'location' => true,
|
||||
//
|
||||
//
|
||||
//
|
||||
// // The Notification class to send
|
||||
//
|
||||
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\FailedLogin::class,
|
||||
//
|
||||
// ],
|
||||
// 'new-device' => [
|
||||
//
|
||||
// // Send the NewDevice notification
|
||||
//
|
||||
// 'enabled' => env('NEW_DEVICE_NOTIFICATION', true),
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Use torann/geoip to attempt to get a location
|
||||
//
|
||||
// 'location' => true,
|
||||
//
|
||||
//
|
||||
//
|
||||
// // The Notification class to send
|
||||
//
|
||||
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\NewDevice::class,
|
||||
//
|
||||
// ],
|
||||
//
|
||||
// 'failed-login' => [
|
||||
//
|
||||
// // Send the FailedLogin notification
|
||||
//
|
||||
// 'enabled' => env('FAILED_LOGIN_NOTIFICATION', false),
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Use torann/geoip to attempt to get a location
|
||||
//
|
||||
// 'location' => true,
|
||||
//
|
||||
//
|
||||
//
|
||||
// // The Notification class to send
|
||||
//
|
||||
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\FailedLogin::class,
|
||||
//
|
||||
// ],
|
||||
|
||||
],
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ return new class extends Migration
|
|||
$table->longText('private_key')->nullable();
|
||||
$table->longText('certificate_chain')->nullable();
|
||||
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class DatabaseSeeder extends Seeder
|
|||
public function run(): void
|
||||
{
|
||||
$findHostingPlan = HostingPlan::where('slug', 'free')->first();
|
||||
if (!$findHostingPlan) {
|
||||
if (! $findHostingPlan) {
|
||||
HostingPlan::create([
|
||||
'name' => 'Hosting Free',
|
||||
'slug' => 'free',
|
||||
|
@ -37,7 +37,7 @@ class DatabaseSeeder extends Seeder
|
|||
}
|
||||
|
||||
$findHostingPlan = HostingPlan::where('slug', 'basic')->first();
|
||||
if (!$findHostingPlan) {
|
||||
if (! $findHostingPlan) {
|
||||
HostingPlan::create([
|
||||
'name' => 'Hosting Basic',
|
||||
'slug' => 'basic',
|
||||
|
@ -60,7 +60,7 @@ class DatabaseSeeder extends Seeder
|
|||
}
|
||||
|
||||
$findHostingPlan = HostingPlan::where('slug', 'pro')->first();
|
||||
if (!$findHostingPlan) {
|
||||
if (! $findHostingPlan) {
|
||||
HostingPlan::create([
|
||||
'name' => 'Hosting Pro',
|
||||
'slug' => 'pro',
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue