Skip to content

Commit ccf4e7d

Browse files
authored
Merge pull request coollabsio#3856 from coollabsio/next
v4.0.0-beta.359
2 parents b3f6a95 + f8aac31 commit ccf4e7d

File tree

16 files changed

+210
-198
lines changed

16 files changed

+210
-198
lines changed

app/Livewire/Project/Application/General.php

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Models\Application;
77
use Illuminate\Support\Collection;
88
use Livewire\Component;
9+
use Spatie\Url\Url;
910
use Visus\Cuid2\Cuid2;
1011

1112
class General extends Component
@@ -183,9 +184,7 @@ public function instantSave()
183184
$storage->save();
184185
});
185186
}
186-
187187
}
188-
189188
}
190189

191190
public function loadComposeFile($isInit = false)
@@ -242,23 +241,6 @@ public function updatedApplicationBaseDirectory()
242241
}
243242
}
244243

245-
public function updatedApplicationFqdn()
246-
{
247-
try {
248-
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
249-
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
250-
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
251-
return str($domain)->trim()->lower();
252-
});
253-
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
254-
$this->application->save();
255-
} catch (\Throwable $e) {
256-
$originalFqdn = $this->application->getOriginal('fqdn');
257-
$this->application->fqdn = $originalFqdn;
258-
return handleError($e, $this);
259-
}
260-
$this->resetDefaultLabels();
261-
}
262244

263245
public function updatedApplicationBuildPack()
264246
{
@@ -332,7 +314,7 @@ public function checkFqdns($showToaster = true)
332314
public function set_redirect()
333315
{
334316
try {
335-
$has_www = collect($this->application->fqdns)->filter(fn ($fqdn) => str($fqdn)->contains('www.'))->count();
317+
$has_www = collect($this->application->fqdns)->filter(fn($fqdn) => str($fqdn)->contains('www.'))->count();
336318
if ($has_www === 0 && $this->application->redirect === 'www') {
337319
$this->dispatch('error', 'You want to redirect to www, but you do not have a www domain set.<br><br>Please add www to your domain list and as an A DNS record (if applicable).');
338320

@@ -349,15 +331,18 @@ public function set_redirect()
349331
public function submit($showToaster = true)
350332
{
351333
try {
352-
if ($this->application->isDirty('redirect')) {
353-
$this->set_redirect();
354-
}
355334
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
356335
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
357336
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
337+
Url::fromString($domain, ['http', 'https']);
358338
return str($domain)->trim()->lower();
359339
});
360340
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
341+
$this->resetDefaultLabels();
342+
343+
if ($this->application->isDirty('redirect')) {
344+
$this->set_redirect();
345+
}
361346

362347
$this->checkFqdns();
363348

@@ -420,6 +405,10 @@ public function submit($showToaster = true)
420405
$this->application->save();
421406
$showToaster && $this->dispatch('success', 'Application settings updated!');
422407
} catch (\Throwable $e) {
408+
$originalFqdn = $this->application->getOriginal('fqdn');
409+
if ($originalFqdn !== $this->application->fqdn) {
410+
$this->application->fqdn = $originalFqdn;
411+
}
423412
return handleError($e, $this);
424413
} finally {
425414
$this->dispatch('configurationChanged');

app/Livewire/Project/Application/Preview/Form.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ public function resetToDefault()
3131
public function generate_real_url()
3232
{
3333
if (data_get($this->application, 'fqdn')) {
34-
$firstFqdn = str($this->application->fqdn)->before(',');
35-
$url = Url::fromString($firstFqdn);
36-
$host = $url->getHost();
37-
$this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);
34+
try {
35+
$firstFqdn = str($this->application->fqdn)->before(',');
36+
$url = Url::fromString($firstFqdn);
37+
$host = $url->getHost();
38+
$this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);
39+
} catch (\Exception $e) {
40+
$this->dispatch('error', 'Invalid FQDN.');
41+
}
3842
}
3943
}
4044

app/Livewire/Project/Service/EditDomain.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Models\ServiceApplication;
66
use Livewire\Component;
7+
use Spatie\Url\Url;
78

89
class EditDomain extends Component
910
{
@@ -20,25 +21,16 @@ public function mount()
2021
{
2122
$this->application = ServiceApplication::find($this->applicationId);
2223
}
23-
24-
public function updatedApplicationFqdn()
24+
public function submit()
2525
{
2626
try {
2727
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
2828
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
2929
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
30+
Url::fromString($domain, ['http', 'https']);
3031
return str($domain)->trim()->lower();
3132
});
3233
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
33-
$this->application->save();
34-
} catch(\Throwable $e) {
35-
return handleError($e, $this);
36-
}
37-
}
38-
39-
public function submit()
40-
{
41-
try {
4234
check_domain_usage(resource: $this->application);
4335
$this->validate();
4436
$this->application->save();
@@ -48,12 +40,15 @@ public function submit()
4840
} else {
4941
$this->dispatch('success', 'Service saved.');
5042
}
51-
} catch (\Throwable $e) {
52-
return handleError($e, $this);
53-
} finally {
5443
$this->application->service->parse();
5544
$this->dispatch('refresh');
5645
$this->dispatch('configurationChanged');
46+
} catch (\Throwable $e) {
47+
$originalFqdn = $this->application->getOriginal('fqdn');
48+
if ($originalFqdn !== $this->application->fqdn) {
49+
$this->application->fqdn = $originalFqdn;
50+
}
51+
return handleError($e, $this);
5752
}
5853
}
5954

app/Livewire/Project/Service/ServiceApplicationView.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Facades\Auth;
77
use Illuminate\Support\Facades\Hash;
88
use Livewire\Component;
9+
use Spatie\Url\Url;
910

1011
class ServiceApplicationView extends Component
1112
{
@@ -31,13 +32,7 @@ class ServiceApplicationView extends Component
3132

3233
public function updatedApplicationFqdn()
3334
{
34-
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
35-
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
36-
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
37-
return str($domain)->trim()->lower();
38-
});
39-
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
40-
$this->application->save();
35+
4136
}
4237

4338
public function instantSave()
@@ -83,6 +78,14 @@ public function mount()
8378
public function submit()
8479
{
8580
try {
81+
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
82+
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
83+
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
84+
Url::fromString($domain, ['http', 'https']);
85+
return str($domain)->trim()->lower();
86+
});
87+
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
88+
8689
check_domain_usage(resource: $this->application);
8790
$this->validate();
8891
$this->application->save();
@@ -92,10 +95,13 @@ public function submit()
9295
} else {
9396
$this->dispatch('success', 'Service saved.');
9497
}
98+
$this->dispatch('generateDockerCompose');
9599
} catch (\Throwable $e) {
100+
$originalFqdn = $this->application->getOriginal('fqdn');
101+
if ($originalFqdn !== $this->application->fqdn) {
102+
$this->application->fqdn = $originalFqdn;
103+
}
96104
return handleError($e, $this);
97-
} finally {
98-
$this->dispatch('generateDockerCompose');
99105
}
100106
}
101107

app/Models/Server.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,13 @@ public function setupDefault404Redirect()
209209
1 => 'https',
210210
],
211211
'service' => 'noop',
212-
'rule' => 'HostRegexp(`{catchall:.*}`)',
212+
'rule' => 'HostRegexp(`.+`)',
213+
'tls' => [
214+
'certResolver' => 'letsencrypt',
215+
],
213216
'priority' => 1,
214217
'middlewares' => [
215-
0 => 'redirect-regexp@file',
218+
0 => 'redirect-regexp',
216219
],
217220
],
218221
],

bootstrap/helpers/proxy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ function generate_default_proxy_configuration(Server $server)
164164
'ports' => [
165165
'80:80',
166166
'443:443',
167+
'443:443/udp',
167168
'8080:8080',
168169
],
169170
'healthcheck' => [
@@ -187,6 +188,7 @@ function generate_default_proxy_configuration(Server $server)
187188
'--entryPoints.http.http2.maxConcurrentStreams=50',
188189
'--entrypoints.https.http.encodequerysemicolons=true',
189190
'--entryPoints.https.http2.maxConcurrentStreams=50',
191+
'--entrypoints.https.http3',
190192
'--providers.docker.exposedbydefault=false',
191193
'--providers.file.directory=/traefik/dynamic/',
192194
'--providers.file.watch=true',

bootstrap/helpers/shared.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3896,6 +3896,8 @@ function isAssociativeArray($array)
38963896
*/
38973897
function add_coolify_default_environment_variables(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|Application|Service $resource, Collection &$where_to_add, ?Collection $where_to_check = null)
38983898
{
3899+
// Currently disabled
3900+
return;
38993901
if ($resource instanceof Service) {
39003902
$ip = $resource->server->ip;
39013903
} else {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"lcobucci/jwt": "^5.0.0",
2525
"league/flysystem-aws-s3-v3": "^3.0",
2626
"league/flysystem-sftp-v3": "^3.0",
27-
"livewire/livewire": "3.4.9",
27+
"livewire/livewire": "3.5.2",
2828
"log1x/laravel-webfonts": "^1.0",
2929
"lorisleiva/laravel-actions": "^2.7",
3030
"nubs/random-name-generator": "^2.2",

0 commit comments

Comments
 (0)