Fix styling

This commit is contained in:
Thijmen
2024-06-10 20:43:34 +00:00
committed by github-actions[bot]
parent 41fb6a1fc9
commit d86274cc37
429 changed files with 5307 additions and 2831 deletions

View File

@@ -3,18 +3,23 @@
namespace App\Livewire\Server\Proxy;
use App\Models\Server;
use Illuminate\Routing\Route;
use Livewire\Component;
use Symfony\Component\Yaml\Yaml;
class NewDynamicConfiguration extends Component
{
public string $fileName = '';
public string $value = '';
public bool $newFile = false;
public Server $server;
public $server_id;
public $parameters = [];
public function mount()
{
$this->parameters = get_route_parameters();
@@ -22,6 +27,7 @@ class NewDynamicConfiguration extends Component
$this->fileName = str_replace('|', '.', $this->fileName);
}
}
public function addDynamicConfiguration()
{
try {
@@ -32,7 +38,7 @@ class NewDynamicConfiguration extends Component
if (data_get($this->parameters, 'server_uuid')) {
$this->server = Server::ownedByCurrentTeam()->whereUuid(data_get($this->parameters, 'server_uuid'))->first();
}
if (!is_null($this->server_id)) {
if (! is_null($this->server_id)) {
$this->server = Server::ownedByCurrentTeam()->whereId($this->server_id)->first();
}
if (is_null($this->server)) {
@@ -40,15 +46,16 @@ class NewDynamicConfiguration extends Component
}
$proxy_type = $this->server->proxyType();
if ($proxy_type === 'TRAEFIK_V2') {
if (!str($this->fileName)->endsWith('.yaml') && !str($this->fileName)->endsWith('.yml')) {
if (! str($this->fileName)->endsWith('.yaml') && ! str($this->fileName)->endsWith('.yml')) {
$this->fileName = "{$this->fileName}.yaml";
}
if ($this->fileName === 'coolify.yaml') {
$this->dispatch('error', 'File name is reserved.');
return;
}
} else if ($proxy_type === 'CADDY') {
if (!str($this->fileName)->endsWith('.caddy')) {
} elseif ($proxy_type === 'CADDY') {
if (! str($this->fileName)->endsWith('.caddy')) {
$this->fileName = "{$this->fileName}.caddy";
}
}
@@ -58,6 +65,7 @@ class NewDynamicConfiguration extends Component
$exists = instant_remote_process(["test -f $file && echo 1 || echo 0"], $this->server);
if ($exists == 1) {
$this->dispatch('error', 'File already exists');
return;
}
}
@@ -80,6 +88,7 @@ class NewDynamicConfiguration extends Component
return handleError($e, $this);
}
}
public function render()
{
return view('livewire.server.proxy.new-dynamic-configuration');