Skip to content

Commit 324a1db

Browse files
authored
Merge pull request pterodactyl#1 from Pterodactyl/develop
Merging up to current
2 parents 1b3d9eb + 8b762cb commit 324a1db

File tree

17 files changed

+91
-32
lines changed

17 files changed

+91
-32
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@ 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.6.1 (Courageous Carniadactylus)
7+
### Fixed
8+
* Fixes a bug preventing the use of services that have no variables attached to them.
9+
* Fixes 'Remember Me' checkbox being ignored when using 2FA on an account.
10+
* API now returns a useful error displaying what went wrong rather than an obscure 'An Error was Encountered' message when API issues arise.
11+
* Fixes bug preventing the creation of new files in the file manager due to a missing JS dependency on page load.
12+
* Prevent using a service option tag that contains special characters that are not valid. Now only allows alpha-numeric, no spaces or underscores.
13+
* Fix unhandled excpetion due to missing `Log` class when using the API and causing an error.
14+
15+
### Changed
16+
* Renamed session cookies from `laravel_session` to `pterodactyl_session`.
17+
* Sessions are now encrypted before being stored as an additional layer of security.
18+
* It is now possible to clear out a server description and have it be blank, rather than throwing an error about the field being required.
19+
620
## v0.6.0 (Courageous Carniadactylus)
721
### Fixed
822
* Bug causing error logs to be spammed if someone timed out on an ajax based page.

app/Exceptions/Handler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ public function render($request, Exception $exception)
4848
if ($request->expectsJson() || $request->isJson() || $request->is(...config('pterodactyl.json_routes'))) {
4949
$exception = $this->prepareException($exception);
5050

51-
if (config('app.debug')) {
52-
$report = [
53-
'code' => (! $this->isHttpException($exception)) ?: $exception->getStatusCode(),
54-
'message' => class_basename($exception) . ' in ' . $exception->getFile() . ' on line ' . $exception->getLine(),
55-
];
51+
if (config('app.debug') || $this->isHttpException($exception)) {
52+
$displayError = $exception->getMessage();
53+
} else {
54+
$displayError = 'An unhandled exception was encountered with this request.';
5655
}
5756

5857
$response = response()->json([
59-
'error' => (config('app.debug')) ? $exception->getMessage() : 'An unhandled exception was encountered with this request.',
60-
'exception' => ! isset($report) ?: $report,
58+
'error' => $displayError,
59+
'http_code' => (! $this->isHttpException($exception)) ?: $exception->getStatusCode(),
60+
'trace' => (! config('app.debug')) ? null : class_basename($exception) . ' in ' . $exception->getFile() . ' on line ' . $exception->getLine(),
6161
], ($this->isHttpException($exception)) ? $exception->getStatusCode() : 500, [], JSON_UNESCAPED_SLASHES);
6262

6363
parent::report($exception);

app/Http/Controllers/API/Admin/NodeController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
namespace Pterodactyl\Http\Controllers\API\Admin;
2626

27+
use Log;
2728
use Fractal;
2829
use Illuminate\Http\Request;
2930
use Pterodactyl\Models\Node;

app/Http/Controllers/API/Admin/ServerController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
namespace Pterodactyl\Http\Controllers\API\Admin;
2626

27+
use Log;
2728
use Fractal;
2829
use Illuminate\Http\Request;
2930
use Pterodactyl\Models\Server;

app/Http/Controllers/API/Admin/UserController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
namespace Pterodactyl\Http\Controllers\API\Admin;
2626

27+
use Log;
2728
use Fractal;
2829
use Illuminate\Http\Request;
2930
use Pterodactyl\Models\User;

app/Http/Controllers/Admin/ServersController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,12 @@ public function setDetails(Request $request, $id)
273273
{
274274
$repo = new ServerRepository;
275275
try {
276-
$repo->updateDetails($id, $request->intersect([
277-
'owner_id', 'name', 'description', 'reset_token',
278-
]));
276+
$repo->updateDetails($id, array_merge(
277+
$request->only('description'),
278+
$request->intersect([
279+
'owner_id', 'name', 'reset_token',
280+
])
281+
));
279282

280283
Alert::success('Server details were successfully updated.')->flash();
281284
} catch (DisplayValidationException $ex) {

app/Http/Controllers/Auth/LoginController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ public function login(Request $request)
134134
])),
135135
], 5);
136136

137-
return redirect()->route('auth.totp')->with('authentication_token', $token);
137+
return redirect()->route('auth.totp')
138+
->with('authentication_token', $token)
139+
->with('remember', $request->has('remember'));
138140
}
139141

140142
$attempt = Auth::attempt([
@@ -167,7 +169,7 @@ public function totp(Request $request)
167169

168170
return view('auth.totp', [
169171
'verify_key' => $token,
170-
'remember' => $request->has('remember'),
172+
'remember' => $request->session()->get('remember'),
171173
]);
172174
}
173175

app/Http/Controllers/Daemon/OptionController.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public function details(Request $request, $server)
3838
return sprintf('%s=%s', $item->variable->env_variable, $item->variable_value);
3939
});
4040

41+
$mergeInto = [
42+
'STARTUP=' . $server->startup,
43+
'SERVER_MEMORY=' . $server->memory,
44+
'SERVER_IP=' . $server->allocation->ip,
45+
'SERVER_PORT=' . $server->allocation->port,
46+
];
47+
48+
if ($environment->count() === 0) {
49+
$environment = collect($mergeInto);
50+
}
51+
4152
return response()->json([
4253
'scripts' => [
4354
'install' => (! $server->option->copy_script_install) ? null : str_replace(["\r\n", "\n", "\r"], "\n", $server->option->copy_script_install),
@@ -47,12 +58,7 @@ public function details(Request $request, $server)
4758
'container' => $server->option->copy_script_container,
4859
'entry' => $server->option->copy_script_entry,
4960
],
50-
'env' => $environment->merge([
51-
'STARTUP=' . $server->startup,
52-
'SERVER_MEMORY=' . $server->memory,
53-
'SERVER_IP=' . $server->allocation->ip,
54-
'SERVER_PORT=' . $server->allocation->port,
55-
])->toArray(),
61+
'env' => $environment->toArray(),
5662
]);
5763
}
5864
}

app/Repositories/OptionRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function create(array $data)
4747
'service_id' => 'required|numeric|exists:services,id',
4848
'name' => 'required|string|max:255',
4949
'description' => 'required|string',
50-
'tag' => 'required|string|max:255|unique:service_options,tag',
50+
'tag' => 'required|alpha_num|max:60|unique:service_options,tag',
5151
'docker_image' => 'sometimes|string|max:255',
5252
'startup' => 'sometimes|nullable|string',
5353
'config_from' => 'sometimes|required|numeric|exists:service_options,id',

app/Repositories/ServerRepository.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public function updateDetails($id, array $data)
370370
$validator = Validator::make($data, [
371371
'owner_id' => 'sometimes|required|integer|exists:users,id',
372372
'name' => 'sometimes|required|regex:([\w .-]{1,200})',
373-
'description' => 'sometimes|required|string',
373+
'description' => 'sometimes|nullable|string',
374374
'reset_token' => 'sometimes|required|accepted',
375375
]);
376376

@@ -733,6 +733,10 @@ protected function parseVariables(Server $server)
733733
$i++;
734734
}
735735

736+
if ($parsed->count() === 0) {
737+
return collect($merge);
738+
}
739+
736740
return $parsed->merge($merge);
737741
}
738742

0 commit comments

Comments
 (0)