Skip to content

Commit 41e27a6

Browse files
committed
Merge branch 'release/v0.7.6'
2 parents a3b47e3 + e57fbd3 commit 41e27a6

File tree

48 files changed

+631
-280
lines changed

Some content is hidden

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

48 files changed

+631
-280
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@ 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.6 (Derelict Dermodactylus)
7+
### Fixed
8+
* Fixes a UI error when attempting to change the default Nest and Egg for an existing server.
9+
* Correct permissions check in UI to allow subusers with permission to `view-allocations` the ability to actually see the sidebar link.
10+
* Fixes improper behavior when marking an egg as copying the configuration from another.
11+
* 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.
12+
* Added validation to port allocations to prevent allocation of restricted or invalid ports.
13+
* Fix data integrity exception thrown when attempting to store updated server egg variables.
14+
* 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.
15+
16+
### Added
17+
* 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.
18+
* Added giant warning message if you attempt to change an encryption key once one has been set.
19+
20+
### Changed
21+
* Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline.
22+
* Sessions handled through redis now use a seperate database (default `1`) to store session database to avoid logging users out when flushing the cache.
23+
* File manager UI improved to be clearer with buttons and cleaner on mobile.
24+
* reCAPTCHA's secret key position swapped with website key in advanced panel settings to be consistent with Google's reCAPTCHA dashboard.
25+
* Changed DisplayException to handle its own logging correctly and check if the previous exception is marked as one that should not be logged.
26+
* Changed 'New Folder' modal in file manager to include a trailing slash.
27+
628
## v0.7.5 (Derelict Dermodactylus)
729
### Fixed
830
* 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;
@@ -24,7 +25,6 @@ class Handler extends ExceptionHandler
2425
protected $dontReport = [
2526
AuthenticationException::class,
2627
AuthorizationException::class,
27-
DisplayException::class,
2828
HttpException::class,
2929
ModelNotFoundException::class,
3030
RecordNotFoundException::class,
@@ -201,6 +201,17 @@ public static function convertToArray(Exception $exception, array $override = []
201201
return ['errors' => [array_merge($error, $override)]];
202202
}
203203

204+
/**
205+
* Return an array of exceptions that should not be reported.
206+
*
207+
* @param \Exception $exception
208+
* @return bool
209+
*/
210+
public static function isReportable(Exception $exception): bool
211+
{
212+
return (new static(Container::getInstance()))->shouldReport($exception);
213+
}
214+
204215
/**
205216
* Convert an authentication exception into an unauthenticated response.
206217
*
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+
}

app/Http/Controllers/Admin/NodesController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ public function allocationSetAlias(AllocationAliasFormRequest $request)
331331
* @param int|\Pterodactyl\Models\Node $node
332332
* @return \Illuminate\Http\RedirectResponse
333333
*
334-
* @throws \Pterodactyl\Exceptions\DisplayException
334+
* @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException
335+
* @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException
336+
* @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException
337+
* @throws \Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException
335338
*/
336339
public function createAllocation(AllocationFormRequest $request, Node $node)
337340
{

0 commit comments

Comments
 (0)