Update doc blocks for all app/
This commit is contained in:
parent
5e27772fef
commit
0312c974f5
114 changed files with 1360 additions and 949 deletions
|
@ -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()
|
||||
{
|
||||
|
@ -52,8 +45,8 @@ class DeploymentService
|
|||
|
||||
/**
|
||||
* Return a model instance of a random node.
|
||||
* @param int $location
|
||||
* @param array $not
|
||||
* @param int $location
|
||||
* @param array $not
|
||||
* @return \Pterodactyl\Models\Node
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -76,9 +69,9 @@ class DeploymentService
|
|||
/**
|
||||
* Selects a random node ensuring it does not put the node
|
||||
* over allocation limits.
|
||||
* @param int $memory
|
||||
* @param int $disk
|
||||
* @param int $location
|
||||
* @param int $memory
|
||||
* @param int $disk
|
||||
* @param null|int $location
|
||||
* @return \Pterodactyl\Models\Node
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -102,7 +95,7 @@ class DeploymentService
|
|||
|
||||
/**
|
||||
* Returns a random allocation for a node.
|
||||
* @param int $node
|
||||
* @param int $node
|
||||
* @return \Models\Pterodactyl\Allocation
|
||||
*/
|
||||
public static function randomAllocation($node)
|
||||
|
@ -118,8 +111,8 @@ class DeploymentService
|
|||
/**
|
||||
* Checks that a node's allocation limits will not be passed with the given information.
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param int $memory
|
||||
* @param int $disk
|
||||
* @param int $memory
|
||||
* @param int $disk
|
||||
* @return bool Returns true if this information would not put the node over it's limit.
|
||||
*/
|
||||
protected static function checkNodeAllocation(Models\Node $node, $memory, $disk)
|
||||
|
|
|
@ -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 string $table
|
||||
* @param string $field
|
||||
* @param int $type
|
||||
* @return string
|
||||
*/
|
||||
public function generate($table = 'users', $field = 'uuid', $type = 4)
|
||||
|
@ -62,8 +54,9 @@ class UuidService
|
|||
/**
|
||||
* Generates a ShortUUID code which is 8 characters long and is used for identifying servers in the system.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $field
|
||||
* @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') {
|
||||
|
|
Reference in a new issue