Skip to content

Commit bd58750

Browse files
committed
Merge branch 'release/v0.7.15'
2 parents c741a1e + 80d337d commit bd58750

Some content is hidden

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

42 files changed

+308
-194
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,35 @@ 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.15 (Derelict Dermodactylus)
7+
### Fixed
8+
* Fixes support for PHP 7.3 when running `composer install` commands due to a dependency that needed updating.
9+
* Automatic allocation field when creating a new node (or updating one) should now properly remeber its old
10+
value when showing an error state.
11+
* Mass deleting files now executes properly and doesn't result in a JS console error.
12+
* Scrolling on email settings page now works.
13+
* Database host management will now properly display an error message to the user when there is any type of MySQL related
14+
error encountered during creation or update.
15+
* Two-factor tokens generated when a company name has a space in it will now properly be parsed on iOS authenticator devices.
16+
* Fixed 500 error when trying to request subuser's from a server in the application API.
17+
* Creating a node allocation via the API no longer requires an alias field be passed through in the request.
18+
* Bulk power management for servers via the CLI no longer fails when servers span multiple nodes.
19+
20+
### Added
21+
* Server listing view now displays the total used disk space for each server.
22+
* Client API endpoint to list all servers now supports an additional `?filter=subuser-of|all|admin|owner` parameter to
23+
return different groupings of servers. The default value is `subuser-of` which will include all of the user's servers
24+
that they are the owner of, as well as all servers they're a subuser of.
25+
* Added back ability to toggle OOM killer status on a per-server basis.
26+
* Added `LOCK TABLES` permission for generated database users.
27+
28+
### Changed
29+
* Updated Paper egg to not download `server.properties` each time. [parkervcp/eggs#260](https://github.com/parkervcp/eggs/issues/260)
30+
* Insurgency egg now uses the proper dedicated server ID.
31+
* Teamspeak egg updated with improved installation process and grabbing latest versions.
32+
* OOM killer disabled by default on all new servers.
33+
* Passwords generated for MySQL now include special characters and are 24 characters in length.
34+
635
## v0.7.14 (Derelict Dermodactylus)
736
### Fixed
837
* **[SECURITY]** Fixes an XSS vulnerability when performing certain actions in the file manager.

app/Console/Commands/Server/BulkPowerActionCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ public function handle()
102102
$bar->clear();
103103

104104
try {
105-
$this->powerRepository->setServer($server)->sendSignal($action);
105+
$this->powerRepository
106+
->setNode($server->node)
107+
->setServer($server)
108+
->sendSignal($action);
106109
} catch (RequestException $exception) {
107110
$this->output->error(trans('command/messages.server.power.action_failed', [
108111
'name' => $server->name,

app/Http/Controllers/Admin/DatabaseController.php

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

33
namespace Pterodactyl\Http\Controllers\Admin;
44

5+
use Exception;
56
use PDOException;
67
use Illuminate\View\View;
78
use Pterodactyl\Models\DatabaseHost;
@@ -118,17 +119,22 @@ public function view(int $host): View
118119
* @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request
119120
* @return \Illuminate\Http\RedirectResponse
120121
*
121-
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
122-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
122+
* @throws \Throwable
123123
*/
124124
public function create(DatabaseHostFormRequest $request): RedirectResponse
125125
{
126126
try {
127127
$host = $this->creationService->handle($request->normalize());
128-
} catch (PDOException $ex) {
129-
$this->alert->danger($ex->getMessage())->flash();
130-
131-
return redirect()->route('admin.databases');
128+
} catch (Exception $exception) {
129+
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) {
130+
$this->alert->danger(
131+
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
132+
)->flash();
133+
134+
redirect()->route('admin.databases')->withInput($request->validated());
135+
} else {
136+
throw $exception;
137+
}
132138
}
133139

134140
$this->alert->success('Successfully created a new database host on the system.')->flash();
@@ -143,8 +149,7 @@ public function create(DatabaseHostFormRequest $request): RedirectResponse
143149
* @param \Pterodactyl\Models\DatabaseHost $host
144150
* @return \Illuminate\Http\RedirectResponse
145151
*
146-
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
147-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
152+
* @throws \Throwable
148153
*/
149154
public function update(DatabaseHostFormRequest $request, DatabaseHost $host): RedirectResponse
150155
{
@@ -153,9 +158,17 @@ public function update(DatabaseHostFormRequest $request, DatabaseHost $host): Re
153158
try {
154159
$this->updateService->handle($host->id, $request->normalize());
155160
$this->alert->success('Database host was updated successfully.')->flash();
156-
} catch (PDOException $ex) {
157-
$this->alert->danger($ex->getMessage())->flash();
158-
$redirect->withInput($request->normalize());
161+
} catch (Exception $exception) {
162+
// Catch any SQL related exceptions and display them back to the user, otherwise just
163+
// throw the exception like normal and move on with it.
164+
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) {
165+
$this->alert->danger(
166+
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
167+
)->flash();
168+
$redirect->withInput($request->normalize());
169+
} else {
170+
throw $exception;
171+
}
159172
}
160173

161174
return $redirect;

app/Http/Controllers/Admin/ServersController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ public function updateBuild(Request $request, Server $server)
516516
$this->buildModificationService->handle($server, $request->only([
517517
'allocation_id', 'add_allocations', 'remove_allocations',
518518
'memory', 'swap', 'io', 'cpu', 'disk',
519-
'database_limit', 'allocation_limit',
519+
'database_limit', 'allocation_limit', 'oom_disabled',
520520
]));
521521
$this->alert->success(trans('admin/server.alerts.build_updated'))->flash();
522522

@@ -589,8 +589,7 @@ public function newDatabase(StoreServerDatabaseRequest $request, $server)
589589
* @param int $server
590590
* @return \Illuminate\Http\RedirectResponse
591591
*
592-
* @throws \Exception
593-
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
592+
* @throws \Throwable
594593
*/
595594
public function resetDatabasePassword(Request $request, $server)
596595
{
@@ -599,7 +598,7 @@ public function resetDatabasePassword(Request $request, $server)
599598
['id', '=', $request->input('database')],
600599
]);
601600

602-
$this->databasePasswordService->handle($database, str_random(24));
601+
$this->databasePasswordService->handle($database);
603602

604603
return response('', 204);
605604
}

app/Http/Controllers/Api/Application/Servers/DatabaseController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,11 @@ public function view(GetServerDatabaseRequest $request): array
8787
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request
8888
* @return \Illuminate\Http\Response
8989
*
90-
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
91-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
90+
* @throws \Throwable
9291
*/
9392
public function resetPassword(ServerDatabaseWriteRequest $request): Response
9493
{
95-
$this->databasePasswordService->handle($request->getModel(Database::class), str_random(24));
94+
$this->databasePasswordService->handle($request->getModel(Database::class));
9695

9796
return response('', 204);
9897
}

app/Http/Controllers/Api/Client/ClientController.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,26 @@ public function __construct(ServerRepositoryInterface $repository)
3535
*/
3636
public function index(GetServersRequest $request): array
3737
{
38-
$servers = $this->repository->filterUserAccessServers($request->user(), User::FILTER_LEVEL_SUBUSER, config('pterodactyl.paginate.frontend.servers'));
38+
// Check for the filter parameter on the request.
39+
switch ($request->input('filter')) {
40+
case 'all':
41+
$filter = User::FILTER_LEVEL_ALL;
42+
break;
43+
case 'admin':
44+
$filter = User::FILTER_LEVEL_ADMIN;
45+
break;
46+
case 'owner':
47+
$filter = User::FILTER_LEVEL_OWNER;
48+
break;
49+
case 'subuser-of':
50+
default:
51+
$filter = User::FILTER_LEVEL_SUBUSER;
52+
break;
53+
}
54+
55+
$servers = $this->repository->filterUserAccessServers(
56+
$request->user(), $filter, config('pterodactyl.paginate.frontend.servers')
57+
);
3958

4059
return $this->fractal->collection($servers)
4160
->transformWith($this->getTransformer(ServerTransformer::class))

app/Http/Controllers/Server/DatabaseController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,13 @@ public function store(StoreServerDatabaseRequest $request): RedirectResponse
135135
* @return \Illuminate\Http\JsonResponse
136136
*
137137
* @throws \Illuminate\Auth\Access\AuthorizationException
138-
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
139-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
138+
* @throws \Throwable
140139
*/
141140
public function update(Request $request): JsonResponse
142141
{
143142
$this->authorize('reset-db-password', $request->attributes->get('server'));
144143

145-
$password = str_random(24);
146-
$this->passwordService->handle($request->attributes->get('database'), $password);
144+
$password = $this->passwordService->handle($request->attributes->get('database'));
147145

148146
return response()->json(['password' => $password]);
149147
}

app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function validated()
4040
return [
4141
'allocation_ip' => $data['ip'],
4242
'allocation_ports' => $data['ports'],
43-
'allocation_alias' => $data['alias'],
43+
'allocation_alias' => $data['alias'] ?? null,
4444
];
4545
}
4646
}

app/Http/Requests/Api/Application/Servers/StoreServerRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function rules(): array
4141
'startup' => $rules['startup'],
4242
'environment' => 'present|array',
4343
'skip_scripts' => 'sometimes|boolean',
44+
'oom_disabled' => 'sometimes|boolean',
4445

4546
// Resource limitations
4647
'limits' => 'required|array',

app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function rules(): array
1818

1919
return [
2020
'allocation' => $rules['allocation_id'],
21+
'oom_disabled' => $rules['oom_disabled'],
2122

2223
'limits' => 'sometimes|array',
2324
'limits.memory' => $this->requiredToOptional('memory', $rules['memory'], true),

0 commit comments

Comments
 (0)