refactoring - remove unused code

This commit is contained in:
Saeed Vaziry 2024-03-06 20:33:33 +01:00
parent cfc0645002
commit 9d705592da
32 changed files with 3 additions and 442 deletions

View File

@ -1,16 +0,0 @@
<?php
namespace App\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class Broadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(public string $type, public array $data)
{
}
}

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Installation; namespace App\Jobs\Installation;
use App\Events\Broadcast;
use App\Models\Server; use App\Models\Server;
class ContinueInstallation extends InstallationJob class ContinueInstallation extends InstallationJob
@ -29,11 +28,6 @@ public function handle(): void
$this->server->update([ $this->server->update([
'status' => 'installation_failed', 'status' => 'installation_failed',
]); ]);
event(
new Broadcast('install-server-failed', [
'server' => $this->server,
])
);
return; return;
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\PHP; namespace App\Jobs\PHP;
use App\Events\Broadcast;
use App\Exceptions\ProcessFailed; use App\Exceptions\ProcessFailed;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Service; use App\Models\Service;
@ -40,19 +39,9 @@ public function handle(): void
$typeData['extensions'][] = $this->name; $typeData['extensions'][] = $this->name;
$this->service->type_data = $typeData; $this->service->type_data = $typeData;
$this->service->save(); $this->service->save();
event(
new Broadcast('install-php-extension-finished', [
'service' => $this->service,
])
);
} }
public function failed(): void public function failed(): void
{ {
event(
new Broadcast('install-php-extension-failed', [
'service' => $this->service,
])
);
} }
} }

View File

@ -3,7 +3,6 @@
namespace App\Jobs\Queue; namespace App\Jobs\Queue;
use App\Enums\QueueStatus; use App\Enums\QueueStatus;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Queue; use App\Models\Queue;
@ -30,20 +29,10 @@ public function handle(): void
); );
$this->worker->status = QueueStatus::RUNNING; $this->worker->status = QueueStatus::RUNNING;
$this->worker->save(); $this->worker->save();
event(
new Broadcast('deploy-queue-finished', [
'queue' => $this->worker,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->worker->delete(); $this->worker->delete();
event(
new Broadcast('deploy-queue-failed', [
'queue' => $this->worker,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Queue; namespace App\Jobs\Queue;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Queue; use App\Models\Queue;
@ -18,20 +17,10 @@ public function __construct(Queue $worker)
public function handle(): void public function handle(): void
{ {
$logs = $this->worker->server->processManager()->handler()->getLogs($this->worker->log_file); $logs = $this->worker->server->processManager()->handler()->getLogs($this->worker->log_file);
event(
new Broadcast('get-logs-finished', [
'id' => $this->worker->id,
'logs' => $logs,
])
);
} }
public function failed(): void public function failed(): void
{ {
event(
new Broadcast('get-logs-failed', [
'message' => __('Failed to download the logs!'),
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Queue; namespace App\Jobs\Queue;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Queue; use App\Models\Queue;
@ -47,22 +46,11 @@ public function handle(): void
} }
$this->worker->status = $this->successStatus; $this->worker->status = $this->successStatus;
$this->worker->save(); $this->worker->save();
event(
new Broadcast('manage-queue-finished', [
'queue' => $this->worker,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->worker->status = $this->failStatus; $this->worker->status = $this->failStatus;
$this->worker->save(); $this->worker->save();
event(
new Broadcast('manage-queue-failed', [
'message' => $this->failMessage,
'queue' => $this->worker,
])
);
} }
} }

View File

@ -3,7 +3,6 @@
namespace App\Jobs\Queue; namespace App\Jobs\Queue;
use App\Enums\QueueStatus; use App\Enums\QueueStatus;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Queue; use App\Models\Queue;
@ -20,22 +19,11 @@ public function handle(): void
{ {
$this->worker->server->processManager()->handler()->delete($this->worker->id, $this->worker->site_id); $this->worker->server->processManager()->handler()->delete($this->worker->id, $this->worker->site_id);
$this->worker->delete(); $this->worker->delete();
event(
new Broadcast('remove-queue-finished', [
'id' => $this->worker->id,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->worker->status = QueueStatus::FAILED; $this->worker->status = QueueStatus::FAILED;
$this->worker->save(); $this->worker->save();
event(
new Broadcast('remove-queue-failed', [
'message' => __('Failed to delete worker!'),
'id' => $this->worker->id,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Redirect; namespace App\Jobs\Redirect;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Redirect; use App\Models\Redirect;
@ -22,21 +21,11 @@ public function handle(): void
$this->redirect->site->server->webserver()->handler()->updateRedirects($this->redirect->site, $redirects); $this->redirect->site->server->webserver()->handler()->updateRedirects($this->redirect->site, $redirects);
$this->redirect->status = 'ready'; $this->redirect->status = 'ready';
$this->redirect->save(); $this->redirect->save();
event(
new Broadcast('create-redirect-finished', [
'redirect' => $this->redirect,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->redirect->status = 'failed'; $this->redirect->status = 'failed';
$this->redirect->delete(); $this->redirect->delete();
event(
new Broadcast('create-redirect-failed', [
'redirect' => $this->redirect,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Redirect; namespace App\Jobs\Redirect;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Redirect; use App\Models\Redirect;
@ -24,21 +23,11 @@ public function handle(): void
->get(); ->get();
$this->redirect->site->server->webserver()->handler()->updateRedirects($this->redirect->site, $redirects); $this->redirect->site->server->webserver()->handler()->updateRedirects($this->redirect->site, $redirects);
$this->redirect->delete(); $this->redirect->delete();
event(
new Broadcast('delete-redirect-finished', [
'id' => $this->redirect->id,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->redirect->status = 'failed'; $this->redirect->status = 'failed';
$this->redirect->save(); $this->redirect->save();
event(
new Broadcast('delete-redirect-failed', [
'redirect' => $this->redirect,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Script; namespace App\Jobs\Script;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Script; use App\Models\Script;
use App\Models\ScriptExecution; use App\Models\ScriptExecution;
@ -41,21 +40,11 @@ public function handle(): void
); );
$this->scriptExecution->finished_at = now(); $this->scriptExecution->finished_at = now();
$this->scriptExecution->save(); $this->scriptExecution->save();
event(
new Broadcast('execute-script-finished', [
'execution' => $this->scriptExecution,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->scriptExecution->finished_at = now(); $this->scriptExecution->finished_at = now();
$this->scriptExecution->save(); $this->scriptExecution->save();
event(
new Broadcast('execute-script-failed', [
'execution' => $this->scriptExecution,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Service; namespace App\Jobs\Service;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Service; use App\Models\Service;
use App\SSHCommands\Service\RestartServiceCommand; use App\SSHCommands\Service\RestartServiceCommand;
@ -54,22 +53,11 @@ public function handle(): void
); );
$this->service->status = $this->successStatus; $this->service->status = $this->successStatus;
$this->service->save(); $this->service->save();
event(
new Broadcast('update-service-finished', [
'service' => $this->service,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->service->status = $this->failStatus; $this->service->status = $this->failStatus;
$this->service->save(); $this->service->save();
event(
new Broadcast('update-service-failed', [
'message' => $this->service->name.' '.$this->failMessage,
'service' => $this->service,
])
);
} }
} }

View File

@ -3,7 +3,6 @@
namespace App\Jobs\Site; namespace App\Jobs\Site;
use App\Enums\SiteStatus; use App\Enums\SiteStatus;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Site; use App\Models\Site;
@ -20,21 +19,11 @@ public function handle(): void
{ {
$this->site->server->webserver()->handler()->deleteSite($this->site); $this->site->server->webserver()->handler()->deleteSite($this->site);
$this->site->delete(); $this->site->delete();
event(
new Broadcast('delete-site-finished', [
'site' => $this->site,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->site->status = SiteStatus::READY; $this->site->status = SiteStatus::READY;
$this->site->save(); $this->site->save();
event(
new Broadcast('delete-site-failed', [
'site' => $this->site,
])
);
} }
} }

View File

@ -3,7 +3,6 @@
namespace App\Jobs\Site; namespace App\Jobs\Site;
use App\Enums\DeploymentStatus; use App\Enums\DeploymentStatus;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Deployment; use App\Models\Deployment;
use App\SSHCommands\System\RunScriptCommand; use App\SSHCommands\System\RunScriptCommand;
@ -39,11 +38,6 @@ public function handle(): void
$this->deployment->status = DeploymentStatus::FINISHED; $this->deployment->status = DeploymentStatus::FINISHED;
$this->deployment->log_id = $ssh->log->id; $this->deployment->log_id = $ssh->log->id;
$this->deployment->save(); $this->deployment->save();
event(
new Broadcast('deploy-site-finished', [
'deployment' => $this->deployment,
])
);
} catch (Throwable) { } catch (Throwable) {
$this->deployment->log_id = $ssh->log->id; $this->deployment->log_id = $ssh->log->id;
$this->deployment->save(); $this->deployment->save();
@ -55,10 +49,5 @@ public function failed(): void
{ {
$this->deployment->status = DeploymentStatus::FAILED; $this->deployment->status = DeploymentStatus::FAILED;
$this->deployment->save(); $this->deployment->save();
event(
new Broadcast('deploy-site-failed', [
'deployment' => $this->deployment,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Site; namespace App\Jobs\Site;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Site; use App\Models\Site;
use App\SSHCommands\System\EditFileCommand; use App\SSHCommands\System\EditFileCommand;
@ -28,19 +27,9 @@ public function handle(): void
$this->site->env $this->site->env
) )
); );
event(
new Broadcast('deploy-site-env-finished', [
'site' => $this->site,
])
);
} }
public function failed(): void public function failed(): void
{ {
event(
new Broadcast('deploy-site-env-failed', [
'site' => $this->site,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Site; namespace App\Jobs\Site;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Site; use App\Models\Site;
use App\SSHCommands\Website\UpdateBranchCommand; use App\SSHCommands\Website\UpdateBranchCommand;
@ -35,19 +34,9 @@ public function handle(): void
); );
$this->site->branch = $this->branch; $this->site->branch = $this->branch;
$this->site->save(); $this->site->save();
event(
new Broadcast('update-branch-finished', [
'site' => $this->site,
])
);
} }
public function failed(): void public function failed(): void
{ {
event(
new Broadcast('update-branch-failed', [
'site' => $this->site,
])
);
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\SshKey; namespace App\Jobs\SshKey;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Server; use App\Models\Server;
use App\Models\SshKey; use App\Models\SshKey;
@ -31,20 +30,10 @@ public function handle()
'delete-ssh-key' 'delete-ssh-key'
); );
$this->server->sshKeys()->detach($this->sshKey); $this->server->sshKeys()->detach($this->sshKey);
event(
new Broadcast('delete-ssh-key-finished', [
'sshKey' => $this->sshKey,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->server->sshKeys()->attach($this->sshKey); $this->server->sshKeys()->attach($this->sshKey);
event(
new Broadcast('delete-ssh-key-failed', [
'sshKey' => $this->sshKey,
])
);
} }
} }

View File

@ -3,7 +3,6 @@
namespace App\Jobs\SshKey; namespace App\Jobs\SshKey;
use App\Enums\SshKeyStatus; use App\Enums\SshKeyStatus;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Server; use App\Models\Server;
use App\Models\SshKey; use App\Models\SshKey;
@ -34,20 +33,10 @@ public function handle(): void
$this->sshKey->servers()->updateExistingPivot($this->server->id, [ $this->sshKey->servers()->updateExistingPivot($this->server->id, [
'status' => SshKeyStatus::ADDED, 'status' => SshKeyStatus::ADDED,
]); ]);
event(
new Broadcast('deploy-ssh-key-finished', [
'sshKey' => $this->sshKey,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->server->sshKeys()->detach($this->sshKey); $this->server->sshKeys()->detach($this->sshKey);
event(
new Broadcast('deploy-ssh-key-failed', [
'sshKey' => $this->sshKey,
])
);
} }
} }

View File

@ -4,7 +4,6 @@
use App\Enums\SiteType; use App\Enums\SiteType;
use App\Enums\SslStatus; use App\Enums\SslStatus;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Ssl; use App\Models\Ssl;
@ -22,11 +21,6 @@ public function handle(): void
$this->ssl->site->server->webserver()->handler()->setupSSL($this->ssl); $this->ssl->site->server->webserver()->handler()->setupSSL($this->ssl);
$this->ssl->status = SslStatus::CREATED; $this->ssl->status = SslStatus::CREATED;
$this->ssl->save(); $this->ssl->save();
event(
new Broadcast('deploy-ssl-finished', [
'ssl' => $this->ssl,
])
);
if ($this->ssl->site->type == SiteType::WORDPRESS) { if ($this->ssl->site->type == SiteType::WORDPRESS) {
$typeData = $this->ssl->site->type_data; $typeData = $this->ssl->site->type_data;
$typeData['url'] = $this->ssl->site->url; $typeData['url'] = $this->ssl->site->url;
@ -38,11 +32,6 @@ public function handle(): void
public function failed(): void public function failed(): void
{ {
event(
new Broadcast('deploy-ssl-failed', [
'ssl' => $this->ssl,
])
);
$this->ssl->delete(); $this->ssl->delete();
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Jobs\Ssl; namespace App\Jobs\Ssl;
use App\Events\Broadcast;
use App\Jobs\Job; use App\Jobs\Job;
use App\Models\Ssl; use App\Models\Ssl;
@ -19,21 +18,11 @@ public function handle(): void
{ {
$this->ssl->site->server->webserver()->handler()->removeSSL($this->ssl); $this->ssl->site->server->webserver()->handler()->removeSSL($this->ssl);
$this->ssl->delete(); $this->ssl->delete();
event(
new Broadcast('remove-ssl-finished', [
'ssl' => $this->ssl,
])
);
} }
public function failed(): void public function failed(): void
{ {
$this->ssl->status = 'failed'; $this->ssl->status = 'failed';
$this->ssl->save(); $this->ssl->save();
event(
new Broadcast('remove-ssl-failed', [
'ssl' => $this->ssl,
])
);
} }
} }

View File

@ -1,21 +0,0 @@
<?php
namespace App\Listeners;
use App\Events\Broadcast;
use Illuminate\Support\Facades\Cache;
class BroadcastListener
{
public function __construct()
{
}
public function handle(Broadcast $event): void
{
Cache::put('broadcast', [
'type' => $event->type,
'data' => $event->data,
], now()->addMinutes(5));
}
}

View File

@ -7,7 +7,6 @@
use App\Contracts\ProcessManager; use App\Contracts\ProcessManager;
use App\Contracts\Webserver; use App\Contracts\Webserver;
use App\Enums\ServiceStatus; use App\Enums\ServiceStatus;
use App\Events\Broadcast;
use App\Exceptions\InstallationFailed; use App\Exceptions\InstallationFailed;
use App\Jobs\Service\Manage; use App\Jobs\Service\Manage;
use App\ServiceHandlers\PHP; use App\ServiceHandlers\PHP;
@ -96,20 +95,7 @@ public function install(): void
{ {
Bus::chain([ Bus::chain([
$this->installer(), $this->installer(),
function () { ])->onConnection('ssh-long')->dispatch();
event(
new Broadcast('install-service-finished', [
'service' => $this,
])
);
},
])->catch(function () {
event(
new Broadcast('install-service-failed', [
'service' => $this,
])
);
})->onConnection('ssh-long')->dispatch();
} }
/** /**
@ -117,18 +103,7 @@ function () {
*/ */
public function validateInstall($result): void public function validateInstall($result): void
{ {
if (Str::contains($result, 'Active: active')) { if (! Str::contains($result, 'Active: active')) {
event(
new Broadcast('install-service-finished', [
'service' => $this,
])
);
} else {
event(
new Broadcast('install-service-failed', [
'service' => $this,
])
);
throw new InstallationFailed(); throw new InstallationFailed();
} }
} }
@ -140,21 +115,11 @@ public function uninstall(): void
Bus::chain([ Bus::chain([
$this->uninstaller(), $this->uninstaller(),
function () { function () {
event(
new Broadcast('uninstall-service-finished', [
'service' => $this,
])
);
$this->delete(); $this->delete();
}, },
])->catch(function () { ])->catch(function () {
$this->status = ServiceStatus::FAILED; $this->status = ServiceStatus::FAILED;
$this->save(); $this->save();
event(
new Broadcast('uninstall-service-failed', [
'service' => $this,
])
);
})->onConnection('ssh')->dispatch(); })->onConnection('ssh')->dispatch();
} }

View File

@ -6,7 +6,6 @@
use App\Enums\DeploymentStatus; use App\Enums\DeploymentStatus;
use App\Enums\SiteStatus; use App\Enums\SiteStatus;
use App\Enums\SslStatus; use App\Enums\SslStatus;
use App\Events\Broadcast;
use App\Exceptions\SourceControlIsNotConnected; use App\Exceptions\SourceControlIsNotConnected;
use App\Facades\Notifier; use App\Facades\Notifier;
use App\Jobs\Site\Deploy; use App\Jobs\Site\Deploy;
@ -399,11 +398,6 @@ public function installationFinished(): void
'status' => SiteStatus::READY, 'status' => SiteStatus::READY,
'progress' => 100, 'progress' => 100,
]); ]);
event(
new Broadcast('install-site-finished', [
'site' => $this,
])
);
Notifier::send($this, new SiteInstallationSucceed($this)); Notifier::send($this, new SiteInstallationSucceed($this));
} }
@ -415,11 +409,6 @@ public function installationFailed(Throwable $e): void
$this->update([ $this->update([
'status' => SiteStatus::INSTALLATION_FAILED, 'status' => SiteStatus::INSTALLATION_FAILED,
]); ]);
event(
new Broadcast('install-site-failed', [
'site' => $this,
])
);
Notifier::send($this, new SiteInstallationFailed($this)); Notifier::send($this, new SiteInstallationFailed($this));
Log::error('install-site-error', [ Log::error('install-site-error', [
'error' => (string) $e, 'error' => (string) $e,

View File

@ -1,19 +0,0 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@ -2,8 +2,6 @@
namespace App\Providers; namespace App\Providers;
use App\Events\Broadcast;
use App\Listeners\BroadcastListener;
use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
@ -19,9 +17,6 @@ class EventServiceProvider extends ServiceProvider
Registered::class => [ Registered::class => [
SendEmailVerificationNotification::class, SendEmailVerificationNotification::class,
], ],
Broadcast::class => [
BroadcastListener::class,
],
]; ];
/** /**

View File

@ -3,7 +3,6 @@
namespace App\ServerTypes; namespace App\ServerTypes;
use App\Contracts\ServerType; use App\Contracts\ServerType;
use App\Events\Broadcast;
use App\Models\Server; use App\Models\Server;
use Closure; use Closure;
@ -22,11 +21,6 @@ protected function progress(int $percentage, ?string $step = null): Closure
$this->server->progress = $percentage; $this->server->progress = $percentage;
$this->server->progress_step = $step; $this->server->progress_step = $step;
$this->server->save(); $this->server->save();
event(new Broadcast('server-installation-progress', [
'server' => $this->server,
'step' => $step,
'percentage' => $percentage,
]));
}; };
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\ServerTypes; namespace App\ServerTypes;
use App\Events\Broadcast;
use App\Facades\Notifier; use App\Facades\Notifier;
use App\Jobs\Installation\Initialize; use App\Jobs\Installation\Initialize;
use App\Jobs\Installation\InstallRequirements; use App\Jobs\Installation\InstallRequirements;
@ -64,11 +63,6 @@ public function install(): void
'status' => 'ready', 'status' => 'ready',
'progress' => 100, 'progress' => 100,
]); ]);
event(
new Broadcast('install-server-finished', [
'server' => $this->server,
])
);
Notifier::send($this->server, new ServerInstallationSucceed($this->server)); Notifier::send($this->server, new ServerInstallationSucceed($this->server));
}; };
@ -77,11 +71,6 @@ public function install(): void
$this->server->update([ $this->server->update([
'status' => 'installation_failed', 'status' => 'installation_failed',
]); ]);
event(
new Broadcast('install-server-failed', [
'server' => $this->server,
])
);
Notifier::send($this->server, new ServerInstallationFailed($this->server)); Notifier::send($this->server, new ServerInstallationFailed($this->server));
Log::error('server-installation-error', [ Log::error('server-installation-error', [
'error' => (string) $e, 'error' => (string) $e,

View File

@ -3,7 +3,6 @@
namespace App\ServerTypes; namespace App\ServerTypes;
use App\Enums\ServerStatus; use App\Enums\ServerStatus;
use App\Events\Broadcast;
use App\Facades\Notifier; use App\Facades\Notifier;
use App\Jobs\Installation\Initialize; use App\Jobs\Installation\Initialize;
use App\Jobs\Installation\InstallCertbot; use App\Jobs\Installation\InstallCertbot;
@ -86,11 +85,6 @@ public function install(): void
'status' => ServerStatus::READY, 'status' => ServerStatus::READY,
'progress' => 100, 'progress' => 100,
]); ]);
event(
new Broadcast('install-server-finished', [
'server' => $this->server,
])
);
Notifier::send($this->server, new ServerInstallationSucceed($this->server)); Notifier::send($this->server, new ServerInstallationSucceed($this->server));
}; };
@ -99,11 +93,6 @@ public function install(): void
$this->server->update([ $this->server->update([
'status' => 'installation_failed', 'status' => 'installation_failed',
]); ]);
event(
new Broadcast('install-server-failed', [
'server' => $this->server,
])
);
Notifier::send($this->server, new ServerInstallationFailed($this->server)); Notifier::send($this->server, new ServerInstallationFailed($this->server));
Log::error('server-installation-error', [ Log::error('server-installation-error', [
'error' => (string) $e, 'error' => (string) $e,

View File

@ -3,7 +3,6 @@
namespace App\SiteTypes; namespace App\SiteTypes;
use App\Contracts\SiteType; use App\Contracts\SiteType;
use App\Events\Broadcast;
use App\Jobs\Site\DeleteSite; use App\Jobs\Site\DeleteSite;
use App\Models\Site; use App\Models\Site;
use Closure; use Closure;
@ -27,12 +26,6 @@ protected function progress(int $percentage): Closure
return function () use ($percentage) { return function () use ($percentage) {
$this->site->progress = $percentage; $this->site->progress = $percentage;
$this->site->save(); $this->site->save();
event(
new Broadcast('site-installation-progress', [
'site' => $this->site,
'percentage' => $percentage,
])
);
}; };
} }
} }

View File

@ -192,7 +192,6 @@
*/ */
App\Providers\AppServiceProvider::class, App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class, App\Providers\AuthServiceProvider::class,
App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
], ],

View File

@ -1,70 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

View File

@ -10,28 +10,6 @@ window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });
import toastr from 'toastr'; import toastr from 'toastr';
window.toastr = toastr; window.toastr = toastr;

View File

@ -1,8 +0,0 @@
<?php
use App\Models\User;
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('app', function (User $user) {
return $user && $user->id;
});