@if (count($avatar_storage_options) === 1)
diff --git a/tests/Feature/ProfileAvatarTest.php b/tests/Feature/ProfileAvatarTest.php
index 68ced553d..3512fccea 100644
--- a/tests/Feature/ProfileAvatarTest.php
+++ b/tests/Feature/ProfileAvatarTest.php
@@ -72,11 +72,14 @@
$this->withoutMiddleware()->actingAs($user)
->get(route('profile.avatar'))
->assertSuccessful()
- ->assertHeader('content-type', 'image/jpeg');
+ ->assertHeader('content-type', 'image/jpeg')
+ ->assertHeader('cache-control', 'immutable, max-age=31536000, private');
});
it('loads an S3 profile picture from the configured CDN', function () {
- config()->set('constants.coolify.avatar_cdn_url', 'https://avatars.example.com/media/');
+ InstanceSettings::findOrFail(0)->update([
+ 'image_cdn_url' => 'https://avatars.example.com/media',
+ ]);
Team::factory()->create(['id' => 0]);
$storage = S3Storage::query()->create([
'team_id' => 0,
@@ -98,7 +101,6 @@
});
it('loads an S3 profile picture directly from S3 when the CDN is not configured', function () {
- config()->set('constants.coolify.avatar_cdn_url');
Team::factory()->create(['id' => 0]);
$storage = S3Storage::query()->create([
'team_id' => 0,
@@ -120,7 +122,6 @@
});
it('does not use an unrelated S3 storage URL for a profile picture', function () {
- config()->set('constants.coolify.avatar_cdn_url', 'https://avatars.example.com');
$storage = S3Storage::query()->create([
'team_id' => Team::factory()->create()->id,
'name' => 'Unrelated storage',
diff --git a/tests/Feature/ProjectIconTest.php b/tests/Feature/ProjectIconTest.php
index fc03c9f30..99a6c0ac5 100644
--- a/tests/Feature/ProjectIconTest.php
+++ b/tests/Feature/ProjectIconTest.php
@@ -61,7 +61,8 @@
$this->withoutMiddleware()->get(route('project.icon', ['project_uuid' => $this->project->uuid]))
->assertSuccessful()
- ->assertHeader('content-type', 'image/jpeg');
+ ->assertHeader('content-type', 'image/jpeg')
+ ->assertHeader('cache-control', 'immutable, max-age=31536000, private');
$otherUser = User::factory()->create();
$otherTeam = Team::factory()->create();
@@ -104,7 +105,9 @@
});
it('loads an S3 project icon from the configured CDN', function () {
- config()->set('constants.coolify.avatar_cdn_url', 'https://avatars.example.com/media/');
+ InstanceSettings::findOrFail(0)->update([
+ 'image_cdn_url' => 'https://avatars.example.com/media',
+ ]);
Team::factory()->create(['id' => 0]);
$storage = S3Storage::query()->create([
'team_id' => 0,
@@ -127,7 +130,6 @@
});
it('loads an S3 project icon directly from S3 when the CDN is not configured', function () {
- config()->set('constants.coolify.avatar_cdn_url');
Team::factory()->create(['id' => 0]);
$storage = S3Storage::query()->create([
'team_id' => 0,
@@ -149,7 +151,6 @@
});
it('does not use an unusable S3 storage URL for a project icon', function () {
- config()->set('constants.coolify.avatar_cdn_url', 'https://avatars.example.com');
Team::factory()->create(['id' => 0]);
$storage = S3Storage::query()->create([
'team_id' => 0,
diff --git a/tests/Feature/SettingsAccessListboxTest.php b/tests/Feature/SettingsAccessListboxTest.php
index 4ec9dceb9..c1508bf73 100644
--- a/tests/Feature/SettingsAccessListboxTest.php
+++ b/tests/Feature/SettingsAccessListboxTest.php
@@ -29,6 +29,12 @@
->not->toContain('Two-step confirmations enabled');
});
+test('image storage fields use the standard settings field gap', function () {
+ $contents = file_get_contents(resource_path('views/livewire/settings/advanced.blade.php'));
+
+ expect($contents)->toContain('');
+});
+
test('instance admin can toggle registration via listbox instantSave', function () {
$rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);
Server::factory()->create(['id' => 0, 'team_id' => $rootTeam->id]);
@@ -82,6 +88,28 @@
expect((bool) $settings->fresh()->disable_two_step_confirmation)->toBeTrue();
});
+test('instance admin can configure the image CDN URL at runtime', function () {
+ $rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);
+ Server::factory()->create(['id' => 0, 'team_id' => $rootTeam->id]);
+ $settings = InstanceSettings::forceCreate(['id' => 0]);
+ Once::flush();
+
+ $user = User::factory()->create();
+ $rootTeam->members()->attach($user->id, ['role' => 'admin']);
+
+ $this->actingAs($user);
+ session(['currentTeam' => ['id' => $rootTeam->id]]);
+
+ Livewire::test(Advanced::class)
+ ->assertSee('Image CDN URL')
+ ->set('image_cdn_url', 'https://images.example.com/media/')
+ ->call('submit')
+ ->assertHasNoErrors()
+ ->assertDispatched('success');
+
+ expect($settings->fresh()->image_cdn_url)->toBe('https://images.example.com/media');
+});
+
test('open API allowlist warning is hidden when API access is disabled', function () {
$rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);
Server::factory()->create(['id' => 0, 'team_id' => $rootTeam->id]);