Skip to content

Commit bde4d41

Browse files
committed
Merge branch 'develop' into feature/api-integration-testing
2 parents ac9f83a + 3766a77 commit bde4d41

File tree

61 files changed

+1010
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1010
-446
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<!---
22
Please take a little time to submit a good issue. It makes our life easier and the issue will be resolved quicker.
33
4+
!!! GitHub is NOT the place for difficulties setting up this software. Please use it for bugs and feature requests only. If you have issues setting up the panel or the daemon visit our Discord server: https://pterodactyl.io/discord
5+
46
If you are submitting a feature request please remove everything in here. Then give a detailed explanation what you want to have implemented and why that would be a good addition.
57
68
Please also try to give the issue a good title: It should summarize your issue in a few words and help us see what the issue is about in a glance. Things like "Panel is not working" do not help.

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,36 @@ This file is a running track of new features and fixes to each version of the pa
33

44
This project follows [Semantic Versioning](http://semver.org) guidelines.
55

6+
## v0.7.7 (Derelict Dermodactylus)
7+
### Fixed
8+
* Fixes an issue with the sidebar logo not working correctly in some browsers due to the CSS being assigned.
9+
10+
### Added
11+
* Added a new client API endpoint for gathering the utilization stats for servers including disk, cpu, and memory. `GET /api/client/servers/<id>/utilization`
12+
* Added validation to variable validation rules to validate that the validation rules are valid because we heard you like validating your validation.
13+
14+
## v0.7.6 (Derelict Dermodactylus)
15+
### Fixed
16+
* Fixes a UI error when attempting to change the default Nest and Egg for an existing server.
17+
* Correct permissions check in UI to allow subusers with permission to `view-allocations` the ability to actually see the sidebar link.
18+
* Fixes improper behavior when marking an egg as copying the configuration from another.
19+
* Debug bar is only checked when the app is set to debug mode in the API session handler, rather than when it is in local mode to match the plugin settings.
20+
* Added validation to port allocations to prevent allocation of restricted or invalid ports.
21+
* Fix data integrity exception thrown when attempting to store updated server egg variables.
22+
* Added missing permissions check on 'SFTP Configuration' page to ensure user has permission to access a server's SFTP server before showing a user credentials.
23+
24+
### Added
25+
* Added ability for end users to change the name of their server through the UI. This option is only open to the server owner or an admin.
26+
* Added giant warning message if you attempt to change an encryption key once one has been set.
27+
28+
### Changed
29+
* Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline.
30+
* Sessions handled through redis now use a seperate database (default `1`) to store session database to avoid logging users out when flushing the cache.
31+
* File manager UI improved to be clearer with buttons and cleaner on mobile.
32+
* reCAPTCHA's secret key position swapped with website key in advanced panel settings to be consistent with Google's reCAPTCHA dashboard.
33+
* Changed DisplayException to handle its own logging correctly and check if the previous exception is marked as one that should not be logged.
34+
* Changed 'New Folder' modal in file manager to include a trailing slash.
35+
636
## v0.7.5 (Derelict Dermodactylus)
737
### Fixed
838
* Fixes application API keys being created as a client API key.

Vagrantfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
Vagrant.configure("2") do |config|
2-
config.vm.box = "ubuntu/xenial64"
2+
config.vm.box = "bento/ubuntu-16.04"
33

44
config.vm.synced_folder "./", "/var/www/html/pterodactyl",
55
owner: "www-data", group: "www-data"
66

7-
#config.vm.provision :file, source: ".dev/vagrant/pterdactyl.conf", destination: "/etc/nginx/sites-available/pterodactyl.conf"
8-
#config.vm.provision :file, source: ".dev/vagrant/pteroq.service", destination: "/etc/systemd/system/pteroq.service"
9-
#config.vm.provision :file, source: ".dev/vagrant/mailhog.service", destination: "/etc/systemd/system/mailhog.service"
10-
#config.vm.provision :file, source: ".dev/vagrant/.env", destination: "/var/www/html/pterodactyl/.env"
117
config.vm.provision :shell, path: ".dev/vagrant/provision.sh"
128

139
config.vm.network :private_network, ip: "192.168.50.2"
@@ -16,6 +12,6 @@ Vagrant.configure("2") do |config|
1612
config.vm.network :forwarded_port, guest: 3306, host: 53306
1713

1814
# Config for the vagrant-dns plugin (https://github.com/BerlinVagrant/vagrant-dns)
19-
config.dns.tld = "app"
20-
config.dns.patterns = [/^pterodactyl.app$/]
15+
config.dns.tld = "test"
16+
config.dns.patterns = [/^pterodactyl.test$/]
2117
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Pterodactyl\Console\Commands\Overrides;
4+
5+
use Illuminate\Foundation\Console\KeyGenerateCommand as BaseKeyGenerateCommand;
6+
7+
class KeyGenerateCommand extends BaseKeyGenerateCommand
8+
{
9+
/**
10+
* Override the default Laravel key generation command to throw a warning to the user
11+
* if it appears that they have already generated an application encryption key.
12+
*/
13+
public function handle()
14+
{
15+
if (! empty(config('app.key')) && $this->input->isInteractive()) {
16+
$this->output->warning(trans('command/messages.key.warning'));
17+
if (! $this->confirm(trans('command/messages.key.confirm'))) {
18+
return;
19+
}
20+
21+
if (! $this->confirm(trans('command/messages.key.final_confirm'))) {
22+
return;
23+
}
24+
}
25+
26+
parent::handle();
27+
}
28+
}

app/Exceptions/DisplayException.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
namespace Pterodactyl\Exceptions;
44

5-
use Log;
5+
use Exception;
66
use Throwable;
7+
use Psr\Log\LoggerInterface;
78
use Illuminate\Http\Response;
9+
use Illuminate\Container\Container;
810
use Prologue\Alerts\AlertsMessageBag;
911

1012
class DisplayException extends PterodactylException
@@ -31,10 +33,6 @@ public function __construct($message, Throwable $previous = null, $level = self:
3133
{
3234
parent::__construct($message, $code, $previous);
3335

34-
if (! is_null($previous)) {
35-
Log::{$level}($previous);
36-
}
37-
3836
$this->level = $level;
3937
}
4038

@@ -70,8 +68,31 @@ public function render($request)
7068
]), method_exists($this, 'getStatusCode') ? $this->getStatusCode() : Response::HTTP_BAD_REQUEST);
7169
}
7270

73-
app()->make(AlertsMessageBag::class)->danger($this->getMessage())->flash();
71+
Container::getInstance()->make(AlertsMessageBag::class)->danger($this->getMessage())->flash();
7472

7573
return redirect()->back()->withInput();
7674
}
75+
76+
/**
77+
* Log the exception to the logs using the defined error level only if the previous
78+
* exception is set.
79+
*
80+
* @return mixed
81+
*
82+
* @throws \Exception
83+
*/
84+
public function report()
85+
{
86+
if (! $this->getPrevious() instanceof Exception || ! Handler::isReportable($this->getPrevious())) {
87+
return null;
88+
}
89+
90+
try {
91+
$logger = Container::getInstance()->make(LoggerInterface::class);
92+
} catch (Exception $ex) {
93+
throw $this->getPrevious();
94+
}
95+
96+
return $logger->{$this->getErrorLevel()}($this->getPrevious());
97+
}
7798
}

app/Exceptions/Handler.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Exception;
66
use PDOException;
77
use Psr\Log\LoggerInterface;
8+
use Illuminate\Container\Container;
89
use Illuminate\Auth\AuthenticationException;
910
use Illuminate\Session\TokenMismatchException;
1011
use Illuminate\Validation\ValidationException;
@@ -31,7 +32,6 @@ class Handler extends ExceptionHandler
3132
protected $dontReport = [
3233
AuthenticationException::class,
3334
AuthorizationException::class,
34-
DisplayException::class,
3535
HttpException::class,
3636
ModelNotFoundException::class,
3737
RecordNotFoundException::class,
@@ -210,6 +210,17 @@ public static function convertToArray(Exception $exception, array $override = []
210210
return ['errors' => [array_merge($error, $override)]];
211211
}
212212

213+
/**
214+
* Return an array of exceptions that should not be reported.
215+
*
216+
* @param \Exception $exception
217+
* @return bool
218+
*/
219+
public static function isReportable(Exception $exception): bool
220+
{
221+
return (new static(Container::getInstance()))->shouldReport($exception);
222+
}
223+
213224
/**
214225
* Convert an authentication exception into an unauthenticated response.
215226
*
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Pterodactyl\Exceptions\Service\Allocation;
4+
5+
use Pterodactyl\Exceptions\DisplayException;
6+
7+
class CidrOutOfRangeException extends DisplayException
8+
{
9+
/**
10+
* CidrOutOfRangeException constructor.
11+
*/
12+
public function __construct()
13+
{
14+
parent::__construct(trans('exceptions.allocations.cidr_out_of_range'));
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Pterodactyl\Exceptions\Service\Allocation;
4+
5+
use Pterodactyl\Exceptions\DisplayException;
6+
7+
class InvalidPortMappingException extends DisplayException
8+
{
9+
/**
10+
* InvalidPortMappingException constructor.
11+
*
12+
* @param mixed $port
13+
*/
14+
public function __construct($port)
15+
{
16+
parent::__construct(trans('exceptions.allocations.invalid_mapping', ['port' => $port]));
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Pterodactyl\Exceptions\Service\Allocation;
4+
5+
use Pterodactyl\Exceptions\DisplayException;
6+
7+
class PortOutOfRangeException extends DisplayException
8+
{
9+
/**
10+
* PortOutOfRangeException constructor.
11+
*/
12+
public function __construct()
13+
{
14+
parent::__construct(trans('exceptions.allocations.port_out_of_range'));
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Pterodactyl\Exceptions\Service\Allocation;
4+
5+
use Pterodactyl\Exceptions\DisplayException;
6+
7+
class TooManyPortsInRangeException extends DisplayException
8+
{
9+
/**
10+
* TooManyPortsInRangeException constructor.
11+
*/
12+
public function __construct()
13+
{
14+
parent::__construct(trans('exceptions.allocations.too_many_ports'));
15+
}
16+
}

0 commit comments

Comments
 (0)