Merge branch 'develop' into feature/api-v1
This commit is contained in:
commit
8dcab927e5
10 changed files with 41 additions and 28 deletions
|
@ -21,11 +21,11 @@ interface FileRepositoryInterface extends BaseRepositoryInterface
|
|||
* Return the contents of a given file if it can be edited in the Panel.
|
||||
*
|
||||
* @param string $path
|
||||
* @return \stdClass
|
||||
* @return string
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
*/
|
||||
public function getContent(string $path): stdClass;
|
||||
public function getContent(string $path): string;
|
||||
|
||||
/**
|
||||
* Save new contents to a given file.
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Admin\Egg;
|
||||
|
||||
|
@ -15,6 +8,8 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
|
|||
class EggVariableFormRequest extends AdminFormRequest
|
||||
{
|
||||
/**
|
||||
* Define rules for validation of this request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
|
@ -23,7 +18,7 @@ class EggVariableFormRequest extends AdminFormRequest
|
|||
'name' => 'required|string|min:1|max:255',
|
||||
'description' => 'sometimes|nullable|string',
|
||||
'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES,
|
||||
'default_value' => 'string',
|
||||
'default_value' => 'nullable|string',
|
||||
'options' => 'sometimes|required|array',
|
||||
'rules' => 'bail|required|string',
|
||||
];
|
||||
|
@ -41,6 +36,13 @@ class EggVariableFormRequest extends AdminFormRequest
|
|||
$rules = $this->input('rules', $this->route()->parameter('egg')->rules);
|
||||
}
|
||||
|
||||
// If rules is not a string it is already violating the rule defined above
|
||||
// so just skip the addition of default value rules since this request
|
||||
// will fail anyways.
|
||||
if (! is_string($rules)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$validator->addRules(['default_value' => $rules]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class UpdateFileContentsFormRequest extends ServerFormRequest
|
|||
}
|
||||
}
|
||||
|
||||
if (! $stats->file || ! in_array($stats->mime, $config->get('pterodactyl.files.editable'))) {
|
||||
if ((! $stats->file && ! $stats->symlink) || ! in_array($stats->mime, $config->get('pterodactyl.files.editable'))) {
|
||||
throw new FileTypeNotEditableException(trans('server.files.exceptions.invalid_mime'));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class ServerPolicy
|
|||
})->values();
|
||||
});
|
||||
|
||||
return $permissions->setSearchTerm($permission, true) !== false;
|
||||
return $permissions->search($permission, true) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,11 +33,11 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface
|
|||
* Return the contents of a given file if it can be edited in the Panel.
|
||||
*
|
||||
* @param string $path
|
||||
* @return \stdClass
|
||||
* @return string
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
*/
|
||||
public function getContent(string $path): stdClass
|
||||
public function getContent(string $path): string
|
||||
{
|
||||
$file = pathinfo($path);
|
||||
$file['dirname'] = in_array($file['dirname'], ['.', './', '/']) ? null : trim($file['dirname'], '/') . '/';
|
||||
|
|
|
@ -65,7 +65,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
|
|||
$instance = $this->getBuilder()->with('location')->withCount('servers');
|
||||
|
||||
if ($this->hasSearchTerm()) {
|
||||
$instance->setSearchTerm($this->getSearchTerm());
|
||||
$instance->search($this->getSearchTerm());
|
||||
}
|
||||
|
||||
return $instance->paginate(25, $this->getColumns());
|
||||
|
|
Reference in a new issue