fix: streamline proxy status handling in StartProxy and Navbar components

This commit is contained in:
Andras Bacsai 2025-10-10 10:41:58 +02:00
parent 9c152fd40a
commit bd88bbca5b
2 changed files with 6 additions and 4 deletions

View file

@ -19,6 +19,11 @@ public function handle(Server $server, bool $async = true, bool $force = false):
if ((is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop || $server->isBuildServer()) && $force === false) { if ((is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop || $server->isBuildServer()) && $force === false) {
return 'OK'; return 'OK';
} }
$server->proxy->set('status', 'starting');
$server->save();
$server->refresh();
ProxyStatusChangedUI::dispatch($server->team_id);
$commands = collect([]); $commands = collect([]);
$proxy_path = $server->proxyPath(); $proxy_path = $server->proxyPath();
$configuration = GetProxyConfiguration::run($server); $configuration = GetProxyConfiguration::run($server);
@ -64,14 +69,12 @@ public function handle(Server $server, bool $async = true, bool $force = false):
]); ]);
$commands = $commands->merge(connectProxyToNetworks($server)); $commands = $commands->merge(connectProxyToNetworks($server));
} }
$server->proxy->set('status', 'starting');
$server->save();
ProxyStatusChangedUI::dispatch($server->team_id);
if ($async) { if ($async) {
return remote_process($commands, $server, callEventOnFinish: 'ProxyStatusChanged', callEventData: $server->id); return remote_process($commands, $server, callEventOnFinish: 'ProxyStatusChanged', callEventData: $server->id);
} else { } else {
instant_remote_process($commands, $server); instant_remote_process($commands, $server);
$server->proxy->set('type', $proxyType); $server->proxy->set('type', $proxyType);
$server->save(); $server->save();
ProxyStatusChanged::dispatch($server->id); ProxyStatusChanged::dispatch($server->id);

View file

@ -120,7 +120,6 @@ public function showNotification()
{ {
$this->server->refresh(); $this->server->refresh();
$this->proxyStatus = $this->server->proxy->status ?? 'unknown'; $this->proxyStatus = $this->server->proxy->status ?? 'unknown';
$forceStop = $this->server->proxy->force_stop ?? false;
switch ($this->proxyStatus) { switch ($this->proxyStatus) {
case 'running': case 'running':