Fix: Use new function names and logic everywhere
This commit is contained in:
@@ -141,7 +141,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
if (! $this->createdServer) {
|
if (! $this->createdServer) {
|
||||||
return $this->dispatch('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
return $this->dispatch('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
||||||
}
|
}
|
||||||
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
|
$this->serverPublicKey = $this->createdServer->privateKey->getPublicKey();
|
||||||
|
|
||||||
return $this->validateServer('localhost');
|
return $this->validateServer('localhost');
|
||||||
} elseif ($this->selectedServerType === 'remote') {
|
} elseif ($this->selectedServerType === 'remote') {
|
||||||
@@ -175,7 +175,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
|
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
|
||||||
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
|
$this->serverPublicKey = $this->createdServer->privateKey->getPublicKey();
|
||||||
$this->updateServerDetails();
|
$this->updateServerDetails();
|
||||||
$this->currentState = 'validate-server';
|
$this->currentState = 'validate-server';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class Show extends Component
|
|||||||
|
|
||||||
public function loadPublicKey()
|
public function loadPublicKey()
|
||||||
{
|
{
|
||||||
$this->public_key = $this->private_key->publicKey();
|
$this->public_key = $this->private_key->getPublicKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Livewire\Server;
|
|||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use App\Models\PrivateKey;
|
||||||
|
|
||||||
class ShowPrivateKey extends Component
|
class ShowPrivateKey extends Component
|
||||||
{
|
{
|
||||||
@@ -13,25 +14,22 @@ class ShowPrivateKey extends Component
|
|||||||
|
|
||||||
public $parameters;
|
public $parameters;
|
||||||
|
|
||||||
public function setPrivateKey($newPrivateKeyId)
|
public function setPrivateKey($privateKeyId)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oldPrivateKeyId = $this->server->private_key_id;
|
$privateKey = PrivateKey::findOrFail($privateKeyId);
|
||||||
refresh_server_connection($this->server->privateKey);
|
$this->server->update(['private_key_id' => $privateKeyId]);
|
||||||
$this->server->update([
|
$privateKey->storeInFileSystem();
|
||||||
'private_key_id' => $newPrivateKeyId,
|
|
||||||
]);
|
|
||||||
$this->server->refresh();
|
|
||||||
refresh_server_connection($this->server->privateKey);
|
|
||||||
$this->checkConnection();
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->server->update([
|
|
||||||
'private_key_id' => $oldPrivateKeyId,
|
|
||||||
]);
|
|
||||||
$this->server->refresh();
|
|
||||||
refresh_server_connection($this->server->privateKey);
|
|
||||||
|
|
||||||
return handleError($e, $this);
|
$this->dispatch('notify', [
|
||||||
|
'type' => 'success',
|
||||||
|
'message' => 'Private key updated and stored in the file system.',
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->dispatch('notify', [
|
||||||
|
'type' => 'error',
|
||||||
|
'message' => 'Failed to update private key: ' . $e->getMessage(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user