Merge branch 'next' into main

This commit is contained in:
Marvin von Rappard
2024-11-25 09:06:24 +01:00
committed by GitHub
112 changed files with 1597 additions and 1408 deletions

View File

@@ -218,10 +218,12 @@ class PrivateKey extends BaseModel
private static function fingerprintExists($fingerprint, $excludeId = null)
{
$query = self::where('fingerprint', $fingerprint);
$query = self::query()
->where('fingerprint', $fingerprint)
->where('id', '!=', $excludeId);
if (! is_null($excludeId)) {
$query->where('id', '!=', $excludeId);
if (currentTeam()) {
$query->where('team_id', currentTeam()->id);
}
return $query->exists();

View File

@@ -988,7 +988,7 @@ $schema://$host {
public function status(): bool
{
['uptime' => $uptime] = $this->validateConnection(false);
['uptime' => $uptime] = $this->validateConnection();
if ($uptime === false) {
foreach ($this->applications() as $application) {
$application->status = 'exited';
@@ -1051,18 +1051,14 @@ $schema://$host {
$this->team->notify(new Unreachable($this));
}
public function validateConnection(bool $isManualCheck = true, bool $justCheckingNewKey = false)
public function validateConnection(bool $justCheckingNewKey = false)
{
config()->set('constants.ssh.mux_enabled', ! $isManualCheck);
config()->set('constants.ssh.mux_enabled', false);
if ($this->skipServer()) {
return ['uptime' => false, 'error' => 'Server skipped.'];
}
try {
// Make sure the private key is stored
if ($this->privateKey) {
$this->privateKey->storeInFileSystem();
}
instant_remote_process(['ls /'], $this);
if ($this->settings->is_reachable === false) {
$this->settings->is_reachable = true;