mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 18:01:37 +00:00
refactoring - remove unused code
This commit is contained in:
parent
cfc0645002
commit
9d705592da
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Models\Server;
|
||||
|
||||
class ContinueInstallation extends InstallationJob
|
||||
@ -29,11 +28,6 @@ public function handle(): void
|
||||
$this->server->update([
|
||||
'status' => 'installation_failed',
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-server-failed', [
|
||||
'server' => $this->server,
|
||||
])
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\PHP;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Exceptions\ProcessFailed;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Service;
|
||||
@ -40,19 +39,9 @@ public function handle(): void
|
||||
$typeData['extensions'][] = $this->name;
|
||||
$this->service->type_data = $typeData;
|
||||
$this->service->save();
|
||||
event(
|
||||
new Broadcast('install-php-extension-finished', [
|
||||
'service' => $this->service,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
event(
|
||||
new Broadcast('install-php-extension-failed', [
|
||||
'service' => $this->service,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Jobs\Queue;
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Queue;
|
||||
|
||||
@ -30,20 +29,10 @@ public function handle(): void
|
||||
);
|
||||
$this->worker->status = QueueStatus::RUNNING;
|
||||
$this->worker->save();
|
||||
event(
|
||||
new Broadcast('deploy-queue-finished', [
|
||||
'queue' => $this->worker,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->worker->delete();
|
||||
event(
|
||||
new Broadcast('deploy-queue-failed', [
|
||||
'queue' => $this->worker,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Queue;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Queue;
|
||||
|
||||
@ -18,20 +17,10 @@ public function __construct(Queue $worker)
|
||||
public function handle(): void
|
||||
{
|
||||
$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
|
||||
{
|
||||
event(
|
||||
new Broadcast('get-logs-failed', [
|
||||
'message' => __('Failed to download the logs!'),
|
||||
])
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Queue;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Queue;
|
||||
|
||||
@ -47,22 +46,11 @@ public function handle(): void
|
||||
}
|
||||
$this->worker->status = $this->successStatus;
|
||||
$this->worker->save();
|
||||
event(
|
||||
new Broadcast('manage-queue-finished', [
|
||||
'queue' => $this->worker,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->worker->status = $this->failStatus;
|
||||
$this->worker->save();
|
||||
event(
|
||||
new Broadcast('manage-queue-failed', [
|
||||
'message' => $this->failMessage,
|
||||
'queue' => $this->worker,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Jobs\Queue;
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
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->delete();
|
||||
event(
|
||||
new Broadcast('remove-queue-finished', [
|
||||
'id' => $this->worker->id,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->worker->status = QueueStatus::FAILED;
|
||||
$this->worker->save();
|
||||
event(
|
||||
new Broadcast('remove-queue-failed', [
|
||||
'message' => __('Failed to delete worker!'),
|
||||
'id' => $this->worker->id,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Redirect;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
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->status = 'ready';
|
||||
$this->redirect->save();
|
||||
event(
|
||||
new Broadcast('create-redirect-finished', [
|
||||
'redirect' => $this->redirect,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->redirect->status = 'failed';
|
||||
$this->redirect->delete();
|
||||
event(
|
||||
new Broadcast('create-redirect-failed', [
|
||||
'redirect' => $this->redirect,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Redirect;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Redirect;
|
||||
|
||||
@ -24,21 +23,11 @@ public function handle(): void
|
||||
->get();
|
||||
$this->redirect->site->server->webserver()->handler()->updateRedirects($this->redirect->site, $redirects);
|
||||
$this->redirect->delete();
|
||||
event(
|
||||
new Broadcast('delete-redirect-finished', [
|
||||
'id' => $this->redirect->id,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->redirect->status = 'failed';
|
||||
$this->redirect->save();
|
||||
event(
|
||||
new Broadcast('delete-redirect-failed', [
|
||||
'redirect' => $this->redirect,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Script;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Script;
|
||||
use App\Models\ScriptExecution;
|
||||
@ -41,21 +40,11 @@ public function handle(): void
|
||||
);
|
||||
$this->scriptExecution->finished_at = now();
|
||||
$this->scriptExecution->save();
|
||||
event(
|
||||
new Broadcast('execute-script-finished', [
|
||||
'execution' => $this->scriptExecution,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->scriptExecution->finished_at = now();
|
||||
$this->scriptExecution->save();
|
||||
event(
|
||||
new Broadcast('execute-script-failed', [
|
||||
'execution' => $this->scriptExecution,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Service;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\Service\RestartServiceCommand;
|
||||
@ -54,22 +53,11 @@ public function handle(): void
|
||||
);
|
||||
$this->service->status = $this->successStatus;
|
||||
$this->service->save();
|
||||
event(
|
||||
new Broadcast('update-service-finished', [
|
||||
'service' => $this->service,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->service->status = $this->failStatus;
|
||||
$this->service->save();
|
||||
event(
|
||||
new Broadcast('update-service-failed', [
|
||||
'message' => $this->service->name.' '.$this->failMessage,
|
||||
'service' => $this->service,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Jobs\Site;
|
||||
|
||||
use App\Enums\SiteStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Site;
|
||||
|
||||
@ -20,21 +19,11 @@ public function handle(): void
|
||||
{
|
||||
$this->site->server->webserver()->handler()->deleteSite($this->site);
|
||||
$this->site->delete();
|
||||
event(
|
||||
new Broadcast('delete-site-finished', [
|
||||
'site' => $this->site,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->site->status = SiteStatus::READY;
|
||||
$this->site->save();
|
||||
event(
|
||||
new Broadcast('delete-site-failed', [
|
||||
'site' => $this->site,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Jobs\Site;
|
||||
|
||||
use App\Enums\DeploymentStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Deployment;
|
||||
use App\SSHCommands\System\RunScriptCommand;
|
||||
@ -39,11 +38,6 @@ public function handle(): void
|
||||
$this->deployment->status = DeploymentStatus::FINISHED;
|
||||
$this->deployment->log_id = $ssh->log->id;
|
||||
$this->deployment->save();
|
||||
event(
|
||||
new Broadcast('deploy-site-finished', [
|
||||
'deployment' => $this->deployment,
|
||||
])
|
||||
);
|
||||
} catch (Throwable) {
|
||||
$this->deployment->log_id = $ssh->log->id;
|
||||
$this->deployment->save();
|
||||
@ -55,10 +49,5 @@ public function failed(): void
|
||||
{
|
||||
$this->deployment->status = DeploymentStatus::FAILED;
|
||||
$this->deployment->save();
|
||||
event(
|
||||
new Broadcast('deploy-site-failed', [
|
||||
'deployment' => $this->deployment,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Site;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Site;
|
||||
use App\SSHCommands\System\EditFileCommand;
|
||||
@ -28,19 +27,9 @@ public function handle(): void
|
||||
$this->site->env
|
||||
)
|
||||
);
|
||||
event(
|
||||
new Broadcast('deploy-site-env-finished', [
|
||||
'site' => $this->site,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
event(
|
||||
new Broadcast('deploy-site-env-failed', [
|
||||
'site' => $this->site,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Site;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Site;
|
||||
use App\SSHCommands\Website\UpdateBranchCommand;
|
||||
@ -35,19 +34,9 @@ public function handle(): void
|
||||
);
|
||||
$this->site->branch = $this->branch;
|
||||
$this->site->save();
|
||||
event(
|
||||
new Broadcast('update-branch-finished', [
|
||||
'site' => $this->site,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
event(
|
||||
new Broadcast('update-branch-failed', [
|
||||
'site' => $this->site,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\SshKey;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Server;
|
||||
use App\Models\SshKey;
|
||||
@ -31,20 +30,10 @@ public function handle()
|
||||
'delete-ssh-key'
|
||||
);
|
||||
$this->server->sshKeys()->detach($this->sshKey);
|
||||
event(
|
||||
new Broadcast('delete-ssh-key-finished', [
|
||||
'sshKey' => $this->sshKey,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->server->sshKeys()->attach($this->sshKey);
|
||||
event(
|
||||
new Broadcast('delete-ssh-key-failed', [
|
||||
'sshKey' => $this->sshKey,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Jobs\SshKey;
|
||||
|
||||
use App\Enums\SshKeyStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Server;
|
||||
use App\Models\SshKey;
|
||||
@ -34,20 +33,10 @@ public function handle(): void
|
||||
$this->sshKey->servers()->updateExistingPivot($this->server->id, [
|
||||
'status' => SshKeyStatus::ADDED,
|
||||
]);
|
||||
event(
|
||||
new Broadcast('deploy-ssh-key-finished', [
|
||||
'sshKey' => $this->sshKey,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->server->sshKeys()->detach($this->sshKey);
|
||||
event(
|
||||
new Broadcast('deploy-ssh-key-failed', [
|
||||
'sshKey' => $this->sshKey,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
use App\Enums\SiteType;
|
||||
use App\Enums\SslStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Ssl;
|
||||
|
||||
@ -22,11 +21,6 @@ public function handle(): void
|
||||
$this->ssl->site->server->webserver()->handler()->setupSSL($this->ssl);
|
||||
$this->ssl->status = SslStatus::CREATED;
|
||||
$this->ssl->save();
|
||||
event(
|
||||
new Broadcast('deploy-ssl-finished', [
|
||||
'ssl' => $this->ssl,
|
||||
])
|
||||
);
|
||||
if ($this->ssl->site->type == SiteType::WORDPRESS) {
|
||||
$typeData = $this->ssl->site->type_data;
|
||||
$typeData['url'] = $this->ssl->site->url;
|
||||
@ -38,11 +32,6 @@ public function handle(): void
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
event(
|
||||
new Broadcast('deploy-ssl-failed', [
|
||||
'ssl' => $this->ssl,
|
||||
])
|
||||
);
|
||||
$this->ssl->delete();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs\Ssl;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Ssl;
|
||||
|
||||
@ -19,21 +18,11 @@ public function handle(): void
|
||||
{
|
||||
$this->ssl->site->server->webserver()->handler()->removeSSL($this->ssl);
|
||||
$this->ssl->delete();
|
||||
event(
|
||||
new Broadcast('remove-ssl-finished', [
|
||||
'ssl' => $this->ssl,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
$this->ssl->status = 'failed';
|
||||
$this->ssl->save();
|
||||
event(
|
||||
new Broadcast('remove-ssl-failed', [
|
||||
'ssl' => $this->ssl,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@
|
||||
use App\Contracts\ProcessManager;
|
||||
use App\Contracts\Webserver;
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Jobs\Service\Manage;
|
||||
use App\ServiceHandlers\PHP;
|
||||
@ -96,20 +95,7 @@ public function install(): void
|
||||
{
|
||||
Bus::chain([
|
||||
$this->installer(),
|
||||
function () {
|
||||
event(
|
||||
new Broadcast('install-service-finished', [
|
||||
'service' => $this,
|
||||
])
|
||||
);
|
||||
},
|
||||
])->catch(function () {
|
||||
event(
|
||||
new Broadcast('install-service-failed', [
|
||||
'service' => $this,
|
||||
])
|
||||
);
|
||||
})->onConnection('ssh-long')->dispatch();
|
||||
])->onConnection('ssh-long')->dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,18 +103,7 @@ function () {
|
||||
*/
|
||||
public function validateInstall($result): void
|
||||
{
|
||||
if (Str::contains($result, 'Active: active')) {
|
||||
event(
|
||||
new Broadcast('install-service-finished', [
|
||||
'service' => $this,
|
||||
])
|
||||
);
|
||||
} else {
|
||||
event(
|
||||
new Broadcast('install-service-failed', [
|
||||
'service' => $this,
|
||||
])
|
||||
);
|
||||
if (! Str::contains($result, 'Active: active')) {
|
||||
throw new InstallationFailed();
|
||||
}
|
||||
}
|
||||
@ -140,21 +115,11 @@ public function uninstall(): void
|
||||
Bus::chain([
|
||||
$this->uninstaller(),
|
||||
function () {
|
||||
event(
|
||||
new Broadcast('uninstall-service-finished', [
|
||||
'service' => $this,
|
||||
])
|
||||
);
|
||||
$this->delete();
|
||||
},
|
||||
])->catch(function () {
|
||||
$this->status = ServiceStatus::FAILED;
|
||||
$this->save();
|
||||
event(
|
||||
new Broadcast('uninstall-service-failed', [
|
||||
'service' => $this,
|
||||
])
|
||||
);
|
||||
})->onConnection('ssh')->dispatch();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
use App\Enums\DeploymentStatus;
|
||||
use App\Enums\SiteStatus;
|
||||
use App\Enums\SslStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Exceptions\SourceControlIsNotConnected;
|
||||
use App\Facades\Notifier;
|
||||
use App\Jobs\Site\Deploy;
|
||||
@ -399,11 +398,6 @@ public function installationFinished(): void
|
||||
'status' => SiteStatus::READY,
|
||||
'progress' => 100,
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-site-finished', [
|
||||
'site' => $this,
|
||||
])
|
||||
);
|
||||
Notifier::send($this, new SiteInstallationSucceed($this));
|
||||
}
|
||||
|
||||
@ -415,11 +409,6 @@ public function installationFailed(Throwable $e): void
|
||||
$this->update([
|
||||
'status' => SiteStatus::INSTALLATION_FAILED,
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-site-failed', [
|
||||
'site' => $this,
|
||||
])
|
||||
);
|
||||
Notifier::send($this, new SiteInstallationFailed($this));
|
||||
Log::error('install-site-error', [
|
||||
'error' => (string) $e,
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Listeners\BroadcastListener;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
@ -19,9 +17,6 @@ class EventServiceProvider extends ServiceProvider
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
Broadcast::class => [
|
||||
BroadcastListener::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\ServerTypes;
|
||||
|
||||
use App\Contracts\ServerType;
|
||||
use App\Events\Broadcast;
|
||||
use App\Models\Server;
|
||||
use Closure;
|
||||
|
||||
@ -22,11 +21,6 @@ protected function progress(int $percentage, ?string $step = null): Closure
|
||||
$this->server->progress = $percentage;
|
||||
$this->server->progress_step = $step;
|
||||
$this->server->save();
|
||||
event(new Broadcast('server-installation-progress', [
|
||||
'server' => $this->server,
|
||||
'step' => $step,
|
||||
'percentage' => $percentage,
|
||||
]));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\ServerTypes;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Facades\Notifier;
|
||||
use App\Jobs\Installation\Initialize;
|
||||
use App\Jobs\Installation\InstallRequirements;
|
||||
@ -64,11 +63,6 @@ public function install(): void
|
||||
'status' => 'ready',
|
||||
'progress' => 100,
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-server-finished', [
|
||||
'server' => $this->server,
|
||||
])
|
||||
);
|
||||
Notifier::send($this->server, new ServerInstallationSucceed($this->server));
|
||||
};
|
||||
|
||||
@ -77,11 +71,6 @@ public function install(): void
|
||||
$this->server->update([
|
||||
'status' => 'installation_failed',
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-server-failed', [
|
||||
'server' => $this->server,
|
||||
])
|
||||
);
|
||||
Notifier::send($this->server, new ServerInstallationFailed($this->server));
|
||||
Log::error('server-installation-error', [
|
||||
'error' => (string) $e,
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\ServerTypes;
|
||||
|
||||
use App\Enums\ServerStatus;
|
||||
use App\Events\Broadcast;
|
||||
use App\Facades\Notifier;
|
||||
use App\Jobs\Installation\Initialize;
|
||||
use App\Jobs\Installation\InstallCertbot;
|
||||
@ -86,11 +85,6 @@ public function install(): void
|
||||
'status' => ServerStatus::READY,
|
||||
'progress' => 100,
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-server-finished', [
|
||||
'server' => $this->server,
|
||||
])
|
||||
);
|
||||
Notifier::send($this->server, new ServerInstallationSucceed($this->server));
|
||||
};
|
||||
|
||||
@ -99,11 +93,6 @@ public function install(): void
|
||||
$this->server->update([
|
||||
'status' => 'installation_failed',
|
||||
]);
|
||||
event(
|
||||
new Broadcast('install-server-failed', [
|
||||
'server' => $this->server,
|
||||
])
|
||||
);
|
||||
Notifier::send($this->server, new ServerInstallationFailed($this->server));
|
||||
Log::error('server-installation-error', [
|
||||
'error' => (string) $e,
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\SiteTypes;
|
||||
|
||||
use App\Contracts\SiteType;
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Site\DeleteSite;
|
||||
use App\Models\Site;
|
||||
use Closure;
|
||||
@ -27,12 +26,6 @@ protected function progress(int $percentage): Closure
|
||||
return function () use ($percentage) {
|
||||
$this->site->progress = $percentage;
|
||||
$this->site->save();
|
||||
event(
|
||||
new Broadcast('site-installation-progress', [
|
||||
'site' => $this->site,
|
||||
'percentage' => $percentage,
|
||||
])
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,6 @@
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
],
|
||||
|
@ -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',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
22
resources/js/bootstrap.js
vendored
22
resources/js/bootstrap.js
vendored
@ -10,28 +10,6 @@ window.axios = axios;
|
||||
|
||||
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';
|
||||
|
||||
window.toastr = toastr;
|
||||
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
Broadcast::channel('app', function (User $user) {
|
||||
return $user && $user->id;
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user