Fix: remote servers with port and user

This commit is contained in:
peaklabs-dev 2024-09-10 17:29:53 +02:00
parent d74cfd09ce
commit d378bb94be
No known key found for this signature in database
2 changed files with 12 additions and 10 deletions

View file

@ -247,11 +247,12 @@ public function savePrivateKey()
public function saveServer()
{
$this->validate([
'remoteServerName' => 'required',
'remoteServerHost' => 'required',
'remoteServerName' => 'required|string',
'remoteServerHost' => 'required|string',
'remoteServerPort' => 'required|integer',
'remoteServerUser' => 'required',
'remoteServerUser' => 'required|string',
]);
$this->privateKey = formatPrivateKey($this->privateKey);
$foundServer = Server::whereIp($this->remoteServerHost)->first();
if ($foundServer) {
@ -379,8 +380,8 @@ public function saveAndValidateServer()
'name' => $this->remoteServerName,
'port' => $this->remoteServerPort,
'user' => $this->remoteServerUser,
'timezone' => 'UTC',
]);
'timezone' => 'UTC',
]);
$this->validateServer();
}

View file

@ -113,8 +113,13 @@ protected static function booted()
];
protected $fillable = [
'name',
'ip',
'port',
'user',
'description',
'private_key_id',
'team_id',
];
protected $guarded = [];
@ -148,11 +153,7 @@ public static function destinationsByServer(string $server_id)
public function settings()
{
return $this->hasOne(ServerSetting::class)->withDefault([
'force_disabled' => false,
'is_reachable' => false,
'is_usable' => false,
]);
return $this->hasOne(ServerSetting::class);
}
public function setupDefault404Redirect()