Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/stanjg/panel into featur…
Browse files Browse the repository at this point in the history
…e/user-specific-language
  • Loading branch information
stanjg committed Jun 1, 2018
2 parents 28e34f7 + d7ab24a commit 3bb9e5e
Show file tree
Hide file tree
Showing 199 changed files with 2,384 additions and 1,173 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ APP_TIMEZONE=America/New_York
APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_ENVIRONMENT_ONLY=true
LOG_CHANNEL=daily

APP_LOCALE=en
APP_LOCALE_IS_GLOBAL=false
Expand Down
80 changes: 51 additions & 29 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ We're glad you want to help us out and make this panel the best that it can be!
### Project Branches
This section mainly applies to those with read/write access to our repositories, but can be helpful for others.

The `develop` branch should always be in a runnable state, and not contain any major breaking features. For the most part this means you will need to create `feature/` branches in order to add new functionality, or change how things work. When making a feature branch, if it is referencing something in the issue tracker, please title the branch `feature/PTDL-###` where `###` is the issue number.
The `develop` branch should always be in a runnable state, and not contain any major breaking features. For the most part, this means you will need to create `feature/` branches in order to add new functionality or change how things work. When making a feature branch, if it is referencing something in the issue tracker, please title the branch `feature/PTDL-###` where `###` is the issue number.

Moving forward all commits from contributors should be in the form of a PR, unless it is something we have previous discussed as being able to be pushed right into `develop`.
Moving forward all commits from contributors should be in the form of a PR, unless it is something we have previously discussed as being able to be pushed right into `develop`.

All new code should contain unit tests at minimum (where applicable). There is a lot of un-covered code currently, so as you are doing things please be looking for places that you can write tests.
All new code should contain unit tests at a minimum (where applicable). There is a lot of uncovered code currently, so as you are doing things please be looking for places that you can write tests.

### Update the CHANGELOG
When adding something that is new, fixed, changed, or security related for the next release you should be adding a note to the CHANGELOG. If something is changing within the same version (i.e. fixing a bug introduced but not released) it should _not_ go into the CHANGELOG.
When adding something that is new, fixed, changed, or security-related for the next release you should be adding a note to the CHANGELOG. If something is changing within the same version (i.e. fixing a bug introduced but not released) it should _not_ go into the CHANGELOG.

### Code Guidelines
We are a `PSR-4` and `PSR-0` compliant project, so please follow those guidelines at a minimum. In addition, StyleCI runs on all of our code to ensure the formatting is standardized across everything. When a PR is made StyleCI will analyze your code and make a pull to that branch if necessary to fix any formatting issues. This project also ships with a PHP-CS configuration file and you are welcome to configure your local environment to make use of that.
Expand All @@ -32,13 +32,13 @@ class ProcessScheduleService
```

### Responsible Disclosure
This is a fairly in-depth project, and makes use of a lot of parts. We strive to keep everything as secure as possible, and welcome you to take a look into it yourself. We do ask that you be considerate of others who are using the software and not publicly disclose security issues without contacting us first by email.
This is a fairly in-depth project and makes use of a lot of parts. We strive to keep everything as secure as possible and welcome you to take a look at the code provided in this project yourself. We do ask that you be considerate of others who are using the software and not publicly disclose security issues without contacting us first by email.

We'll make a deal with you: if you contact us by email and we fail to respond to you within a week you are welcome to publicly disclose whatever issue you have found. We understand how frustrating it is when you find something big and no one will respond to you. This holds us to a standard of providing prompt attention to any issues that arise and keeping this community safe.

If you've found what you believe is a security issue please email us at `[email protected]`.

### Where to find Us
You can find us in a couple places online. First and foremost, we're active right here on Github. If you encounter a bug or other problem open an issue on here for us to take a look at it. We also accept feature requests here as well.
You can find us in a couple places online. First and foremost, we're active right here on Github. If you encounter a bug or other problems, open an issue on here for us to take a look at it. We also accept feature requests here as well.

You can also find us on [Discord](https://pterodactyl.io/discord). In the event that you need to get in contact with us privately feel free to contact us at `[email protected]`. Try not to email us with requests for support regarding the panel, we'll probably just direct you to our Discord.
2 changes: 1 addition & 1 deletion app/Console/Commands/Environment/AppSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class AppSettingsCommand extends Command
* @var string
*/
protected $signature = 'p:environment:setup
{--new-salt : Wether or not to generate a new salt for Hashids.}
{--new-salt : Whether or not to generate a new salt for Hashids.}
{--author= : The email that services created on this instance should be linked to.}
{--url= : The URL that this Panel is running on.}
{--timezone= : The timezone to use for Panel times.}
Expand Down
1 change: 1 addition & 0 deletions app/Console/Commands/Environment/EmailSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function __construct(ConfigRepository $config)

/**
* Handle command execution.
* @throws \Pterodactyl\Exceptions\PterodactylException
*/
public function handle()
{
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/InfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function handle()
['Host', $this->config->get("database.connections.{$driver}.host")],
['Port', $this->config->get("database.connections.{$driver}.port")],
['Database', $this->config->get("database.connections.{$driver}.database")],
['Usernamne', $this->config->get("database.connections.{$driver}.username")],
['Username', $this->config->get("database.connections.{$driver}.username")],
], 'compact');

$this->output->title('Email Configuration');
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/Server/BulkPowerActionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class BulkPowerActionCommand extends Command
*/
protected $signature = 'p:server:bulk-power
{action : The action to perform (start, stop, restart, kill)}
{--servers= : A comma seperated list of servers.}
{--nodes= : A comma seperated list of nodes.}';
{--servers= : A comma separated list of servers.}
{--nodes= : A comma separated list of nodes.}';

/**
* @var string
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Repository/AllocationRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getUnassignedAllocationIds(int $node): array;
public function getAssignedAllocationIds(int $server): array;

/**
* Return a concated result set of node ips that already have at least one
* Return a concatenated result set of node ips that already have at least one
* server assigned to that IP. This allows for filtering out sets for
* dedicated allocation IPs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function unsuspend(): ResponseInterface;
public function delete(): ResponseInterface;

/**
* Return detials on a specific server.
* Return details on a specific server.
*
* @return \Psr\Http\Message\ResponseInterface
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Repository/DatabaseRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
public function setConnection(string $connection);

/**
* Return the connection to execute statements aganist.
* Return the connection to execute statements against.
*
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Repository/EggRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ public function getWithExportAttributes(int $id): Egg;
* @param int $service
* @return bool
*/
public function isCopiableScript(int $copyFromId, int $service): bool;
public function isCopyableScript(int $copyFromId, int $service): bool;
}
8 changes: 8 additions & 0 deletions app/Contracts/Repository/NodeRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ interface NodeRepositoryInterface extends RepositoryInterface, SearchableInterfa
*/
public function getUsageStats(Node $node): array;

/**
* Return the usage stats for a single node.
*
* @param \Pterodactyl\Models\Node $node
* @return array
*/
public function getUsageStatsRaw(Node $node): array;

/**
* Return all available nodes with a searchable interface.
*
Expand Down
11 changes: 9 additions & 2 deletions app/Contracts/Repository/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getModel();
public function getBuilder();

/**
* Returns the colummns to be selected or returned by the query.
* Returns the columns to be selected or returned by the query.
*
* @return mixed
*/
Expand Down Expand Up @@ -59,7 +59,7 @@ public function withoutFreshModel();
public function withFreshModel();

/**
* Set wether or not the repository should return a fresh model
* Set whether or not the repository should return a fresh model
* when changes are committed.
*
* @param bool $fresh
Expand Down Expand Up @@ -200,4 +200,11 @@ public function insert(array $data): bool;
* @return bool
*/
public function insertIgnore(array $values): bool;

/**
* Get the amount of entries in the database
*
* @return int
*/
public function count(): int;
}
9 changes: 8 additions & 1 deletion app/Contracts/Repository/ServerRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function filterUserAccessServers(User $user, int $level, bool $paginate =
public function getByUuid(string $uuid): Server;

/**
* Return all of the servers that should have a power action performed aganist them.
* Return all of the servers that should have a power action performed against them.
*
* @param int[] $servers
* @param int[] $nodes
Expand All @@ -145,4 +145,11 @@ public function getServersForPowerActionCount(array $servers = [], array $nodes
* @return bool
*/
public function isUniqueUuidCombo(string $uuid, string $short): bool;

/**
* Get the amount of servers that are suspended
*
* @return int
*/
public function getSuspendedServersCount(): int;
}
4 changes: 2 additions & 2 deletions app/Contracts/Repository/UserRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function getAllUsersWithCounts(): LengthAwarePaginator;
/**
* Return all matching models for a user in a format that can be used for dropdowns.
*
* @param string $query
* @param string|null $query
* @return \Illuminate\Support\Collection
*/
public function filterUsersByQuery(string $query): Collection;
public function filterUsersByQuery(?string $query): Collection;
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/Remote/EggRetrievalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
}

/**
* Return a JSON array of Eggs and the SHA1 hash of thier configuration file.
* Return a JSON array of Eggs and the SHA1 hash of their configuration file.
*
* @return \Illuminate\Http\JsonResponse
*/
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/Admin/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function index(Request $request): View
* Render view allowing an admin to create a new application API key.
*
* @return \Illuminate\View\View
* @throws \ReflectionException
*/
public function create(): View
{
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Controllers/Admin/LocationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public function view($id)
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
* @throws \Watson\Validating\ValidationException
*/
public function create(LocationFormRequest $request)
{
Expand All @@ -121,7 +120,6 @@ public function create(LocationFormRequest $request)
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
* @throws \Watson\Validating\ValidationException
*/
public function update(LocationFormRequest $request, Location $location)
{
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/Admin/Nests/EggVariableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ public function view(int $egg): View
* Handle a request to create a new Egg variable.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request
* @param \Pterodactyl\Models\Egg $egg
* @param \Pterodactyl\Models\Egg $egg
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException
*/
public function store(EggVariableFormRequest $request, Egg $egg): RedirectResponse
Expand Down
19 changes: 13 additions & 6 deletions app/Http/Controllers/Admin/ServersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest;

class ServersController extends Controller
{
Expand Down Expand Up @@ -375,9 +376,15 @@ public function viewDatabase(Server $server)
*
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function viewManage(Server $server)
{
if ($server->installed > 1) {
throw new DisplayException('This server is in a failed installation state and must be deleted and recreated.');
}

return view('admin.servers.view.manage', ['server' => $server]);
}

Expand Down Expand Up @@ -462,6 +469,7 @@ public function reinstallServer(Server $server)
*
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function rebuildContainer(Server $server)
{
Expand Down Expand Up @@ -540,7 +548,8 @@ public function delete(Request $request, Server $server)
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Illuminate\Validation\ValidationException
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
Expand All @@ -556,15 +565,13 @@ public function saveStartup(Request $request, Server $server)
/**
* Creates a new database assigned to a specific server.
*
* @param \Illuminate\Http\Request $request
* @param int $server
* @param \Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest $request
* @param int $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Exception
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function newDatabase(Request $request, $server)
public function newDatabase(StoreServerDatabaseRequest $request, $server)
{
$this->databaseManagementService->create($server, [
'database' => $request->input('database'),
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Admin/Settings/AdvancedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function index(): View
/**
* @param \Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function update(AdvancedSettingsFormRequest $request): RedirectResponse
{
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Admin/Settings/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public function index(): View
*
* @param \Pterodactyl\Http\Requests\Admin\Settings\BaseSettingsFormRequest $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function update(BaseSettingsFormRequest $request): RedirectResponse
{
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Admin/Settings/MailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public function index(): View
* @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function update(MailSettingsFormRequest $request): RedirectResponse
{
Expand Down
Loading

0 comments on commit 3bb9e5e

Please sign in to comment.