temporary fix for proxy

This commit is contained in:
Andras Bacsai 2023-09-14 17:10:37 +02:00
parent e89868c692
commit c287276d0e
9 changed files with 35 additions and 17 deletions

View File

@ -16,10 +16,7 @@ public function __invoke(Server $server, bool $reset = false)
if ($reset || is_null($proxy_configuration)) {
$proxy_configuration = Str::of(generate_default_proxy_configuration($server))->trim()->value;
resolve(SaveConfigurationSync::class)($server, $proxy_configuration);
return $proxy_configuration;
}
return $proxy_configuration;
}
}

View File

@ -7,11 +7,12 @@
class SaveConfigurationSync
{
public function __invoke(Server $server, string $configuration)
public function __invoke(Server $server)
{
try {
$proxy_settings = resolve(CheckConfigurationSync::class)($server, true);
$proxy_path = get_proxy_path();
$docker_compose_yml_base64 = base64_encode($configuration);
$docker_compose_yml_base64 = base64_encode($proxy_settings);
$server->proxy->last_saved_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;
$server->save();

View File

@ -48,7 +48,7 @@ public function select_proxy($proxy_type)
public function submit()
{
try {
resolve(SaveConfigurationSync::class)($this->server, $this->proxy_settings);
resolve(SaveConfigurationSync::class)($this->server);
$this->server->proxy->redirect_url = $this->redirect_url;
$this->server->save();

View File

@ -22,7 +22,7 @@ public function startProxy()
$this->server->proxy->last_applied_settings &&
$this->server->proxy->last_saved_settings !== $this->server->proxy->last_applied_settings
) {
resolve(SaveConfigurationSync::class)($this->server, $this->proxy_settings);
resolve(SaveConfigurationSync::class)($this->server);
}
$activity = resolve(StartProxy::class)($this->server);

View File

@ -0,0 +1,16 @@
<?php
namespace App\Http\Livewire\Server\Proxy;
use App\Models\Server;
use Livewire\Component;
class Modal extends Component
{
public Server $server;
public function proxyStatusUpdated()
{
$this->emit('proxyStatusUpdated');
}
}

View File

@ -1,4 +1,5 @@
<div class="pb-6">
<livewire:server.proxy.modal :server="$server" />
<div class="flex items-center gap-2">
<h1>Server</h1>
@if ($server->settings->is_reachable)

View File

@ -1,16 +1,6 @@
<div>
@if ($server->isFunctional())
@if (data_get($server,'proxy.type'))
<x-modal submitWireAction="proxyStatusUpdated" modalId="startProxy">
<x-slot:modalBody>
<livewire:activity-monitor header="Proxy Startup Logs" />
</x-slot:modalBody>
<x-slot:modalSubmit>
<x-forms.button onclick="startProxy.close()" type="submit">
Close
</x-forms.button>
</x-slot:modalSubmit>
</x-modal>
<div x-init="$wire.loadProxyConfiguration">
@if ($selectedProxy === 'TRAEFIK_V2')
<form wire:submit.prevent='submit'>

View File

@ -0,0 +1,12 @@
<div>
<x-modal submitWireAction="proxyStatusUpdated" modalId="startProxy">
<x-slot:modalBody>
<livewire:activity-monitor header="Proxy Startup Logs" />
</x-slot:modalBody>
<x-slot:modalSubmit>
<x-forms.button onclick="startProxy.close()" type="submit">
Close
</x-forms.button>
</x-slot:modalSubmit>
</x-modal>
</div>

View File

@ -1,3 +1,4 @@
<div class="flex gap-2" x-init="$wire.getProxyStatus">
@if ($server->proxy->status === 'running')
<x-status.running text="Proxy Running" />