diff --git a/app/Console/Commands/ResourcesDelete.php b/app/Console/Commands/ResourcesDelete.php index c9ad0f0e9..56e680642 100644 --- a/app/Console/Commands/ResourcesDelete.php +++ b/app/Console/Commands/ResourcesDelete.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\Models\Application; +use App\Models\Server; use App\Models\Service; use App\Models\StandalonePostgresql; use Illuminate\Console\Command; @@ -34,7 +35,7 @@ public function handle() { $resource = select( 'What resource do you want to delete?', - ['Application', 'Database', 'Service'], + ['Application', 'Database', 'Service', 'Server'], ); if ($resource === 'Application') { $this->deleteApplication(); @@ -42,6 +43,29 @@ public function handle() $this->deleteDatabase(); } elseif ($resource === 'Service') { $this->deleteService(); + } elseif($resource === 'Server') { + $this->deleteServer(); + } + } + private function deleteServer() { + $servers = Server::all(); + if ($servers->count() === 0) { + $this->error('There are no applications to delete.'); + return; + } + $serversToDelete = multiselect( + 'What server do you want to delete?', + $servers->pluck('id')->sort()->toArray(), + ); + + foreach ($serversToDelete as $server) { + $toDelete = $servers->where('id', $server)->first(); + $this->info($toDelete); + $confirmed = confirm("Are you sure you want to delete all selected resources?"); + if (!$confirmed) { + break; + } + $toDelete->delete(); } } private function deleteApplication() @@ -53,14 +77,16 @@ private function deleteApplication() } $applicationsToDelete = multiselect( 'What application do you want to delete?', - $applications->pluck('name')->toArray(), + $applications->pluck('name')->sort()->toArray(), ); - $confirmed = confirm("Are you sure you want to delete all selected resources?"); - if (!$confirmed) { - return; - } + foreach ($applicationsToDelete as $application) { $toDelete = $applications->where('name', $application)->first(); + $this->info($toDelete); + $confirmed = confirm("Are you sure you want to delete all selected resources? "); + if (!$confirmed) { + break; + } $toDelete->delete(); } } @@ -73,14 +99,16 @@ private function deleteDatabase() } $databasesToDelete = multiselect( 'What database do you want to delete?', - $databases->pluck('name')->toArray(), + $databases->pluck('name')->sort()->toArray(), ); - $confirmed = confirm("Are you sure you want to delete all selected resources?"); - if (!$confirmed) { - return; - } + foreach ($databasesToDelete as $database) { $toDelete = $databases->where('name', $database)->first(); + $this->info($toDelete); + $confirmed = confirm("Are you sure you want to delete all selected resources?"); + if (!$confirmed) { + return; + } $toDelete->delete(); } @@ -94,14 +122,16 @@ private function deleteService() } $servicesToDelete = multiselect( 'What service do you want to delete?', - $services->pluck('name')->toArray(), + $services->pluck('name')->sort()->toArray(), ); - $confirmed = confirm("Are you sure you want to delete all selected resources?"); - if (!$confirmed) { - return; - } + foreach ($servicesToDelete as $service) { $toDelete = $services->where('name', $service)->first(); + $this->info($toDelete); + $confirmed = confirm("Are you sure you want to delete all selected resources?"); + if (!$confirmed) { + return; + } $toDelete->delete(); } } diff --git a/app/Http/Middleware/DecideWhatToDoWithUser.php b/app/Http/Middleware/DecideWhatToDoWithUser.php index 70bb9dd6c..3fb9dfea7 100644 --- a/app/Http/Middleware/DecideWhatToDoWithUser.php +++ b/app/Http/Middleware/DecideWhatToDoWithUser.php @@ -12,6 +12,9 @@ class DecideWhatToDoWithUser public function handle(Request $request, Closure $next): Response { if (!auth()->user() || !isCloud() || isInstanceAdmin()) { + if (!isCloud() && showBoarding() && !in_array($request->path(), allowedPathsForBoardingAccounts())) { + return redirect('boarding'); + } return $next($request); } if (!auth()->user()->hasVerifiedEmail()) { diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 1ed74c750..c5c455472 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -53,7 +53,7 @@ public function handle() if ($serverUptimeCheckNumber >= $serverUptimeCheckNumberMax) { if ($this->server->unreachable_email_sent === false) { ray('Server unreachable, sending notification...'); - // $this->server->team->notify(new Unreachable($this->server)); + $this->server->team->notify(new Unreachable($this->server)); $this->server->update(['unreachable_email_sent' => true]); } $this->server->settings()->update([ @@ -85,7 +85,7 @@ public function handle() if (data_get($this->server, 'unreachable_email_sent') === true) { ray('Server is reachable again, sending notification...'); - // $this->server->team->notify(new Revived($this->server)); + $this->server->team->notify(new Revived($this->server)); $this->server->update(['unreachable_email_sent' => false]); } if ( diff --git a/app/Models/User.php b/app/Models/User.php index 970120079..c4275cd68 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -72,7 +72,7 @@ public function sendVerificationEmail() $mail->view('emails.email-verification', [ 'url' => $url, ]); - $mail->subject('Coolify Cloud: Verify your email.'); + $mail->subject('Coolify: Verify your email.'); send_user_an_email($mail, $this->email); } public function sendPasswordResetNotification($token): void diff --git a/config/sentry.php b/config/sentry.php index f5b1c39b0..4d651fe5a 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.77', + 'release' => '4.0.0-beta.78', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index b6e86f8a8..4c60b71fc 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Your subscription has been activated! Welcome onboard! @endif - -

Projects

- + @if ($projects->count() === 0 && $servers->count() === 0) + No resources found. Add your first server / private key here. + @endif + @if ($projects->count() > 0) +

Projects

+ @endif @if ($projects->count() === 1)
@else @@ -58,7 +61,9 @@
@endforeach -

Servers

+@if ($projects->count() > 0) +

Servers

+@endif @if ($servers->count() === 1)
@else diff --git a/routes/web.php b/routes/web.php index 1a9d5851c..54dc7582b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -73,6 +73,7 @@ Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) { $request->fulfill(); + send_internal_notification("User {$request->user()->name} verified their email address."); return redirect('/'); })->middleware(['auth'])->name('verify.verify'); diff --git a/versions.json b/versions.json index 73b22e7e8..3dd6f4777 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.36" }, "v4": { - "version": "4.0.0-beta.77" + "version": "4.0.0-beta.78" } } }