Add support for node management actions using new services
This commit is contained in:
parent
4391defb9f
commit
c1a078bdcf
33 changed files with 1375 additions and 745 deletions
|
@ -132,6 +132,7 @@ class DatabaseController extends Controller
|
|||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function update(DatabaseHostFormRequest $request, DatabaseHost $host)
|
||||
{
|
||||
|
|
|
@ -24,48 +24,112 @@
|
|||
|
||||
namespace Pterodactyl\Http\Controllers\Admin;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Cache\Repository as CacheRepository;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Log;
|
||||
use Alert;
|
||||
use Cache;
|
||||
use Javascript;
|
||||
use Pterodactyl\Models;
|
||||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\Admin\NodeFormRequest;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Repositories\NodeRepository;
|
||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||
use Pterodactyl\Services\Nodes\CreationService;
|
||||
use Pterodactyl\Services\Nodes\DeletionService;
|
||||
use Pterodactyl\Services\Nodes\UpdateService;
|
||||
|
||||
class NodesController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Prologue\Alerts\AlertsMessageBag
|
||||
*/
|
||||
protected $alert;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Cache\Repository
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Nodes\CreationService
|
||||
*/
|
||||
protected $creationService;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Nodes\DeletionService
|
||||
*/
|
||||
protected $deletionService;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface
|
||||
*/
|
||||
protected $locationRepository;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\NodeRepositoryInterface
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Translation\Translator
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Nodes\UpdateService
|
||||
*/
|
||||
protected $updateService;
|
||||
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
CacheRepository $cache,
|
||||
CreationService $creationService,
|
||||
DeletionService $deletionService,
|
||||
LocationRepositoryInterface $locationRepository,
|
||||
NodeRepositoryInterface $repository,
|
||||
Translator $translator,
|
||||
UpdateService $updateService
|
||||
) {
|
||||
$this->alert = $alert;
|
||||
$this->cache = $cache;
|
||||
$this->creationService = $creationService;
|
||||
$this->deletionService = $deletionService;
|
||||
$this->locationRepository = $locationRepository;
|
||||
$this->repository = $repository;
|
||||
$this->translator = $translator;
|
||||
$this->updateService = $updateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the index page listing all nodes on the panel.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$nodes = Models\Node::with('location')->withCount('servers');
|
||||
|
||||
if (! is_null($request->input('query'))) {
|
||||
$nodes->search($request->input('query'));
|
||||
}
|
||||
|
||||
return view('admin.nodes.index', ['nodes' => $nodes->paginate(25)]);
|
||||
return view('admin.nodes.index', [
|
||||
'nodes' => $this->repository->search($request->input('query'))->getNodeListingData(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays create new node page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function create()
|
||||
{
|
||||
$locations = Models\Location::all();
|
||||
if (! $locations->count()) {
|
||||
Alert::warning('You must add a location before you can add a new node.')->flash();
|
||||
$locations = $this->locationRepository->all();
|
||||
if (count($locations) < 1) {
|
||||
$this->alert->warning($this->translator->trans('admin/node.notices.location_required'))->flash();
|
||||
|
||||
return redirect()->route('admin.locations');
|
||||
}
|
||||
|
@ -76,117 +140,68 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Post controller to create a new node on the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Http\Requests\Admin\NodeFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(NodeFormRequest $request)
|
||||
{
|
||||
try {
|
||||
$repo = new NodeRepository;
|
||||
$node = $repo->create(array_merge(
|
||||
$request->only([
|
||||
'public', 'disk_overallocate',
|
||||
'memory_overallocate', 'behind_proxy',
|
||||
]),
|
||||
$request->intersect([
|
||||
'name', 'location_id', 'fqdn',
|
||||
'scheme', 'memory', 'disk',
|
||||
'daemonBase', 'daemonSFTP', 'daemonListen',
|
||||
])
|
||||
));
|
||||
Alert::success('Successfully created new node that can be configured automatically on your remote machine by visiting the configuration tab. <strong>Before you can add any servers you need to first assign some IP addresses and ports by adding an allocation.</strong>')->flash();
|
||||
$node = $this->creationService->handle($request->normalize());
|
||||
$this->alert->info($this->translator->trans('admin/node.notices.node_created'))->flash();
|
||||
|
||||
return redirect()->route('admin.nodes.view.allocation', $node->id);
|
||||
} catch (DisplayValidationException $e) {
|
||||
return redirect()->route('admin.nodes.new')->withErrors(json_decode($e->getMessage()))->withInput();
|
||||
} catch (DisplayException $e) {
|
||||
Alert::danger($e->getMessage())->flash();
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
Alert::danger('An unhandled exception occured while attempting to add this node. Please try again.')->flash();
|
||||
}
|
||||
|
||||
return redirect()->route('admin.nodes.new')->withInput();
|
||||
return redirect()->route('admin.nodes.view.allocation', $node->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the index overview page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param int $node
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewIndex(Request $request, $id)
|
||||
public function viewIndex($node)
|
||||
{
|
||||
$node = Models\Node::with('location')->withCount('servers')->findOrFail($id);
|
||||
$stats = collect(
|
||||
Models\Server::select(
|
||||
DB::raw('SUM(memory) as memory, SUM(disk) as disk')
|
||||
)->where('node_id', $node->id)->first()
|
||||
)->mapWithKeys(function ($item, $key) use ($node) {
|
||||
if ($node->{$key . '_overallocate'} > 0) {
|
||||
$withover = $node->{$key} * (1 + ($node->{$key . '_overallocate'} / 100));
|
||||
} else {
|
||||
$withover = $node->{$key};
|
||||
}
|
||||
|
||||
$percent = ($item / $withover) * 100;
|
||||
|
||||
return [$key => [
|
||||
'value' => number_format($item),
|
||||
'max' => number_format($withover),
|
||||
'percent' => $percent,
|
||||
'css' => ($percent <= 75) ? 'green' : (($percent > 90) ? 'red' : 'yellow'),
|
||||
]];
|
||||
})->toArray();
|
||||
|
||||
return view('admin.nodes.view.index', ['node' => $node, 'stats' => $stats]);
|
||||
return view('admin.nodes.view.index', [
|
||||
'node' => $this->repository->getSingleNode($node),
|
||||
'stats' => $this->repository->getUsageStats($node),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the settings page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewSettings(Request $request, $id)
|
||||
public function viewSettings(Node $node)
|
||||
{
|
||||
return view('admin.nodes.view.settings', [
|
||||
'node' => Models\Node::findOrFail($id),
|
||||
'locations' => Models\Location::all(),
|
||||
'node' => $node,
|
||||
'locations' => $this->locationRepository->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the configuration page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewConfiguration(Request $request, $id)
|
||||
public function viewConfiguration(Node $node)
|
||||
{
|
||||
return view('admin.nodes.view.configuration', [
|
||||
'node' => Models\Node::findOrFail($id),
|
||||
]);
|
||||
return view('admin.nodes.view.configuration', ['node' => $node]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the allocation page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param int $node
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewAllocation(Request $request, $id)
|
||||
public function viewAllocation($node)
|
||||
{
|
||||
$node = Models\Node::findOrFail($id);
|
||||
$node->setRelation('allocations', $node->allocations()->orderBy('ip', 'asc')->orderBy('port', 'asc')->with('server')->paginate(50));
|
||||
|
||||
Javascript::put([
|
||||
'node' => collect($node)->only(['id']),
|
||||
]);
|
||||
$node = $this->repository->getNodeAllocations($node);
|
||||
Javascript::put(['node' => collect($node)->only(['id'])]);
|
||||
|
||||
return view('admin.nodes.view.allocation', ['node' => $node]);
|
||||
}
|
||||
|
@ -194,69 +209,48 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Shows the server listing page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param int $node
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewServers(Request $request, $id)
|
||||
public function viewServers($node)
|
||||
{
|
||||
$node = Models\Node::with('servers.user', 'servers.service', 'servers.option')->findOrFail($id);
|
||||
$node = $this->repository->getNodeServers($node);
|
||||
Javascript::put([
|
||||
'node' => collect($node->makeVisible('daemonSecret'))->only(['scheme', 'fqdn', 'daemonListen', 'daemonSecret']),
|
||||
]);
|
||||
|
||||
return view('admin.nodes.view.servers', [
|
||||
'node' => $node,
|
||||
]);
|
||||
return view('admin.nodes.view.servers', ['node' => $node]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates settings for a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \Pterodactyl\Http\Requests\Admin\NodeFormRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function updateSettings(Request $request, $id)
|
||||
public function updateSettings(NodeFormRequest $request, Node $node)
|
||||
{
|
||||
$repo = new NodeRepository;
|
||||
$this->updateService->handle($node, $request->normalize());
|
||||
$this->alert->success($this->translator->trans('admin/node.notices.node_updated'))->flash();
|
||||
|
||||
try {
|
||||
$node = $repo->update($id, array_merge(
|
||||
$request->only([
|
||||
'public', 'disk_overallocate',
|
||||
'memory_overallocate', 'behind_proxy',
|
||||
]),
|
||||
$request->intersect([
|
||||
'name', 'location_id', 'fqdn',
|
||||
'scheme', 'memory', 'disk', 'upload_size',
|
||||
'reset_secret', 'daemonSFTP', 'daemonListen',
|
||||
])
|
||||
));
|
||||
Alert::success('Successfully updated this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash();
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.nodes.view.settings', $id)->withErrors(json_decode($ex->getMessage()))->withInput();
|
||||
} catch (DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An unhandled exception occured while attempting to edit this node. Please try again.')->flash();
|
||||
}
|
||||
|
||||
return redirect()->route('admin.nodes.view.settings', $id)->withInput();
|
||||
return redirect()->route('admin.nodes.view.settings', $node->id)->withInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a single allocation from a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @param int $allocation
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @param int $allocation
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function allocationRemoveSingle(Request $request, $node, $allocation)
|
||||
{
|
||||
$query = Models\Allocation::where('node_id', $node)->whereNull('server_id')->where('id', $allocation)->delete();
|
||||
$query = Allocation::where('node_id', $node)->whereNull('server_id')->where('id', $allocation)->delete();
|
||||
if ($query < 1) {
|
||||
return response()->json([
|
||||
'error' => 'Unable to find an allocation matching those details to delete.',
|
||||
|
@ -269,13 +263,16 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Remove all allocations for a specific IP at once on a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function allocationRemoveBlock(Request $request, $node)
|
||||
{
|
||||
$query = Models\Allocation::where('node_id', $node)->whereNull('server_id')->where('ip', $request->input('ip'))->delete();
|
||||
$query = Allocation::where('node_id', $node)
|
||||
->whereNull('server_id')
|
||||
->where('ip', $request->input('ip'))
|
||||
->delete();
|
||||
if ($query < 1) {
|
||||
Alert::danger('There was an error while attempting to delete allocations on that IP.')->flash();
|
||||
} else {
|
||||
|
@ -288,8 +285,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Sets an alias for a specific allocation on a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function allocationSetAlias(Request $request, $node)
|
||||
|
@ -299,7 +296,7 @@ class NodesController extends Controller
|
|||
}
|
||||
|
||||
try {
|
||||
$update = Models\Allocation::findOrFail($request->input('allocation_id'));
|
||||
$update = Allocation::findOrFail($request->input('allocation_id'));
|
||||
$update->ip_alias = (empty($request->input('alias'))) ? null : $request->input('alias');
|
||||
$update->save();
|
||||
|
||||
|
@ -312,8 +309,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Creates new allocations on a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createAllocation(Request $request, $node)
|
||||
|
@ -324,12 +321,16 @@ class NodesController extends Controller
|
|||
$repo->addAllocations($node, $request->intersect(['allocation_ip', 'allocation_alias', 'allocation_ports']));
|
||||
Alert::success('Successfully added new allocations!')->flash();
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.nodes.view.allocation', $node)->withErrors(json_decode($ex->getMessage()))->withInput();
|
||||
return redirect()
|
||||
->route('admin.nodes.view.allocation', $node)
|
||||
->withErrors(json_decode($ex->getMessage()))
|
||||
->withInput();
|
||||
} catch (DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An unhandled exception occured while attempting to add allocations this node. This error has been logged.')->flash();
|
||||
Alert::danger('An unhandled exception occured while attempting to add allocations this node. This error has been logged.')
|
||||
->flash();
|
||||
}
|
||||
|
||||
return redirect()->route('admin.nodes.view.allocation', $node);
|
||||
|
@ -338,42 +339,29 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Deletes a node from the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete(Request $request, $id)
|
||||
public function delete($node)
|
||||
{
|
||||
$repo = new NodeRepository;
|
||||
$this->deletionService->handle($node);
|
||||
$this->alert->success($this->translator->trans('admin/node.notices.node_deleted'))->flash();
|
||||
|
||||
try {
|
||||
$repo->delete($id);
|
||||
Alert::success('Successfully deleted the requested node from the panel.')->flash();
|
||||
|
||||
return redirect()->route('admin.nodes');
|
||||
} catch (DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An unhandled exception occured while attempting to delete this node. Please try again.')->flash();
|
||||
}
|
||||
|
||||
return redirect()->route('admin.nodes.view', $id);
|
||||
return redirect()->route('admin.nodes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration token to auto-deploy a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function setToken(Request $request, $id)
|
||||
public function setToken(Node $node)
|
||||
{
|
||||
$node = Models\Node::findOrFail($id);
|
||||
|
||||
$token = str_random(32);
|
||||
Cache::tags(['Node:Configuration'])->put($token, $node->id, 5);
|
||||
$token = bin2hex(random_bytes(16));
|
||||
$this->cache->tags(['Node:Configuration'])->put($token, $node->id, 5);
|
||||
|
||||
return response()->json(['token' => $token]);
|
||||
}
|
||||
|
|
62
app/Http/Requests/Admin/NodeFormRequest.php
Normal file
62
app/Http/Requests/Admin/NodeFormRequest.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/*
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Admin;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
|
||||
class NodeFormRequest extends AdminFormRequest
|
||||
{
|
||||
/**
|
||||
* Get rules to apply to data in this request.
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if ($this->method() === 'PATCH') {
|
||||
return Node::getUpdateRulesForId($this->route()->parameter('node')->id);
|
||||
}
|
||||
|
||||
return Node::getCreateRules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run validation after the rules above have been applied.
|
||||
*
|
||||
* @param \Illuminate\Validation\Validator $validator
|
||||
*/
|
||||
public function withValidator($validator)
|
||||
{
|
||||
$validator->after(function ($validator) {
|
||||
// Check that the FQDN is a valid IP address.
|
||||
if (! filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) {
|
||||
$validator->errors()->add('fqdn', trans('admin/node.validation.fqdn_not_resolvable'));
|
||||
}
|
||||
|
||||
// Check that if using HTTPS the FQDN is not an IP address.
|
||||
if (filter_var($this->input('fqdn'), FILTER_VALIDATE_IP) && $this->input('scheme') === 'https') {
|
||||
$validator->errors()->add('fqdn', trans('admin/node.validation.fqdn_required_for_ssl'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue