Skip to content

Commit 9a588cb

Browse files
authored
Merge branch 'develop' into develop
2 parents e3c5d50 + c7c2c1a commit 9a588cb

File tree

48 files changed

+465
-510
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

+465
-510
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1111
* `[beta.1]` — Fixes missing check in environment setup that would leave the Hashids salt empty.
1212
* `[beta.1]` — Fixes bug preventing loading of allocations when trying to create a new server.
1313
* `[beta.1]` — Fixes bug causing inability to create new servers on the Panel.
14+
* `[beta.1]` — Fixes bug causing inability to delete an allocation due to misconfigured JS.
15+
* `[beta.1]` — Fixes bug causing inability to set the IP alias for an allocation to an empty value.
16+
* `[beta.1]` — Fixes bug that caused startup changes to not propigate to the server correctly on the first save.
17+
18+
### Changed
19+
* Moved Docker image setting to be on the startup management page for a server rather than the details page. This value changes based on the Nest and Egg that are selected.
20+
* Two-Factor authentication tokens are now 32 bytes in length, and are stored encrypted at rest in the database.
1421

1522
## v0.7.0-beta.1 (Derelict Dermodactylus)
1623
### Added

app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
class CleanServiceBackupFilesCommand extends Command
1717
{
18+
const BACKUP_THRESHOLD_MINUTES = 5;
19+
1820
/**
1921
* @var \Carbon\Carbon
2022
*/
@@ -58,7 +60,7 @@ public function handle()
5860

5961
collect($files)->each(function ($file) {
6062
$lastModified = $this->carbon->timestamp($this->disk->lastModified($file));
61-
if ($lastModified->diffInMinutes($this->carbon->now()) > 5) {
63+
if ($lastModified->diffInMinutes($this->carbon->now()) > self::BACKUP_THRESHOLD_MINUTES) {
6264
$this->disk->delete($file);
6365
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file]));
6466
}

app/Contracts/Repository/ServerRepositoryInterface.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,15 @@ public function getDataForCreation(Server $server, bool $refresh = false): Serve
9595
public function getWithDatabases($id);
9696

9797
/**
98-
* Return data about the daemon service in a consumable format.
98+
* Get data for use when updating a server on the Daemon. Returns an array of
99+
* the egg and pack UUID which are used for build and rebuild. Only loads relations
100+
* if they are missing, or refresh is set to true.
99101
*
100-
* @param int $id
102+
* @param \Pterodactyl\Models\Server $server
103+
* @param bool $refresh
101104
* @return array
102-
*
103-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
104105
*/
105-
public function getDaemonServiceData($id);
106+
public function getDaemonServiceData(Server $server, bool $refresh = false): array;
106107

107108
/**
108109
* Return an array of server IDs that a given user can access based on owner and subuser permissions.

app/Http/Controllers/Admin/ServersController.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -410,25 +410,6 @@ public function setDetails(Request $request, Server $server)
410410
return redirect()->route('admin.servers.view.details', $server->id);
411411
}
412412

413-
/**
414-
* Set the new docker container for a server.
415-
*
416-
* @param \Illuminate\Http\Request $request
417-
* @param \Pterodactyl\Models\Server $server
418-
* @return \Illuminate\Http\RedirectResponse
419-
*
420-
* @throws \Pterodactyl\Exceptions\DisplayException
421-
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
422-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
423-
*/
424-
public function setContainer(Request $request, Server $server)
425-
{
426-
$this->detailsModificationService->setDockerImage($server, $request->input('docker_image'));
427-
$this->alert->success(trans('admin/server.alerts.docker_image_updated'))->flash();
428-
429-
return redirect()->route('admin.servers.view.details', $server->id);
430-
}
431-
432413
/**
433414
* Toggles the install status for a server.
434415
*

app/Http/Controllers/Auth/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function totpCheckpoint(Request $request)
202202
return $this->sendFailedLoginResponse($request);
203203
}
204204

205-
if (! $G2FA->verifyKey($user->totp_secret, $request->input('2fa_token'), 2)) {
205+
if (! $G2FA->verifyKey(Crypt::decrypt($user->totp_secret), $request->input('2fa_token'), 2)) {
206206
event(new \Illuminate\Auth\Events\Failed($user, $credentials));
207207

208208
return $this->sendFailedLoginResponse($request);

app/Http/Controllers/Base/SecurityController.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
use Illuminate\Http\Request;
2929
use Prologue\Alerts\AlertsMessageBag;
30-
use Illuminate\Contracts\Session\Session;
3130
use Pterodactyl\Http\Controllers\Controller;
3231
use Pterodactyl\Services\Users\TwoFactorSetupService;
3332
use Pterodactyl\Services\Users\ToggleTwoFactorService;
@@ -52,11 +51,6 @@ class SecurityController extends Controller
5251
*/
5352
protected $repository;
5453

55-
/**
56-
* @var \Illuminate\Contracts\Session\Session
57-
*/
58-
protected $session;
59-
6054
/**
6155
* @var \Pterodactyl\Services\Users\ToggleTwoFactorService
6256
*/
@@ -72,23 +66,20 @@ class SecurityController extends Controller
7266
*
7367
* @param \Prologue\Alerts\AlertsMessageBag $alert
7468
* @param \Illuminate\Contracts\Config\Repository $config
75-
* @param \Illuminate\Contracts\Session\Session $session
7669
* @param \Pterodactyl\Contracts\Repository\SessionRepositoryInterface $repository
7770
* @param \Pterodactyl\Services\Users\ToggleTwoFactorService $toggleTwoFactorService
7871
* @param \Pterodactyl\Services\Users\TwoFactorSetupService $twoFactorSetupService
7972
*/
8073
public function __construct(
8174
AlertsMessageBag $alert,
8275
ConfigRepository $config,
83-
Session $session,
8476
SessionRepositoryInterface $repository,
8577
ToggleTwoFactorService $toggleTwoFactorService,
8678
TwoFactorSetupService $twoFactorSetupService
8779
) {
8880
$this->alert = $alert;
8981
$this->config = $config;
9082
$this->repository = $repository;
91-
$this->session = $session;
9283
$this->toggleTwoFactorService = $toggleTwoFactorService;
9384
$this->twoFactorSetupService = $twoFactorSetupService;
9485
}
@@ -122,7 +113,9 @@ public function index(Request $request)
122113
*/
123114
public function generateTotp(Request $request)
124115
{
125-
return response()->json($this->twoFactorSetupService->handle($request->user()));
116+
return response()->json([
117+
'qrImage' => $this->twoFactorSetupService->handle($request->user()),
118+
]);
126119
}
127120

128121
/**

app/Http/Requests/Admin/Node/AllocationAliasFormRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AllocationAliasFormRequest extends AdminFormRequest
1919
public function rules()
2020
{
2121
return [
22-
'alias' => 'required|nullable|string',
22+
'alias' => 'present|nullable|string',
2323
'allocation_id' => 'required|numeric|exists:allocations,id',
2424
];
2525
}

app/Models/Allocation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Allocation extends Model implements CleansAttributes, ValidableContract
6060
'node_id' => 'exists:nodes,id',
6161
'ip' => 'ip',
6262
'port' => 'numeric|between:1024,65553',
63-
'alias' => 'string',
63+
'ip_alias' => 'nullable|string',
6464
'server_id' => 'nullable|exists:servers,id',
6565
];
6666

app/Models/User.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class User extends Model implements
6363
'language',
6464
'use_totp',
6565
'totp_secret',
66+
'totp_authenticated_at',
6667
'gravatar',
6768
'root_admin',
6869
];
@@ -78,6 +79,11 @@ class User extends Model implements
7879
'gravatar' => 'boolean',
7980
];
8081

82+
/**
83+
* @var array
84+
*/
85+
protected $dates = [self::CREATED_AT, self::UPDATED_AT, 'totp_authenticated_at'];
86+
8187
/**
8288
* The attributes excluded from the model's JSON form.
8389
*

app/Policies/APIKeyPolicy.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Carbon;
1414
use Pterodactyl\Models\User;
1515
use Pterodactyl\Models\APIKey as Key;
16-
use Pterodactyl\Models\APIPermission as Permission;
1716

1817
class APIKeyPolicy
1918
{

0 commit comments

Comments
 (0)