refactor(settings): streamline instance admin checks and initialization of settings in Livewire components

This commit is contained in:
Andras Bacsai
2025-07-03 15:50:53 +02:00
parent ca62f8dacc
commit e3e80744a7
3 changed files with 43 additions and 46 deletions

View File

@@ -44,7 +44,7 @@ class Advanced extends Component
{
if (! isInstanceAdmin()) {
return redirect()->route('dashboard');
} else {
}
$this->server = Server::findOrFail(0);
$this->settings = instanceSettings();
$this->custom_dns_servers = $this->settings->custom_dns_servers;
@@ -56,7 +56,6 @@ class Advanced extends Component
$this->disable_two_step_confirmation = $this->settings->disable_two_step_confirmation;
$this->is_sponsorship_popup_enabled = $this->settings->is_sponsorship_popup_enabled;
}
}
public function submit()
{

View File

@@ -44,7 +44,7 @@ class Index extends Component
{
if (! isInstanceAdmin()) {
return redirect()->route('dashboard');
} else {
}
$this->settings = instanceSettings();
$this->server = Server::findOrFail(0);
$this->fqdn = $this->settings->fqdn;
@@ -55,7 +55,6 @@ class Index extends Component
$this->public_ipv6 = $this->settings->public_ipv6;
$this->instance_timezone = $this->settings->instance_timezone;
}
}
#[Computed]
public function timezones(): array

View File

@@ -46,7 +46,7 @@ class SettingsBackup extends Component
{
if (! isInstanceAdmin()) {
return redirect()->route('dashboard');
} else {
}
$settings = instanceSettings();
$this->server = Server::findOrFail(0);
$this->database = StandalonePostgresql::whereName('coolify-db')->first();
@@ -72,7 +72,6 @@ class SettingsBackup extends Component
$this->settings = $settings;
$this->s3s = $s3s;
}
}
public function addCoolifyDatabase()
{