An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fixes
Andras Bacsai6e094eaf42e5
diff --git a/app/Http/Livewire/Notifications/DiscordSettings.php b/app/Http/Livewire/Notifications/DiscordSettings.phpindex c503f7829f..a0c8016778 100644--- a/app/Http/Livewire/Notifications/DiscordSettings.php+++ b/app/Http/Livewire/Notifications/DiscordSettings.php@@ -13,11 +13,11 @@ class DiscordSettings extends Componentpublic Team|Server $model;protected $rules = [- 'model.smtp_attributes.discord_active' => 'nullable|boolean',- 'model.smtp_attributes.discord_webhook' => 'required|url',+ 'model.extra_attributes.discord_active' => 'nullable|boolean',+ 'model.extra_attributes.discord_webhook' => 'required|url',];protected $validationAttributes = [- 'model.smtp_attributes.discord_webhook' => 'Discord Webhook',+ 'model.extra_attributes.discord_webhook' => 'Discord Webhook',];public function mount($model){@@ -28,8 +28,8 @@ class DiscordSettings extends Componenttry {$this->submit();} catch (\Exception $e) {- $this->model->smtp_attributes->discord_active = false;- $this->addError('model.smtp_attributes.discord_webhook', $e->getMessage());+ $this->model->extra_attributes->discord_active = false;+ $this->validate();}}private function saveModel()diff --git a/app/Http/Livewire/Notifications/EmailSettings.php b/app/Http/Livewire/Notifications/EmailSettings.phpindex 96e6ac616b..aad1f6a9c6 100644--- a/app/Http/Livewire/Notifications/EmailSettings.php+++ b/app/Http/Livewire/Notifications/EmailSettings.php@@ -13,27 +13,27 @@ class EmailSettings extends Componentpublic Team|Server $model;protected $rules = [- 'model.smtp_attributes.smtp_active' => 'nullable|boolean',- 'model.smtp_attributes.from_address' => 'required',- 'model.smtp_attributes.from_name' => 'required',- 'model.smtp_attributes.recipients' => 'required',- 'model.smtp_attributes.smtp_host' => 'required',- 'model.smtp_attributes.smtp_port' => 'required',- 'model.smtp_attributes.smtp_encryption' => 'nullable',- 'model.smtp_attributes.smtp_username' => 'nullable',- 'model.smtp_attributes.smtp_password' => 'nullable',- 'model.smtp_attributes.smtp_timeout' => 'nullable',- 'model.smtp_attributes.test_address' => 'nullable',+ 'model.extra_attributes.smtp_active' => 'nullable|boolean',+ 'model.extra_attributes.from_address' => 'required|email',+ 'model.extra_attributes.from_name' => 'required',+ 'model.extra_attributes.recipients' => 'required',+ 'model.extra_attributes.smtp_host' => 'required',+ 'model.extra_attributes.smtp_port' => 'required',+ 'model.extra_attributes.smtp_encryption' => 'nullable',+ 'model.extra_attributes.smtp_username' => 'nullable',+ 'model.extra_attributes.smtp_password' => 'nullable',+ 'model.extra_attributes.smtp_timeout' => 'nullable',+ 'model.extra_attributes.test_notification_email' => 'nullable|email',];protected $validationAttributes = [- 'model.smtp_attributes.from_address' => 'From Address',- 'model.smtp_attributes.from_name' => 'From Name',- 'model.smtp_attributes.recipients' => 'Recipients',- 'model.smtp_attributes.smtp_host' => 'Host',- 'model.smtp_attributes.smtp_port' => 'Port',- 'model.smtp_attributes.smtp_encryption' => 'Encryption',- 'model.smtp_attributes.smtp_username' => 'Username',- 'model.smtp_attributes.smtp_password' => 'Password',+ 'model.extra_attributes.from_address' => 'From Address',+ 'model.extra_attributes.from_name' => 'From Name',+ 'model.extra_attributes.recipients' => 'Recipients',+ 'model.extra_attributes.smtp_host' => 'Host',+ 'model.extra_attributes.smtp_port' => 'Port',+ 'model.extra_attributes.smtp_encryption' => 'Encryption',+ 'model.extra_attributes.smtp_username' => 'Username',+ 'model.extra_attributes.smtp_password' => 'Password',];public function mount($model){@@ -54,6 +54,11 @@ class EmailSettings extends Component}public function instantSave(){- $this->saveModel();+ try {+ $this->submit();+ } catch (\Exception $e) {+ $this->model->extra_attributes->smtp_active = false;+ $this->validate();+ }}}diff --git a/app/Models/Server.php b/app/Models/Server.phpindex 4858f39a2b..c6c183ef7b 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -23,22 +23,16 @@ class Server extends BaseModel'team_id','private_key_id','extra_attributes',- 'smtp_attributes',];public $casts = ['extra_attributes' => SchemalessAttributes::class,- 'smtp_attributes' => SchemalessAttributes::class,];public function scopeWithExtraAttributes(): Builder{return $this->extra_attributes->modelScope();}- public function scopeWithSmtpAttributes(): Builder- {- return $this->smtp_attributes->modelScope();- }public function standaloneDockers(){diff --git a/app/Models/Team.php b/app/Models/Team.phpindex f43ae06869..9432e19afd 100644--- a/app/Models/Team.php+++ b/app/Models/Team.php@@ -13,30 +13,32 @@ class Team extends BaseModel implements SendsDiscord, SendsEmailuse Notifiable;protected $casts = [- 'smtp_attributes' => SchemalessAttributes::class,+ 'extra_attributes' => SchemalessAttributes::class,'personal_team' => 'boolean',];protected $fillable = ['id','name','personal_team',- 'smtp_attributes',+ 'extra_attributes',];public function routeNotificationForDiscord(){- return $this->smtp_attributes->get('discord_webhook');+ return $this->extra_attributes->get('discord_webhook');}-public function routeNotificationForEmail(string $attribute = 'recipients'){- $recipients = $this->smtp_attributes->get($attribute, '');- return explode(PHP_EOL, $recipients);+ $recipients = $this->extra_attributes->get($attribute, '');+ if (is_null($recipients) || $recipients === '') {+ return [];+ }+ return explode(',', $recipients);}public function scopeWithExtraAttributes(): Builder{- return $this->smtp_attributes->modelScope();+ return $this->extra_attributes->modelScope();}public function projects()diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.phpindex 25e0f59b76..9c6840b95a 100644--- a/app/Notifications/Channels/EmailChannel.php+++ b/app/Notifications/Channels/EmailChannel.php@@ -15,8 +15,8 @@ class EmailChannel{$this->bootConfigs($notifiable);if ($notification instanceof \App\Notifications\TestNotification) {- $bcc = $notifiable->routeNotificationForEmail('test_address');- if (count($bcc) === 1) {+ $bcc = $notifiable->routeNotificationForEmail('test_notification_email');+ if (count($bcc) === 0) {$bcc = $notifiable->routeNotificationForEmail();}} else {@@ -29,8 +29,8 @@ class EmailChannel[],fn (Message $message) => $message->from(- $notifiable->smtp_attributes?->get('from_address'),- $notifiable->smtp_attributes?->get('from_name')+ $notifiable->extra_attributes?->get('from_address'),+ $notifiable->extra_attributes?->get('from_name'))->cc($bcc)->bcc($bcc)@@ -44,12 +44,12 @@ class EmailChannelconfig()->set('mail.default', 'smtp');config()->set('mail.mailers.smtp', ["transport" => "smtp",- "host" => $notifiable->smtp_attributes?->get('smtp_host'),- "port" => $notifiable->smtp_attributes?->get('smtp_port'),- "encryption" => $notifiable->smtp_attributes?->get('smtp_encryption'),- "username" => $notifiable->smtp_attributes?->get('smtp_username'),- "password" => $notifiable->smtp_attributes?->get('smtp_password'),- "timeout" => $notifiable->smtp_attributes?->get('smtp_timeout'),+ "host" => $notifiable->extra_attributes?->get('smtp_host'),+ "port" => $notifiable->extra_attributes?->get('smtp_port'),+ "encryption" => $notifiable->extra_attributes?->get('smtp_encryption'),+ "username" => $notifiable->extra_attributes?->get('smtp_username'),+ "password" => $notifiable->extra_attributes?->get('smtp_password'),+ "timeout" => $notifiable->extra_attributes?->get('smtp_timeout'),"local_domain" => null,]);}diff --git a/app/Notifications/TestNotification.php b/app/Notifications/TestNotification.phpindex ce395f8282..d388635e76 100644--- a/app/Notifications/TestNotification.php+++ b/app/Notifications/TestNotification.php@@ -29,8 +29,8 @@ class TestNotification extends Notification implements ShouldQueuepublic function via(object $notifiable): array{$channels = [];- $notifiable->smtp_attributes?->get('smtp_active') && $channels[] = EmailChannel::class;- $notifiable->smtp_attributes?->get('discord_active') && $channels[] = DiscordChannel::class;+ $notifiable->extra_attributes?->get('smtp_active') && $channels[] = EmailChannel::class;+ $notifiable->extra_attributes?->get('discord_active') && $channels[] = DiscordChannel::class;return $channels;}diff --git a/database/migrations/2023_03_20_112811_create_teams_table.php b/database/migrations/2023_03_20_112811_create_teams_table.phpindex 8fff7314f3..4396c8db72 100644--- a/database/migrations/2023_03_20_112811_create_teams_table.php+++ b/database/migrations/2023_03_20_112811_create_teams_table.php@@ -16,7 +16,7 @@ return new class extends Migration$table->string('uuid')->unique();$table->string('name');$table->boolean('personal_team')->default(false);- $table->schemalessAttributes('smtp_attributes');+ $table->schemalessAttributes('extra_attributes');$table->timestamps();});}diff --git a/database/migrations/2023_03_24_140711_create_servers_table.php b/database/migrations/2023_03_24_140711_create_servers_table.phpindex ae0da4f360..84e2ab6ba8 100644--- a/database/migrations/2023_03_24_140711_create_servers_table.php+++ b/database/migrations/2023_03_24_140711_create_servers_table.php@@ -22,7 +22,6 @@ return new class extends Migration$table->foreignId('team_id');$table->foreignId('private_key_id');$table->schemalessAttributes('extra_attributes');- $table->schemalessAttributes('smtp_attributes');$table->timestamps();});}diff --git a/resources/views/livewire/notifications/discord-settings.blade.php b/resources/views/livewire/notifications/discord-settings.blade.phpindex 118c97a472..62c2ec69ad 100644--- a/resources/views/livewire/notifications/discord-settings.blade.php+++ b/resources/views/livewire/notifications/discord-settings.blade.php@@ -7,10 +7,10 @@</x-forms.button></div><div class="flex flex-col gap-2 xl:flex-row w-96">- <x-forms.checkbox instantSave id="model.smtp_attributes.discord_active" label="Notification Enabled" />+ <x-forms.checkbox instantSave id="model.extra_attributes.discord_active" label="Notification Enabled" /></div><div class="flex flex-col gap-2 xl:flex-row w-96">- <x-forms.input required id="model.smtp_attributes.discord_webhook" label="Webhook" />+ <x-forms.input required id="model.extra_attributes.discord_webhook" label="Webhook" /></div><div>diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.phpindex 6b593ac1cc..ac2bde6a1b 100644--- a/resources/views/livewire/notifications/email-settings.blade.php+++ b/resources/views/livewire/notifications/email-settings.blade.php@@ -7,28 +7,29 @@</x-forms.button></div><div class="flex flex-col w-96">- <x-forms.checkbox instantSave id="model.smtp_attributes.smtp_active" label="Notification Enabled" />+ <x-forms.checkbox instantSave id="model.extra_attributes.smtp_active" label="Notification Enabled" /></div>+ <x-forms.input id="model.extra_attributes.test_notification_email" label="Test Notification Email" /><div class="flex flex-col gap-2 xl:flex-row"><div class="flex flex-col w-96">- <x-forms.textarea required id="model.smtp_attributes.recipients" helper="E-mails, one per line"+ <x-forms.input required id="model.extra_attributes.recipients" helper="Emails separated by comma"label="Recipients" /></div></div><div class="flex flex-col gap-2 xl:flex-row"><div class="flex flex-col w-96">- <x-forms.input required id="model.smtp_attributes.smtp_host" label="Host" />- <x-forms.input required id="model.smtp_attributes.smtp_port" label="Port" />- <x-forms.input id="model.smtp_attributes.smtp_encryption" label="Encryption" />+ <x-forms.input required id="model.extra_attributes.smtp_host" label="Host" />+ <x-forms.input required id="model.extra_attributes.smtp_port" label="Port" />+ <x-forms.input id="model.extra_attributes.smtp_encryption" label="Encryption" /></div><div class="flex flex-col w-96">- <x-forms.input id="model.smtp_attributes.smtp_username" label="Username" />- <x-forms.input id="model.smtp_attributes.smtp_password" label="Password" />- <x-forms.input id="model.smtp_attributes.smtp_timeout" label="Timeout" />+ <x-forms.input id="model.extra_attributes.smtp_username" label="Username" />+ <x-forms.input id="model.extra_attributes.smtp_password" label="Password" />+ <x-forms.input id="model.extra_attributes.smtp_timeout" label="Timeout" /></div><div class="flex flex-col w-96">- <x-forms.input required id="model.smtp_attributes.from_address" label="From Address" />- <x-forms.input required id="model.smtp_attributes.from_name" label="From Name" />+ <x-forms.input required id="model.extra_attributes.from_address" label="From Address" />+ <x-forms.input required id="model.extra_attributes.from_name" label="From Name" /></div></div></form>