Skip to content

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.

fix: bypass port validation when saving advanced checkboxes

Andras Bacsaiabb568c6003c
diff --git a/app/Livewire/Project/Service/ServiceApplicationView.php b/app/Livewire/Project/Service/ServiceApplicationView.php
index 259b9dbeca..68544f1abf 100644
--- a/app/Livewire/Project/Service/ServiceApplicationView.php
+++ b/app/Livewire/Project/Service/ServiceApplicationView.php
@@ -82,6 +82,21 @@ class ServiceApplicationView extends Component
}
}
+ public function instantSaveSettings()
+ {
+ try {
+ $this->authorize('update', $this->application);
+ // Save checkbox states without port validation
+ $this->application->is_gzip_enabled = $this->isGzipEnabled;
+ $this->application->is_stripprefix_enabled = $this->isStripprefixEnabled;
+ $this->application->exclude_from_status = $this->excludeFromStatus;
+ $this->application->save();
+ $this->dispatch('success', 'Settings saved.');
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
+ }
+ }
+
public function instantSaveAdvanced()
{
try {
diff --git a/resources/views/livewire/project/service/service-application-view.blade.php b/resources/views/livewire/project/service/service-application-view.blade.php
index 5fb4a62d0c..f04e33817f 100644
--- a/resources/views/livewire/project/service/service-application-view.blade.php
+++ b/resources/views/livewire/project/service/service-application-view.blade.php
@@ -56,18 +56,18 @@
<h3 class="py-2 pt-4">Advanced</h3>
<div class="w-96 flex flex-col gap-1">
@if (str($application->image)->contains('pocketbase'))
- <x-forms.checkbox canGate="update" :canResource="$application" instantSave id="isGzipEnabled"
+ <x-forms.checkbox canGate="update" :canResource="$application" instantSave="instantSaveSettings" id="isGzipEnabled"
label="Enable Gzip Compression"
helper="Pocketbase does not need gzip compression, otherwise SSE will not work." disabled />
@else
- <x-forms.checkbox canGate="update" :canResource="$application" instantSave id="isGzipEnabled"
+ <x-forms.checkbox canGate="update" :canResource="$application" instantSave="instantSaveSettings" id="isGzipEnabled"
label="Enable Gzip Compression"
helper="You can disable gzip compression if you want. Some services are compressing data by default. In this case, you do not need this." />
@endif
- <x-forms.checkbox canGate="update" :canResource="$application" instantSave id="isStripprefixEnabled"
+ <x-forms.checkbox canGate="update" :canResource="$application" instantSave="instantSaveSettings" id="isStripprefixEnabled"
label="Strip Prefixes"
helper="Strip Prefix is used to remove prefixes from paths. Like /api/ to /api." />
- <x-forms.checkbox canGate="update" :canResource="$application" instantSave label="Exclude from service status"
+ <x-forms.checkbox canGate="update" :canResource="$application" instantSave="instantSaveSettings" label="Exclude from service status"
helper="If you do not need to monitor this resource, enable. Useful if this service is optional."
id="excludeFromStatus"></x-forms.checkbox>
<x-forms.checkbox canGate="update" :canResource="$application"