Update doc blocks for all app/
This commit is contained in:
parent
5e27772fef
commit
0312c974f5
114 changed files with 1360 additions and 949 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -6,14 +6,11 @@
|
|||
storage/framework/*
|
||||
|
||||
composer.lock
|
||||
|
||||
Homestead.yaml
|
||||
Vagrantfile
|
||||
Vagrantfile
|
||||
|
||||
node_modules
|
||||
yarn.lock
|
||||
node_modules
|
||||
|
||||
_ide_helper_models.php
|
||||
_ide_helper.php
|
||||
|
||||
sami.phar
|
||||
sami.config.php
|
||||
/sami
|
||||
|
|
|
@ -31,11 +31,17 @@ class Created
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Creating
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Deleted
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Deleting
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Saved
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Saving
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Updated
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Updating
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Created
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Subuser
|
||||
*/
|
||||
public $subuser;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subuser $subuser)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Creating
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Subuser
|
||||
*/
|
||||
public $subuser;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subuser $subuser)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Deleted
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Subuser
|
||||
*/
|
||||
public $subuser;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subuser $subuser)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Deleting
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Subuser
|
||||
*/
|
||||
public $subuser;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subuser $subuser)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Created
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Creating
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Deleted
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
@ -31,11 +31,17 @@ class Deleting
|
|||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The Eloquent model of the server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
@ -26,4 +26,5 @@ namespace Pterodactyl\Exceptions;
|
|||
|
||||
class AccountNotFoundException extends \Exception
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
|
@ -28,20 +28,19 @@ use Log;
|
|||
|
||||
class DisplayException extends \Exception
|
||||
{
|
||||
private $_logging = null;
|
||||
|
||||
/**
|
||||
* Exception constructor.
|
||||
*
|
||||
* @param string $message
|
||||
* @param mixed $log
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message, $log = null)
|
||||
{
|
||||
$this->_logging = $log;
|
||||
if ($this->_logging !== null) {
|
||||
if (! is_null($log)) {
|
||||
Log::error($log);
|
||||
}
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
public function getLogging()
|
||||
{
|
||||
return $this->_logging;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @param \Exception $exception
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
|
@ -41,7 +41,7 @@ class Handler extends ExceptionHandler
|
|||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @param \Exception $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
|
|
|
@ -35,7 +35,7 @@ class PhraseAppTranslator extends LaravelTranslator
|
|||
* @param array $replace
|
||||
* @param string|null $locale
|
||||
* @param bool $fallback
|
||||
* @return string|array|null
|
||||
* @return string
|
||||
*/
|
||||
public function get($key, array $replace = [], $locale = null, $fallback = true)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,11 @@ use Illuminate\Support\Facades\Facade;
|
|||
|
||||
class Version extends Facade
|
||||
{
|
||||
/**
|
||||
* Returns the facade accessor class.
|
||||
*
|
||||
* @return strig
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return '\Pterodactyl\Services\VersionService';
|
||||
|
|
|
@ -142,6 +142,7 @@ class NodeController extends BaseController
|
|||
* Returns a listing of the allocation for the specified server id.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function allocationsView(Request $request, $id)
|
||||
|
|
|
@ -32,16 +32,34 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
|
||||
class BaseController extends Controller
|
||||
{
|
||||
/**
|
||||
* Return the admin index view.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
return view('admin.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the admin settings view.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getSettings(Request $request)
|
||||
{
|
||||
return view('admin.settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle settings post request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSettings(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
|
|
|
@ -40,7 +40,7 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Display database host index.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -54,7 +54,7 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Display database host to user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -69,8 +69,8 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Handle post request to create database host.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
|
@ -99,9 +99,9 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Handle post request to update a database host.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Return the location overview page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -51,7 +51,7 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Return the location view page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -63,8 +63,8 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Handle request to create new location.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
|
@ -88,9 +88,9 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Handle request to update or delete location.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Displays the index page listing all nodes on the panel.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -57,8 +57,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Displays create new node page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\View\View|\Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function new(Request $request)
|
||||
{
|
||||
|
@ -75,8 +75,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Post controller to create a new node on the system.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
|
@ -110,9 +110,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Shows the index overview page for a specific node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id The ID of the node to display information for.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewIndex(Request $request, $id)
|
||||
|
@ -138,9 +137,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Shows the settings page for a specific node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id The ID of the node to display information for.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewSettings(Request $request, $id)
|
||||
|
@ -154,9 +152,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Shows the configuration page for a specific node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id The ID of the node to display information for.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewConfiguration(Request $request, $id)
|
||||
|
@ -169,9 +166,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Shows the allocation page for a specific node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id The ID of the node to display information for.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewAllocation(Request $request, $id)
|
||||
|
@ -189,9 +185,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Shows the server listing page for a specific node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id The ID of the node to display information for.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function viewServers(Request $request, $id)
|
||||
|
@ -209,8 +204,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Updates settings for a node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $node
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateSettings(Request $request, $id)
|
||||
|
@ -244,9 +239,9 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Removes a single allocation from a node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @param int $allocation [description]
|
||||
* @param int $allocation
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function allocationRemoveSingle(Request $request, $node, $allocation)
|
||||
|
@ -264,7 +259,7 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Remove all allocations for a specific IP at once on a node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
|
@ -283,10 +278,9 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Sets an alias for a specific allocation on a node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function allocationSetAlias(Request $request, $node)
|
||||
{
|
||||
|
@ -308,7 +302,7 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Creates new allocations on a node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
|
@ -334,7 +328,7 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Deletes a node from the system.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
|
@ -360,7 +354,7 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Returns the configuration token to auto-deploy a node.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Handles request to view page for adding new option.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function new(Request $request)
|
||||
|
@ -55,7 +55,7 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Handles POST request to create a new option.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
|
@ -86,9 +86,9 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Handles POST request to create a new option variable.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id The ID of the service option to assign this variable to.
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createVariable(Request $request, $id)
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Display option overview page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -128,7 +128,7 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Display variable overview page for a service option.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -140,8 +140,9 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Handles POST when editing a configration for a service option.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function editConfiguration(Request $request, $id)
|
||||
{
|
||||
|
@ -176,10 +177,10 @@ class OptionController extends Controller
|
|||
/**
|
||||
* Handles POST when editing a configration for a service option.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $option
|
||||
* @param int $variable
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function editVariable(Request $request, $option, $variable)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ class PackController extends Controller
|
|||
/**
|
||||
* Display listing of all packs on the system.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -57,7 +57,7 @@ class PackController extends Controller
|
|||
/**
|
||||
* Display new pack creation form.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function new(Request $request)
|
||||
|
@ -70,7 +70,7 @@ class PackController extends Controller
|
|||
/**
|
||||
* Display new pack creation modal for use with template upload.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function newTemplate(Request $request)
|
||||
|
@ -83,7 +83,7 @@ class PackController extends Controller
|
|||
/**
|
||||
* Handle create pack request and route user to location.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
|
@ -117,7 +117,7 @@ class PackController extends Controller
|
|||
/**
|
||||
* Display pack view template to user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -132,9 +132,9 @@ class PackController extends Controller
|
|||
/**
|
||||
* Handle updating or deleting pack information.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
@ -168,10 +168,10 @@ class PackController extends Controller
|
|||
/**
|
||||
* Creates an archive of the pack and downloads it to the browser.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param bool $files
|
||||
* @return \Illuminate\Response\BinaryFileResponse
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*/
|
||||
public function export(Request $request, $id, $files = false)
|
||||
{
|
||||
|
@ -202,6 +202,7 @@ class PackController extends Controller
|
|||
|
||||
return response()->download($filename, 'pack-' . $pack->name . '.zip')->deleteFileAfterSend(true);
|
||||
} else {
|
||||
|
||||
$fp = fopen($filename, 'a+');
|
||||
fwrite($fp, json_encode($json, JSON_PRETTY_PRINT));
|
||||
fclose($fp);
|
||||
|
|
|
@ -41,7 +41,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the index page with all servers currently on the system.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -62,7 +62,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display create new server page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function new(Request $request)
|
||||
|
@ -85,7 +85,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Create server controller method.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
|
@ -110,7 +110,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Returns a tree of all avaliable nodes in a given location.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function newServerNodes(Request $request)
|
||||
|
@ -140,7 +140,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the index when viewing a specific server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -152,7 +152,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the details page when viewing a specific server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -166,7 +166,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the build details page when viewing a specific server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -184,7 +184,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display startup configuration page for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -203,7 +203,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the database management page for a specific server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -220,7 +220,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the management page when viewing a specific server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -232,7 +232,7 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Display the deletion page for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -244,9 +244,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the details for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function setDetails(Request $request, $id)
|
||||
{
|
||||
|
@ -272,9 +272,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Set the new docker container for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function setContainer(Request $request, $id)
|
||||
{
|
||||
|
@ -299,9 +299,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Toggles the install status for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function toggleInstall(Request $request, $id)
|
||||
{
|
||||
|
@ -323,9 +323,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Setup a server to have a container rebuild.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function rebuildContainer(Request $request, $id)
|
||||
{
|
||||
|
@ -349,9 +349,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Manage the suspension status for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function manageSuspension(Request $request, $id)
|
||||
{
|
||||
|
@ -381,9 +381,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the build configuration for a server.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateBuild(Request $request, $id)
|
||||
{
|
||||
|
@ -411,9 +411,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Start the server deletion process.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
|
@ -435,9 +435,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Cancels a pending server deletion request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function cancelDeletion(Request $request, $id)
|
||||
{
|
||||
|
@ -452,10 +452,10 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Skips the queue and continues the server deletion process.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param string $method
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function continueDeletion(Request $request, $id, $method = 'safe')
|
||||
{
|
||||
|
@ -482,9 +482,9 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the startup command as well as variables.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function saveStartup(Request $request, $id)
|
||||
{
|
||||
|
@ -511,9 +511,10 @@ class ServersController extends Controller
|
|||
|
||||
/**
|
||||
* Creates a new database assigned to a specific server.
|
||||
* @param Request $request
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function newDatabase(Request $request, $id)
|
||||
{
|
||||
|
@ -537,9 +538,10 @@ class ServersController extends Controller
|
|||
|
||||
/**
|
||||
* Resets the database password for a specific database on this server.
|
||||
* @param Request $request
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function resetDatabasePassword(Request $request, $id)
|
||||
{
|
||||
|
@ -559,9 +561,11 @@ class ServersController extends Controller
|
|||
|
||||
/**
|
||||
* Deletes a database from a server.
|
||||
* @param Request $request
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param int $database
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteDatabase(Request $request, $id, $database)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ class ServiceController extends Controller
|
|||
/**
|
||||
* Display service overview page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -51,7 +51,7 @@ class ServiceController extends Controller
|
|||
/**
|
||||
* Display create service page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function new(Request $request)
|
||||
|
@ -62,7 +62,7 @@ class ServiceController extends Controller
|
|||
/**
|
||||
* Return base view for a service.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ class ServiceController extends Controller
|
|||
/**
|
||||
* Return function editing view for a service.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -88,8 +88,8 @@ class ServiceController extends Controller
|
|||
/**
|
||||
* Handle post action for new service.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
|
@ -117,9 +117,9 @@ class ServiceController extends Controller
|
|||
/**
|
||||
* Edits configuration for a specific service.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Response\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -37,14 +37,11 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Controller Constructor.
|
||||
* Display user index page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// @TODO: implement nicolaslopezj/searchable to clean up this disaster.
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
$users = User::withCount('servers');
|
||||
|
@ -58,11 +55,24 @@ class UserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display new user page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getNew(Request $request)
|
||||
{
|
||||
return view('admin.users.new');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display user view page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getView(Request $request, $id)
|
||||
{
|
||||
return view('admin.users.view', [
|
||||
|
@ -70,6 +80,13 @@ class UserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteUser(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
|
@ -88,6 +105,12 @@ class UserController extends Controller
|
|||
return redirect()->route('admin.users.view', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postNew(Request $request)
|
||||
{
|
||||
try {
|
||||
|
@ -109,6 +132,13 @@ class UserController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $user
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateUser(Request $request, $user)
|
||||
{
|
||||
try {
|
||||
|
@ -128,6 +158,12 @@ class UserController extends Controller
|
|||
return redirect()->route('admin.users.view', $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a JSON response of users on the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Pterodactyl\Models\User
|
||||
*/
|
||||
public function getJson(Request $request)
|
||||
{
|
||||
return User::select('id', 'email', 'username', 'name_first', 'name_last')
|
||||
|
|
|
@ -83,7 +83,7 @@ class LoginController extends Controller
|
|||
* Handle a login request to the application.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Response\RedirectResponse
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
|
@ -126,6 +126,12 @@ class LoginController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a TOTP implementation page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*/
|
||||
public function totp(Request $request)
|
||||
{
|
||||
$verifyKey = $request->session()->get('authentication_token');
|
||||
|
@ -140,6 +146,12 @@ class LoginController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a TOTP input.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function totpCheckpoint(Request $request)
|
||||
{
|
||||
$G2FA = new Google2FA();
|
||||
|
|
|
@ -21,6 +21,11 @@ class ResetPasswordController extends Controller
|
|||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* The URL to redirect users to after password reset.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $redirectTo = '/';
|
||||
|
||||
/**
|
||||
|
@ -33,6 +38,11 @@ class ResetPasswordController extends Controller
|
|||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the rules used when validating password reset.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function rules()
|
||||
{
|
||||
return [
|
||||
|
|
|
@ -36,6 +36,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class APIController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display base API index page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('base.api.index', [
|
||||
|
@ -43,11 +49,23 @@ class APIController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display API key creation page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
return view('base.api.new');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle saving new API key.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
try {
|
||||
|
@ -71,6 +89,13 @@ class APIController extends Controller
|
|||
return redirect()->route('account.api.new')->withInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle revoking API key.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $key
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||
*/
|
||||
public function revoke(Request $request, $key)
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -39,7 +39,7 @@ class AccountController extends Controller
|
|||
* Display base account information page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -48,8 +48,10 @@ class AccountController extends Controller
|
|||
|
||||
/**
|
||||
* Update details for a users account.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
|
|
|
@ -30,19 +30,11 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
/**
|
||||
* Controller Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns listing of user's servers.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
|
@ -55,7 +47,9 @@ class IndexController extends Controller
|
|||
* Generate a random string.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $length
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
public function getPassword(Request $request, $length = 16)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,11 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
|
||||
class LanguageController extends Controller
|
||||
{
|
||||
/**
|
||||
* A list of supported languages on the panel.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $languages = [
|
||||
'de' => 'German',
|
||||
'en' => 'English',
|
||||
|
@ -44,13 +49,12 @@ class LanguageController extends Controller
|
|||
];
|
||||
|
||||
/**
|
||||
* Controller Constructor.
|
||||
* Sets the language for a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $language
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function setLanguage(Request $request, $language)
|
||||
{
|
||||
if (array_key_exists($language, $this->languages)) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class SecurityController extends Controller
|
|||
* Returns Security Management Page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ class SecurityController extends Controller
|
|||
* that they can generate a valid response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function generateTotp(Request $request)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ class SecurityController extends Controller
|
|||
* Disables TOTP on an account.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function disableTotp(Request $request)
|
||||
{
|
||||
|
@ -116,6 +116,13 @@ class SecurityController extends Controller
|
|||
return redirect()->route('account.security');
|
||||
}
|
||||
|
||||
/**
|
||||
* Revokes a user session.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function revoke(Request $request, $id)
|
||||
{
|
||||
Session::where('user_id', $request->user()->id)->findOrFail($id)->delete();
|
||||
|
|
|
@ -31,19 +31,12 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
|
||||
class PackController extends Controller
|
||||
{
|
||||
/**
|
||||
* Controller Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Pulls an install pack archive from the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*/
|
||||
public function pull(Request $request, $uuid)
|
||||
{
|
||||
|
@ -64,7 +57,8 @@ class PackController extends Controller
|
|||
* Returns the hash information for a pack.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function hash(Request $request, $uuid)
|
||||
{
|
||||
|
@ -87,9 +81,10 @@ class PackController extends Controller
|
|||
* Pulls an update pack archive from the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return void
|
||||
*/
|
||||
public function pullUpdate(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,13 +32,11 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
class RemoteController extends Controller
|
||||
{
|
||||
/**
|
||||
* Controller Constructor.
|
||||
* Handles download request from daemon.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// No middleware for this route.
|
||||
}
|
||||
|
||||
public function postDownload(Request $request)
|
||||
{
|
||||
$download = Models\Download::where('token', $request->input('token'))->first();
|
||||
|
@ -56,6 +54,12 @@ class RemoteController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles install toggle request from daemon.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function postInstall(Request $request)
|
||||
{
|
||||
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
|
||||
|
@ -82,6 +86,13 @@ class RemoteController extends Controller
|
|||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles event from daemon.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||
* @deprecated
|
||||
*/
|
||||
public function event(Request $request)
|
||||
{
|
||||
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
|
||||
|
@ -101,6 +112,13 @@ class RemoteController extends Controller
|
|||
return response('', 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles configuration data request from daemon.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $token
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||
*/
|
||||
public function getConfiguration(Request $request, $token)
|
||||
{
|
||||
// Try to query the token and the node from the database
|
||||
|
|
|
@ -50,20 +50,12 @@ class AjaxController extends Controller
|
|||
*/
|
||||
protected $directory;
|
||||
|
||||
/**
|
||||
* Controller Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true or false depending on the power status of the requested server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getStatus(Request $request, $uuid)
|
||||
{
|
||||
|
@ -97,8 +89,8 @@ class AjaxController extends Controller
|
|||
* Returns a listing of files in a given directory for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid`
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View|\Illuminate\Http\Response
|
||||
*/
|
||||
public function postDirectoryList(Request $request, $uuid)
|
||||
{
|
||||
|
@ -147,7 +139,7 @@ class AjaxController extends Controller
|
|||
/**
|
||||
* Handles a POST request to save a file.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
@ -172,10 +164,12 @@ class AjaxController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* [postSetPrimary description].
|
||||
* @param Request $request
|
||||
* Sets the primary allocation for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @deprecated
|
||||
*/
|
||||
public function postSetPrimary(Request $request, $uuid)
|
||||
{
|
||||
|
@ -219,6 +213,14 @@ class AjaxController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets a database password for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @deprecated
|
||||
*/
|
||||
public function postResetDatabasePassword(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
|
|
@ -37,21 +37,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class ServerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Controller Constructor.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders server index page for specified server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getIndex(Request $request, $uuid)
|
||||
{
|
||||
|
@ -77,8 +68,9 @@ class ServerController extends Controller
|
|||
/**
|
||||
* Renders file overview page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getFiles(Request $request, $uuid)
|
||||
{
|
||||
|
@ -110,8 +102,9 @@ class ServerController extends Controller
|
|||
/**
|
||||
* Renders add file page.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getAddFile(Request $request, $uuid)
|
||||
{
|
||||
|
@ -130,10 +123,10 @@ class ServerController extends Controller
|
|||
/**
|
||||
* Renders edit file page for a given file.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param string $file
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getEditFile(Request $request, $uuid, $file)
|
||||
{
|
||||
|
@ -173,10 +166,10 @@ class ServerController extends Controller
|
|||
/**
|
||||
* Handles downloading a file for the user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param string $file
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getDownloadFile(Request $request, $uuid, $file)
|
||||
{
|
||||
|
@ -194,6 +187,13 @@ class ServerController extends Controller
|
|||
return redirect($server->node->scheme . '://' . $server->node->fqdn . ':' . $server->node->daemonListen . '/server/file/download/' . $download->token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the allocation overview for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getAllocation(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -209,6 +209,13 @@ class ServerController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the startup overview for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getStartup(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -239,6 +246,13 @@ class ServerController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the database overview for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getDatabases(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -254,6 +268,13 @@ class ServerController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SFTP overview for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getSFTP(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -266,6 +287,13 @@ class ServerController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles changing the SFTP password for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSettingsSFTP(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -287,6 +315,13 @@ class ServerController extends Controller
|
|||
return redirect()->route('server.settings.sftp', $uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles changing the startup settings for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSettingsStartup(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
|
|
@ -37,15 +37,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
class SubuserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Controller Constructor.
|
||||
* Displays the subuser overview index.
|
||||
*
|
||||
* @return void
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getIndex(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid)->load('subusers.user');
|
||||
|
@ -60,6 +57,14 @@ class SubuserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the a single subuser overview.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getView(Request $request, $uuid, $id)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid)->load('node');
|
||||
|
@ -80,6 +85,14 @@ class SubuserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles editing a subuser.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postView(Request $request, $uuid, $id)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -118,6 +131,13 @@ class SubuserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display new subuser creation page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getNew(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -130,6 +150,13 @@ class SubuserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles creating a new subuser.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postNew(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -158,6 +185,14 @@ class SubuserController extends Controller
|
|||
return redirect()->route('server.subusers.new', $uuid)->withInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles deleting a subuser.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||
*/
|
||||
public function deleteSubuser(Request $request, $uuid, $id)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
|
|
@ -35,11 +35,13 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class TaskController extends Controller
|
||||
{
|
||||
public function __constructor()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display task index page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getIndex(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid)->load('tasks');
|
||||
|
@ -57,6 +59,13 @@ class TaskController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display new task page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function getNew(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -69,6 +78,13 @@ class TaskController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle creation of new task.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postNew(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid);
|
||||
|
@ -93,6 +109,14 @@ class TaskController extends Controller
|
|||
return redirect()->route('server.tasks.new', $uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle deletion of a task.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function deleteTask(Request $request, $uuid, $id)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid)->load('tasks');
|
||||
|
@ -119,6 +143,14 @@ class TaskController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the status of a task.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function toggleTask(Request $request, $uuid, $id)
|
||||
{
|
||||
$server = Models\Server::byUuid($uuid)->load('tasks');
|
||||
|
|
|
@ -32,14 +32,14 @@ class AdminAuthenticate
|
|||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
* @var \Illuminate\Contracts\Auth\Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
|
|
|
@ -10,14 +10,14 @@ class Authenticate
|
|||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
* @var \Illuminate\Contracts\Auth\Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
|
|
|
@ -33,14 +33,14 @@ class DaemonAuthenticate
|
|||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
* @var \Illuminate\Contracts\Auth\Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
|
|
|
@ -32,11 +32,6 @@ use Illuminate\Support\Facades\App;
|
|||
|
||||
class LanguageMiddleware
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
|
|
|
@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class APIRoutes
|
||||
{
|
||||
/**
|
||||
* API routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
$api = app('Dingo\Api\Routing\Router');
|
||||
|
|
|
@ -29,6 +29,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class AdminRoutes
|
||||
{
|
||||
/**
|
||||
* Admin routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
|
||||
|
|
|
@ -30,6 +30,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class AuthRoutes
|
||||
{
|
||||
/**
|
||||
* Authentication routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
$router->group([
|
||||
|
|
|
@ -29,6 +29,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class BaseRoutes
|
||||
{
|
||||
/**
|
||||
* Base routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
|
||||
|
|
|
@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class DaemonRoutes
|
||||
{
|
||||
/**
|
||||
* Daemon routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
$router->group(['prefix' => 'daemon', 'middleware' => 'daemon'], function () use ($router) {
|
||||
|
|
|
@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class LanguageRoutes
|
||||
{
|
||||
/**
|
||||
* Language controller routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
$router->get('language/{lang}', [
|
||||
|
|
|
@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class RemoteRoutes
|
||||
{
|
||||
/**
|
||||
* Remote daemon routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
$router->group(['prefix' => 'remote'], function () use ($router) {
|
||||
|
|
|
@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
|
|||
|
||||
class ServerRoutes
|
||||
{
|
||||
/**
|
||||
* Server routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
// Returns Server Status
|
||||
|
|
|
@ -34,15 +34,16 @@ class DeleteServer extends Job implements ShouldQueue
|
|||
use InteractsWithQueue, SerializesModels;
|
||||
|
||||
/**
|
||||
* Id of server to be deleted.
|
||||
* @var object
|
||||
* ID of server to be deleted.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param int $server
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($id)
|
||||
|
|
|
@ -37,8 +37,14 @@ class SendScheduledTask extends Job implements ShouldQueue
|
|||
{
|
||||
use InteractsWithQueue, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Models\Task
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,8 @@ class SuspendServer extends Job implements ShouldQueue
|
|||
|
||||
/**
|
||||
* ID of associated server model.
|
||||
* @var object
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
|
|
|
@ -75,6 +75,11 @@ class Node extends Model
|
|||
'daemonSFTP', 'daemonListen',
|
||||
];
|
||||
|
||||
/**
|
||||
* Fields that are searchable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchable = [
|
||||
'columns' => [
|
||||
'nodes.name' => 10,
|
||||
|
@ -106,8 +111,8 @@ class Node extends Model
|
|||
/**
|
||||
* Returns the configuration in JSON format.
|
||||
*
|
||||
* @param bool $pretty Wether to pretty print the JSON or not
|
||||
* @return string The configration in JSON format
|
||||
* @param bool $pretty
|
||||
* @return string
|
||||
*/
|
||||
public function getConfigurationAsJson($pretty = false)
|
||||
{
|
||||
|
|
|
@ -115,8 +115,11 @@ class Server extends Model
|
|||
* DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS.
|
||||
* YOU WILL OVERWRITE THE SECRET KEY AND BREAK THINGS.
|
||||
*
|
||||
* @param string $uuid The Short-UUID of the server to return an object about.
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
* @param string $uuid
|
||||
* @param array $with
|
||||
* @param array $withCount
|
||||
* @return \Pterodactyl\Models\Server
|
||||
* @todo Remove $with and $withCount due to cache issues, they aren't used anyways.
|
||||
*/
|
||||
public static function byUuid($uuid, array $with = [], array $withCount = [])
|
||||
{
|
||||
|
@ -147,7 +150,6 @@ class Server extends Model
|
|||
/**
|
||||
* Returns non-administrative headers for accessing a server on the daemon.
|
||||
*
|
||||
* @param string $uuid
|
||||
* @return array
|
||||
*/
|
||||
public function guzzleHeaders()
|
||||
|
@ -171,6 +173,8 @@ class Server extends Model
|
|||
/**
|
||||
* Returns javascript object to be embedded on server view pages with relevant information.
|
||||
*
|
||||
* @param array|null $additional
|
||||
* @param array|null $overwrite
|
||||
* @return \Laracasts\Utilities\JavaScript\JavaScriptFacade
|
||||
*/
|
||||
public function js($additional = null, $overwrite = null)
|
||||
|
|
|
@ -57,7 +57,7 @@ class ServiceVariable extends Model
|
|||
* Returns the display executable for the option and will use the parent
|
||||
* service one if the option does not have one defined.
|
||||
*
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function getRequiredAttribute($value)
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
/**
|
||||
* Enables or disables TOTP on an account if the token is valid.
|
||||
*
|
||||
* @param int $token The token that we want to verify.
|
||||
* @param int $token
|
||||
* @return bool
|
||||
*/
|
||||
public function toggleTotp($token)
|
||||
|
@ -116,9 +116,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
}
|
||||
|
||||
$this->use_totp = ! $this->use_totp;
|
||||
$this->save();
|
||||
|
||||
return true;
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,8 +126,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
* - at least one lowercase character
|
||||
* - at least one number.
|
||||
*
|
||||
* @param string $password The raw password to set the account password to.
|
||||
* @param string $regex The regex to use when validating the password. Defaults to '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'.
|
||||
* @param string $password
|
||||
* @param string $regex
|
||||
* @return void
|
||||
*/
|
||||
public function setPassword($password, $regex = '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})')
|
||||
|
@ -156,7 +154,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
/**
|
||||
* Return true or false depending on wether the user is root admin or not.
|
||||
*
|
||||
* @return bool the user is root admin
|
||||
* @return bool
|
||||
*/
|
||||
public function isRootAdmin()
|
||||
{
|
||||
|
@ -165,7 +163,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
|
||||
/**
|
||||
* Returns the user's daemon secret for a given server.
|
||||
* @param Server $server \Pterodactyl\Models\Server
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return null|string
|
||||
*/
|
||||
public function daemonToken(Server $server)
|
||||
|
@ -200,7 +199,9 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
* Returns an array of all servers a user is able to access.
|
||||
* Note: does not account for user admin status.
|
||||
*
|
||||
* @return Collection
|
||||
* @param int|null $paginate
|
||||
* @param array $load
|
||||
* @return \Illuminate\Pagination\LengthAwarePagination|\Illuiminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function serverAccessCollection($paginate = null, $load = ['service', 'node', 'allocation'])
|
||||
{
|
||||
|
|
|
@ -36,13 +36,14 @@ class AccountCreated extends Notification implements ShouldQueue
|
|||
/**
|
||||
* The password reset token to send.
|
||||
*
|
||||
* @var string
|
||||
* @var object
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param aray $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $user)
|
||||
|
|
|
@ -33,6 +33,9 @@ class AddedToServer extends Notification implements ShouldQueue
|
|||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,9 @@ class RemovedFromServer extends Notification implements ShouldQueue
|
|||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,6 +43,7 @@ class SendPasswordReset extends Notification implements ShouldQueue
|
|||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param string $token
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($token)
|
||||
|
|
|
@ -33,6 +33,9 @@ class ServerCreated extends Notification implements ShouldQueue
|
|||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server creating event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function creating(Server $server)
|
||||
|
@ -51,7 +51,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server created event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function created(Server $server)
|
||||
|
@ -72,7 +72,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server deleting event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function deleting(Server $server)
|
||||
|
@ -85,7 +85,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server deleted event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(Server $server)
|
||||
|
@ -102,7 +102,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server saving event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function saving(Server $server)
|
||||
|
@ -113,7 +113,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server saved event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function saved(Server $server)
|
||||
|
@ -124,7 +124,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server updating event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function updating(Server $server)
|
||||
|
@ -135,7 +135,7 @@ class ServerObserver
|
|||
/**
|
||||
* Listen to the Server saved event.
|
||||
*
|
||||
* @param Server $server The server model.
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function updated(Server $server)
|
||||
|
|
|
@ -34,7 +34,7 @@ class SubuserObserver
|
|||
/**
|
||||
* Listen to the Subuser creating event.
|
||||
*
|
||||
* @param Subuser $subuser The eloquent Subuser model.
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function creating(Subuser $subuser)
|
||||
|
@ -45,7 +45,7 @@ class SubuserObserver
|
|||
/**
|
||||
* Listen to the Subuser created event.
|
||||
*
|
||||
* @param Subuser $subuser The eloquent Subuser model.
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function created(Subuser $subuser)
|
||||
|
@ -62,7 +62,7 @@ class SubuserObserver
|
|||
/**
|
||||
* Listen to the Subuser deleting event.
|
||||
*
|
||||
* @param Subuser $subuser The eloquent Subuser model.
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function deleting(Subuser $subuser)
|
||||
|
@ -73,7 +73,7 @@ class SubuserObserver
|
|||
/**
|
||||
* Listen to the Subuser deleted event.
|
||||
*
|
||||
* @param Subuser $subuser The eloquent Subuser model.
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(Subuser $subuser)
|
||||
|
|
|
@ -34,7 +34,7 @@ class UserObserver
|
|||
/**
|
||||
* Listen to the User creating event.
|
||||
*
|
||||
* @param User $user The eloquent User model.
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function creating(User $user)
|
||||
|
@ -45,7 +45,7 @@ class UserObserver
|
|||
/**
|
||||
* Listen to the User created event.
|
||||
*
|
||||
* @param User $user The eloquent User model.
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function created(User $user)
|
||||
|
@ -63,7 +63,7 @@ class UserObserver
|
|||
/**
|
||||
* Listen to the User deleting event.
|
||||
*
|
||||
* @param User $user The eloquent User model.
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function deleting(User $user)
|
||||
|
@ -74,7 +74,7 @@ class UserObserver
|
|||
/**
|
||||
* Listen to the User deleted event.
|
||||
*
|
||||
* @param User $user The eloquent User model.
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(User $user)
|
||||
|
|
|
@ -31,22 +31,12 @@ use Pterodactyl\Models\Server;
|
|||
|
||||
class ServerPolicy
|
||||
{
|
||||
/**
|
||||
* Create a new policy instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user has the given permission on/for the server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param $permission
|
||||
* @param string $permission
|
||||
* @return bool
|
||||
*/
|
||||
private function checkPermission(User $user, Server $server, $permission)
|
||||
|
|
|
@ -25,7 +25,5 @@ class AuthServiceProvider extends ServiceProvider
|
|||
public function boot(GateContract $gate)
|
||||
{
|
||||
parent::registerPolicies($gate);
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,5 @@ class EventServiceProvider extends ServiceProvider
|
|||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,10 @@ class RouteServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ class APIRepository
|
|||
{
|
||||
/**
|
||||
* Valid API permissions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $permissions = [
|
||||
|
@ -89,14 +90,23 @@ class APIRepository
|
|||
|
||||
/**
|
||||
* Holder for listing of allowed IPs when creating a new key.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $allowed = [];
|
||||
|
||||
/**
|
||||
* The eloquent model for a user.
|
||||
*
|
||||
* @var \Pterodactyl\Models\User
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Constructor for API Repository.
|
||||
*
|
||||
* @param null|\Pterodactyl\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Models\User $user = null)
|
||||
{
|
||||
|
@ -109,12 +119,11 @@ class APIRepository
|
|||
/**
|
||||
* Create a New API Keypair on the system.
|
||||
*
|
||||
* @param array $data An array with a permissions and allowed_ips key.
|
||||
* @param array $data
|
||||
* @return string
|
||||
*
|
||||
* @throws Pterodactyl\Exceptions\DisplayException if there was an error that can be safely displayed to end-users.
|
||||
* @throws Pterodactyl\Exceptions\DisplayValidationException if there was a validation error.
|
||||
*
|
||||
* @return string Returns the generated secret token.
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
|
@ -213,11 +222,10 @@ class APIRepository
|
|||
/**
|
||||
* Revokes an API key and associated permissions.
|
||||
*
|
||||
* @param string $key The public key.
|
||||
*
|
||||
* @throws Illuminate\Database\Eloquent\ModelNotFoundException
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
||||
*/
|
||||
public function revoke($key)
|
||||
{
|
||||
|
|
|
@ -30,19 +30,32 @@ use Pterodactyl\Exceptions\DisplayException;
|
|||
|
||||
class CommandRepository
|
||||
{
|
||||
/**
|
||||
* The Eloquent Model associated with the requested server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Constuctor for repository.
|
||||
*
|
||||
* @param int|\Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($server)
|
||||
{
|
||||
$this->server = ($server instanceof Models\Server) ? $server : Models\Server::findOrFail($server);
|
||||
}
|
||||
|
||||
/**
|
||||
* [send description].
|
||||
* Sends a command to the daemon.
|
||||
*
|
||||
* @param string $command
|
||||
* @return bool
|
||||
* @throws DisplayException
|
||||
* @throws RequestException
|
||||
* @return string
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
*/
|
||||
public function send($command)
|
||||
{
|
||||
|
|
|
@ -35,14 +35,15 @@ class FileRepository
|
|||
/**
|
||||
* The Eloquent Model associated with the requested server.
|
||||
*
|
||||
* @var \Illuminate\Database\Eloquent\Model
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $server The server Short UUID
|
||||
* @param string $uuid
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($uuid)
|
||||
{
|
||||
|
@ -54,6 +55,9 @@ class FileRepository
|
|||
*
|
||||
* @param string $file
|
||||
* @return array
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function returnFileContents($file)
|
||||
{
|
||||
|
@ -98,6 +102,9 @@ class FileRepository
|
|||
* @param string $file
|
||||
* @param string $content
|
||||
* @return bool
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function saveFileContents($file, $content)
|
||||
{
|
||||
|
@ -127,6 +134,9 @@ class FileRepository
|
|||
*
|
||||
* @param string $directory
|
||||
* @return object
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function returnDirectoryListing($directory)
|
||||
{
|
||||
|
|
|
@ -29,13 +29,33 @@ use Pterodactyl\Exceptions\DisplayException;
|
|||
|
||||
class PowerRepository
|
||||
{
|
||||
/**
|
||||
* The Eloquent Model associated with the requested server.
|
||||
*
|
||||
* @var \Pterodactyl\Models\Server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Constuctor for repository.
|
||||
*
|
||||
* @param int|\Pterodactyl\Models\Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($server)
|
||||
{
|
||||
$this->server = ($server instanceof Models\Server) ? $server : Models\Server::findOrFail($server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a power option to the daemon.
|
||||
*
|
||||
* @param string $action
|
||||
* @return string
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function do($action)
|
||||
{
|
||||
// We don't use the user's specific daemon secret here since we
|
||||
|
@ -58,21 +78,41 @@ class PowerRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function start()
|
||||
{
|
||||
$this->do('start');
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops a server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function stop()
|
||||
{
|
||||
$this->do('stop');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restarts a server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function restart()
|
||||
{
|
||||
$this->do('restart');
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills a server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function kill()
|
||||
{
|
||||
$this->do('kill');
|
||||
|
|
|
@ -204,7 +204,7 @@ class DatabaseRepository
|
|||
/**
|
||||
* Deletes a database host from the system if it has no associated databases.
|
||||
*
|
||||
* @param int $server
|
||||
* @param int $id
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
|
|
@ -28,6 +28,7 @@ class HelperRepository
|
|||
{
|
||||
/**
|
||||
* Listing of editable files in the control panel.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $editable = [
|
||||
|
@ -44,17 +45,13 @@ class HelperRepository
|
|||
'inode/x-empty',
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from bytes to the largest possible size that is still readable.
|
||||
*
|
||||
* @param int $bytes
|
||||
* @param int $decimals
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
public static function bytesToHuman($bytes, $decimals = 2)
|
||||
{
|
||||
|
@ -64,6 +61,11 @@ class HelperRepository
|
|||
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . $sz[$factor];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of editable files.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function editableFiles()
|
||||
{
|
||||
return self::$editable;
|
||||
|
|
|
@ -35,8 +35,9 @@ class LocationRepository
|
|||
* Creates a new location on the system.
|
||||
*
|
||||
* @param array $data
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
* @return \Pterodactyl\Models\Location
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
|
@ -62,7 +63,7 @@ class LocationRepository
|
|||
* @param array $data
|
||||
* @return \Pterodactyl\Models\Location
|
||||
*
|
||||
* @throws Pterodactyl\Exceptions\DisplayValidationException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function update($id, array $data)
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ class LocationRepository
|
|||
* @param int $id
|
||||
* @return void
|
||||
*
|
||||
* @throws Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
|
|
|
@ -34,11 +34,15 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class NodeRepository
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new node on the system.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Pterodactyl\Models\Node
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
// Validate Fields
|
||||
|
@ -84,6 +88,16 @@ class NodeRepository
|
|||
return Models\Node::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a node on the system.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @return \Pterodactyl\Models\Node
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function update($id, array $data)
|
||||
{
|
||||
$node = Models\Node::findOrFail($id);
|
||||
|
@ -179,8 +193,13 @@ class NodeRepository
|
|||
|
||||
/**
|
||||
* Adds allocations to a provided node.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function addAllocations($id, array $data)
|
||||
{
|
||||
|
@ -243,6 +262,14 @@ class NodeRepository
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a node on the system.
|
||||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$node = Models\Node::withCount('servers')->findOrFail($id);
|
||||
|
|
|
@ -37,21 +37,21 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class ServerRepository
|
||||
{
|
||||
/**
|
||||
* An array of daemon permission to assign to this server.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $daemonPermissions = [
|
||||
's:*',
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SFTP username for a server given a server name.
|
||||
* format: mumble_67c7a4b0.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $identifier
|
||||
* @param null|string $identifier
|
||||
* @return string
|
||||
*/
|
||||
protected function generateSFTPUsername($name, $identifier = null)
|
||||
|
@ -75,8 +75,12 @@ class ServerRepository
|
|||
|
||||
/**
|
||||
* Adds a new server to the system.
|
||||
* @param array $data An array of data descriptors for creating the server. These should align to the columns in the database.
|
||||
* @return int
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Pterodactyl\Models\Server
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
|
@ -341,10 +345,14 @@ class ServerRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* [updateDetails description].
|
||||
* Update the details for a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function updateDetails($id, array $data)
|
||||
{
|
||||
|
@ -424,10 +432,14 @@ class ServerRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* [updateContainer description].
|
||||
* Update the container for a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function updateContainer($id, array $data)
|
||||
{
|
||||
|
@ -472,10 +484,14 @@ class ServerRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* [changeBuild description].
|
||||
* Update the build details for a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @return bool
|
||||
* @return \Pterodactyl\Models\Server
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function changeBuild($id, array $data)
|
||||
{
|
||||
|
@ -614,6 +630,18 @@ class ServerRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the startup details for a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @param bool $admin
|
||||
* @return void
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function updateStartup($id, array $data, $admin = false)
|
||||
{
|
||||
$server = Models\Server::with('variables', 'option.variables')->findOrFail($id);
|
||||
|
@ -691,25 +719,34 @@ class ServerRepository
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a server for deletion
|
||||
*
|
||||
* @param int $id
|
||||
* @param bool $force
|
||||
* @return void
|
||||
*/
|
||||
public function queueDeletion($id, $force = false)
|
||||
{
|
||||
$server = Models\Server::findOrFail($id);
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
if ($force) {
|
||||
$server->installed = 3;
|
||||
DB::transaction(function () use ($force, $server) {
|
||||
$server->installed = $force ? 3 : $server->installed;
|
||||
$server->save();
|
||||
}
|
||||
|
||||
$server->delete();
|
||||
|
||||
return DB::commit();
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollBack();
|
||||
throw $ex;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a server from the system permanetly.
|
||||
*
|
||||
* @param int $id
|
||||
* @param bool $force
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete($id, $force = false)
|
||||
{
|
||||
$server = Models\Server::withTrashed()->with('node', 'allocations', 'variables')->findOrFail($id);
|
||||
|
@ -774,6 +811,12 @@ class ServerRepository
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the deletion of a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function cancelDeletion($id)
|
||||
{
|
||||
$server = Models\Server::withTrashed()->findOrFail($id);
|
||||
|
@ -783,6 +826,14 @@ class ServerRepository
|
|||
$server->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the install status of a serve.
|
||||
*
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function toggleInstall($id)
|
||||
{
|
||||
$server = Models\Server::findOrFail($id);
|
||||
|
@ -795,9 +846,13 @@ class ServerRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Suspends a server instance making it unable to be booted or used by a user.
|
||||
* Suspends a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @return bool
|
||||
* @param bool $deleted
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function suspend($id, $deleted = false)
|
||||
{
|
||||
|
@ -831,9 +886,12 @@ class ServerRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Unsuspends a server instance.
|
||||
* Unsuspends a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @return bool
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function unsuspend($id)
|
||||
{
|
||||
|
@ -866,6 +924,16 @@ class ServerRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the SFTP password for a server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param string $password
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function updateSFTPPassword($id, $password)
|
||||
{
|
||||
$server = Models\Server::with('node')->findOrFail($id);
|
||||
|
|
|
@ -37,6 +37,8 @@ class ServiceRepository
|
|||
*
|
||||
* @param array $data
|
||||
* @return \Pterodactyl\Models\Service
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
|
@ -80,6 +82,8 @@ class ServiceRepository
|
|||
* @param int $id
|
||||
* @param array $data
|
||||
* @return \Pterodactyl\Models\Service
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function update($id, array $data)
|
||||
{
|
||||
|
@ -109,6 +113,8 @@ class ServiceRepository
|
|||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ class SubuserRepository
|
|||
* Core permissions required for every subuser on the daemon.
|
||||
* Without this we cannot connect the websocket or get basic
|
||||
* information about the server.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $coreDaemonPermissions = [
|
||||
|
@ -46,6 +47,7 @@ class SubuserRepository
|
|||
|
||||
/**
|
||||
* Allowed permissions and their related daemon permission.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $permissions = [
|
||||
|
@ -99,18 +101,15 @@ class SubuserRepository
|
|||
'reset-db-password' => null,
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new subuser on the server.
|
||||
* @param int $id The ID of the server to add this subuser to.
|
||||
*
|
||||
* @param int $sid
|
||||
* @param array $data
|
||||
* @throws DisplayValidationException
|
||||
* @throws DisplayException
|
||||
* @return \Pterodactyl\Models\Subuser
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create($sid, array $data)
|
||||
{
|
||||
|
@ -202,11 +201,11 @@ class SubuserRepository
|
|||
|
||||
/**
|
||||
* Revokes a users permissions on a server.
|
||||
* @param int $id The ID of the subuser row in MySQL.
|
||||
* @param array $data
|
||||
* @throws DisplayValidationException
|
||||
* @throws DisplayException
|
||||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
|
@ -232,8 +231,6 @@ class SubuserRepository
|
|||
}
|
||||
$subuser->delete();
|
||||
DB::commit();
|
||||
|
||||
return true;
|
||||
} catch (\GuzzleHttp\Exception\TransferException $ex) {
|
||||
DB::rollBack();
|
||||
throw new DisplayException('There was an error attempting to connect to the daemon to delete this subuser.', $ex);
|
||||
|
@ -241,17 +238,17 @@ class SubuserRepository
|
|||
DB::rollBack();
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates permissions for a given subuser.
|
||||
* @param int $id The ID of the subuser row in MySQL. (Not the user ID)
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @throws DisplayValidationException
|
||||
* @throws DisplayException
|
||||
* @return void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function update($id, array $data)
|
||||
{
|
||||
|
@ -304,8 +301,6 @@ class SubuserRepository
|
|||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return true;
|
||||
} catch (\GuzzleHttp\Exception\TransferException $ex) {
|
||||
DB::rollBack();
|
||||
throw new DisplayException('There was an error attempting to connect to the daemon to update permissions.', $ex);
|
||||
|
@ -313,7 +308,5 @@ class SubuserRepository
|
|||
DB::rollBack();
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,11 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class TaskRepository
|
||||
{
|
||||
/**
|
||||
* The default values to use for new tasks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $defaults = [
|
||||
'year' => '*',
|
||||
'day_of_week' => '*',
|
||||
|
@ -41,20 +46,20 @@ class TaskRepository
|
|||
'minute' => '*/30',
|
||||
];
|
||||
|
||||
/**
|
||||
* Task action types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $actions = [
|
||||
'command',
|
||||
'power',
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a given task.
|
||||
* @param int $id
|
||||
*
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($id)
|
||||
|
@ -71,8 +76,8 @@ class TaskRepository
|
|||
|
||||
/**
|
||||
* Toggles a task active or inactive.
|
||||
* @param int $id
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
*/
|
||||
public function toggle($id)
|
||||
|
@ -91,12 +96,13 @@ class TaskRepository
|
|||
|
||||
/**
|
||||
* Create a new scheduled task for a given server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*
|
||||
* @throws DisplayException
|
||||
* @throws DisplayValidationException
|
||||
* @return void
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create($id, $data)
|
||||
{
|
||||
|
|
|
@ -38,19 +38,13 @@ use Pterodactyl\Exceptions\DisplayValidationException;
|
|||
|
||||
class UserRepository
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a user on the panel. Returns the created user's ID.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string|null $password An unhashed version of the user's password.
|
||||
* @param bool $admin Boolean value if user should be an admin or not.
|
||||
* @param int $token A custom user ID.
|
||||
* @return bool|int
|
||||
* @param array $data
|
||||
* @return \Pterodactyl\Models\User
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
|
@ -119,8 +113,10 @@ class UserRepository
|
|||
* Updates a user on the panel.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data An array of columns and their associated values to update for the user.
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayValidationException
|
||||
*/
|
||||
public function update($id, array $data)
|
||||
{
|
||||
|
@ -157,10 +153,13 @@ class UserRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes a user on the panel, returns the number of records deleted.
|
||||
* Deletes a user on the panel.
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
* @return void
|
||||
* @todo Move user self-deletion checking to the controller, rather than the repository.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
|
@ -168,8 +167,7 @@ class UserRepository
|
|||
throw new DisplayException('Cannot delete a user with active servers attached to thier account.');
|
||||
}
|
||||
|
||||
// @TODO: this should probably be checked outside of this method because we won't always have Auth::user()
|
||||
if (! is_null(Auth::user()) && Auth::user()->id === $id) {
|
||||
if (! is_null(Auth::user()) && (int) Auth::user()->id === (int) $id) {
|
||||
throw new DisplayException('Cannot delete your own account.');
|
||||
}
|
||||
|
||||
|
@ -186,8 +184,6 @@ class UserRepository
|
|||
|
||||
Models\User::destroy($id);
|
||||
DB::commit();
|
||||
|
||||
return true;
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollBack();
|
||||
throw $ex;
|
||||
|
|
|
@ -30,11 +30,14 @@ use Pterodactyl\Models\APILog;
|
|||
|
||||
class APILogService
|
||||
{
|
||||
public function __constructor()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an API Request
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param null|string $error
|
||||
* @param bool $authorized
|
||||
* @return void
|
||||
*/
|
||||
public static function log(Request $request, $error = null, $authorized = false)
|
||||
{
|
||||
if ($request->bearerToken() && ! empty($request->bearerToken())) {
|
||||
|
|
|
@ -30,20 +30,13 @@ use Pterodactyl\Exceptions\DisplayException;
|
|||
|
||||
class DeploymentService
|
||||
{
|
||||
public function __constructor()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a random location model. DO NOT USE.
|
||||
* @return \Pterodactyl\Models\Node
|
||||
*
|
||||
* @TODO Actually make this smarter. If we're selecting a random location
|
||||
* @return \Pterodactyl\Models\Node
|
||||
* @todo Actually make this smarter. If we're selecting a random location
|
||||
* but then it has no nodes we should probably continue attempting all locations
|
||||
* until we hit one.
|
||||
*
|
||||
* Currently you should just pick a location and go from there.
|
||||
*/
|
||||
public static function randomLocation()
|
||||
{
|
||||
|
@ -78,7 +71,7 @@ class DeploymentService
|
|||
* over allocation limits.
|
||||
* @param int $memory
|
||||
* @param int $disk
|
||||
* @param int $location
|
||||
* @param null|int $location
|
||||
* @return \Pterodactyl\Models\Node
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
|
|
@ -29,21 +29,13 @@ use Uuid;
|
|||
|
||||
class UuidService
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique UUID validating against specified table and column.
|
||||
* Defaults to `users.uuid`.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $field
|
||||
* @param int $type The type of UUID to generate.
|
||||
* @param int $type
|
||||
* @return string
|
||||
*/
|
||||
public function generate($table = 'users', $field = 'uuid', $type = 4)
|
||||
|
@ -64,6 +56,7 @@ class UuidService
|
|||
*
|
||||
* @param string $table
|
||||
* @param string $field
|
||||
* @param null|string $attachedUuid
|
||||
* @return string
|
||||
*/
|
||||
public function generateShort($table = 'servers', $field = 'uuidShort', $attachedUuid = null)
|
||||
|
|
|
@ -29,10 +29,17 @@ use GuzzleHttp\Client;
|
|||
|
||||
class VersionService
|
||||
{
|
||||
/**
|
||||
* The cached CDN response.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected static $versions;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Version constructor.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -58,26 +65,51 @@ class VersionService
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current panel version from CDN.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getPanel()
|
||||
{
|
||||
return self::$versions->panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current daemon version from CDN.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDaemon()
|
||||
{
|
||||
return self::$versions->daemon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Discord link from CDN.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDiscord()
|
||||
{
|
||||
return self::$versions->discord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current panel version.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCurrentPanel()
|
||||
{
|
||||
return config('app.version');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if panel is latest version.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLatestPanel()
|
||||
{
|
||||
if (config('app.version') === 'canary') {
|
||||
|
@ -87,6 +119,11 @@ class VersionService
|
|||
return version_compare(config('app.version'), self::$versions->panel) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if daemon is latest version.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLatestDaemon($daemon)
|
||||
{
|
||||
if ($daemon === '0.0.0-canary') {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
<?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\Transformers;
|
||||
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class AllocationTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Turn this item object into a generic array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Allocation $allocation)
|
||||
{
|
||||
return array_except($allocation, ['created_at', 'updated_at']);
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?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\Transformers;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class NodeTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Turn this item object into a generic array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Node $node)
|
||||
{
|
||||
return $node;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?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\Transformers;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class ServerTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Turn this item object into a generic array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Server $server)
|
||||
{
|
||||
return $server;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?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\Transformers;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class UserTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Turn this item object into a generic array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(User $user)
|
||||
{
|
||||
return $user;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue