Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Fix: Use new function names and logic everywhere

peaklabs-dev451272bf11a7
diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php
index af05ad767d..0ded72d7e2 100644
--- a/app/Livewire/Boarding/Index.php
+++ b/app/Livewire/Boarding/Index.php
@@ -141,7 +141,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
if (! $this->createdServer) {
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');
} elseif ($this->selectedServerType === 'remote') {
@@ -175,7 +175,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
return;
}
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
- $this->serverPublicKey = $this->createdServer->privateKey->publicKey();
+ $this->serverPublicKey = $this->createdServer->privateKey->getPublicKey();
$this->updateServerDetails();
$this->currentState = 'validate-server';
}
diff --git a/app/Livewire/Security/PrivateKey/Show.php b/app/Livewire/Security/PrivateKey/Show.php
index d86bd5d1e0..68e44d4082 100644
--- a/app/Livewire/Security/PrivateKey/Show.php
+++ b/app/Livewire/Security/PrivateKey/Show.php
@@ -35,7 +35,7 @@ class Show extends Component
public function loadPublicKey()
{
- $this->public_key = $this->private_key->publicKey();
+ $this->public_key = $this->private_key->getPublicKey();
}
public function delete()
diff --git a/app/Livewire/Server/ShowPrivateKey.php b/app/Livewire/Server/ShowPrivateKey.php
index 578a089677..d5e20702d0 100644
--- a/app/Livewire/Server/ShowPrivateKey.php
+++ b/app/Livewire/Server/ShowPrivateKey.php
@@ -4,6 +4,7 @@ namespace App\Livewire\Server;
use App\Models\Server;
use Livewire\Component;
+use App\Models\PrivateKey;
class ShowPrivateKey extends Component
{
@@ -13,25 +14,22 @@ class ShowPrivateKey extends Component
public $parameters;
- public function setPrivateKey($newPrivateKeyId)
+ public function setPrivateKey($privateKeyId)
{
try {
- $oldPrivateKeyId = $this->server->private_key_id;
- refresh_server_connection($this->server->privateKey);
- $this->server->update([
- 'private_key_id' => $newPrivateKeyId,
+ $privateKey = PrivateKey::findOrFail($privateKeyId);
+ $this->server->update(['private_key_id' => $privateKeyId]);
+ $privateKey->storeInFileSystem();
+
+ $this->dispatch('notify', [
+ 'type' => 'success',
+ 'message' => 'Private key updated and stored in the file system.',
]);
- $this->server->refresh();
- refresh_server_connection($this->server->privateKey);
- $this->checkConnection();
- } catch (\Throwable $e) {
- $this->server->update([
- 'private_key_id' => $oldPrivateKeyId,
+ } catch (\Exception $e) {
+ $this->dispatch('notify', [
+ 'type' => 'error',
+ 'message' => 'Failed to update private key: ' . $e->getMessage(),
]);
- $this->server->refresh();
- refresh_server_connection($this->server->privateKey);
-
- return handleError($e, $this);
}
}