mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 23:54:44 +02:00
Add dns checking field
This commit is contained in:
parent
051b5d6bea
commit
cf13bfb1e4
@ -52,20 +52,48 @@ class CreateNode extends CreateRecord
|
|||||||
return 'You cannot connect to an IP Address over SSL';
|
return 'You cannot connect to an IP Address over SSL';
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!is_ip($state) && !empty($state) && !checkdnsrr("$state.", 'A')) {
|
|
||||||
// return 'Your hostname does not have a valid A record';
|
|
||||||
// }
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
|
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
|
||||||
|
$set('dns', null);
|
||||||
[$subdomain] = str($state)->explode('.', 2);
|
[$subdomain] = str($state)->explode('.', 2);
|
||||||
if (!is_numeric($subdomain)) {
|
if (!is_numeric($subdomain)) {
|
||||||
$set('name', $subdomain);
|
$set('name', $subdomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$state || is_ip($state)) {
|
||||||
|
$set('dns', null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$validRecord = checkdnsrr("$state.", 'A');
|
||||||
|
if ($validRecord) {
|
||||||
|
$set('dns', true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$set('dns', false);
|
||||||
})
|
})
|
||||||
->maxLength(191),
|
->maxLength(191),
|
||||||
|
|
||||||
|
Forms\Components\ToggleButtons::make('dns')
|
||||||
|
->label('DNS Record Check')
|
||||||
|
->helperText('This lets you know if your DNS record points to an IP Address.')
|
||||||
|
->disabled()
|
||||||
|
->inline()
|
||||||
|
->default(null)
|
||||||
|
// ->hidden()
|
||||||
|
->options([
|
||||||
|
true => 'Valid',
|
||||||
|
false => 'Invalid'
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
true => 'success',
|
||||||
|
false => 'danger'
|
||||||
|
]),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('daemonListen')
|
Forms\Components\TextInput::make('daemonListen')
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->label('Port')
|
->label('Port')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user