Skip to content

Commit a3b47e3

Browse files
committed
Merge branch 'release/v0.7.5'
2 parents 5218c7f + 4e3dd28 commit a3b47e3

File tree

27 files changed

+224
-126
lines changed

27 files changed

+224
-126
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.7.5 (Derelict Dermodactylus)
7+
### Fixed
8+
* Fixes application API keys being created as a client API key.
9+
* Search term is now passed through when using paginated result sets.
10+
* Reduces the number of SQL queries executed when rendering the server listing to increase performance.
11+
* Fixes exceptions being thrown for non-existent subuser permissions.
12+
* Fixes exception caused when trying to revoke admin privileges from a user account due to a bad endpoint.
13+
14+
### Changed
15+
* Databases are now properly paginated when viewing a database host.
16+
* No more loading daemon keys for every server model being loaded, some of us value our databases.
17+
* Changed behavior of the subuser middleware to add a daemon access key if one is missing from the database for some reason.
18+
* Server short-codes are now based on the UUID as they were in previous versions of Pterodactyl.
19+
620
## v0.7.4-h1 (Derelict Dermodactylus)
721
### Fixed
822
* Being able to create servers is kind of a core aspect of the software, pushing releases late at night is not a great idea.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Some of our core supported games include:
2222
* Teamspeak
2323
* Mumble
2424
* Team Fortress 2
25-
* Counter Strike: GO
26-
* Garrys Mod
27-
* Ark: Survival Evolved
25+
* Counter Strike: Global Offensive
26+
* Garry's Mod
27+
* ARK: Survival Evolved
2828

2929
In addition to our standard nest of supported games, our community is constantly pushing the limits of this software and there are plenty more games available provided by the community. Some of these games include:
3030

app/Contracts/Repository/DatabaseHostRepositoryInterface.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Pterodactyl\Contracts\Repository;
44

55
use Illuminate\Support\Collection;
6-
use Pterodactyl\Models\DatabaseHost;
76

87
interface DatabaseHostRepositoryInterface extends RepositoryInterface
98
{
@@ -14,15 +13,4 @@ interface DatabaseHostRepositoryInterface extends RepositoryInterface
1413
* @return \Illuminate\Support\Collection
1514
*/
1615
public function getWithViewDetails(): Collection;
17-
18-
/**
19-
* Return a database host with the databases and associated servers
20-
* that are attached to said databases.
21-
*
22-
* @param int $id
23-
* @return \Pterodactyl\Models\DatabaseHost
24-
*
25-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
26-
*/
27-
public function getWithServers(int $id): DatabaseHost;
2816
}

app/Contracts/Repository/DatabaseRepositoryInterface.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
namespace Pterodactyl\Contracts\Repository;
114

125
use Pterodactyl\Models\Database;
136
use Illuminate\Support\Collection;
7+
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
148

159
interface DatabaseRepositoryInterface extends RepositoryInterface
1610
{
@@ -39,6 +33,15 @@ public function getConnection(): string;
3933
*/
4034
public function getDatabasesForServer(int $server): Collection;
4135

36+
/**
37+
* Return all of the databases for a given host with the server relationship loaded.
38+
*
39+
* @param int $host
40+
* @param int $count
41+
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
42+
*/
43+
public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;
44+
4245
/**
4346
* Create a new database if it does not already exist on the host with
4447
* the provided details.

app/Contracts/Repository/ServerRepositoryInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,13 @@ public function getServersForPowerAction(array $servers = [], array $nodes = [],
136136
* @return int
137137
*/
138138
public function getServersForPowerActionCount(array $servers = [], array $nodes = []): int;
139+
140+
/**
141+
* Check if a given UUID and UUID-Short string are unique to a server.
142+
*
143+
* @param string $uuid
144+
* @param string $short
145+
* @return bool
146+
*/
147+
public function isUniqueUuidCombo(string $uuid, string $short): bool;
139148
}

app/Http/Controllers/Admin/DatabaseController.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
namespace Pterodactyl\Http\Controllers\Admin;
114

@@ -19,6 +12,7 @@
1912
use Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest;
2013
use Pterodactyl\Services\Databases\Hosts\HostCreationService;
2114
use Pterodactyl\Services\Databases\Hosts\HostDeletionService;
15+
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
2216
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
2317
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
2418

@@ -34,6 +28,11 @@ class DatabaseController extends Controller
3428
*/
3529
private $creationService;
3630

31+
/**
32+
* @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface
33+
*/
34+
private $databaseRepository;
35+
3736
/**
3837
* @var \Pterodactyl\Services\Databases\Hosts\HostDeletionService
3938
*/
@@ -59,6 +58,7 @@ class DatabaseController extends Controller
5958
*
6059
* @param \Prologue\Alerts\AlertsMessageBag $alert
6160
* @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository
61+
* @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository
6262
* @param \Pterodactyl\Services\Databases\Hosts\HostCreationService $creationService
6363
* @param \Pterodactyl\Services\Databases\Hosts\HostDeletionService $deletionService
6464
* @param \Pterodactyl\Services\Databases\Hosts\HostUpdateService $updateService
@@ -67,13 +67,15 @@ class DatabaseController extends Controller
6767
public function __construct(
6868
AlertsMessageBag $alert,
6969
DatabaseHostRepositoryInterface $repository,
70+
DatabaseRepositoryInterface $databaseRepository,
7071
HostCreationService $creationService,
7172
HostDeletionService $deletionService,
7273
HostUpdateService $updateService,
7374
LocationRepositoryInterface $locationRepository
7475
) {
7576
$this->alert = $alert;
7677
$this->creationService = $creationService;
78+
$this->databaseRepository = $databaseRepository;
7779
$this->deletionService = $deletionService;
7880
$this->repository = $repository;
7981
$this->locationRepository = $locationRepository;
@@ -105,7 +107,8 @@ public function view(int $host): View
105107
{
106108
return view('admin.databases.view', [
107109
'locations' => $this->locationRepository->getAllWithNodes(),
108-
'host' => $this->repository->getWithServers($host),
110+
'host' => $this->repository->find($host),
111+
'databases' => $this->databaseRepository->getDatabasesForHost($host),
109112
]);
110113
}
111114

app/Http/Middleware/Server/AuthenticateAsSubuser.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use Closure;
1313
use Illuminate\Http\Request;
14-
use Illuminate\Contracts\Session\Session;
1514
use Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService;
1615
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
1716
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -23,21 +22,14 @@ class AuthenticateAsSubuser
2322
*/
2423
private $keyProviderService;
2524

26-
/**
27-
* @var \Illuminate\Contracts\Session\Session
28-
*/
29-
private $session;
30-
3125
/**
3226
* SubuserAccessAuthenticate constructor.
3327
*
3428
* @param \Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService $keyProviderService
35-
* @param \Illuminate\Contracts\Session\Session $session
3629
*/
37-
public function __construct(DaemonKeyProviderService $keyProviderService, Session $session)
30+
public function __construct(DaemonKeyProviderService $keyProviderService)
3831
{
3932
$this->keyProviderService = $keyProviderService;
40-
$this->session = $session;
4133
}
4234

4335
/**
@@ -60,7 +52,6 @@ public function handle(Request $request, Closure $next)
6052
throw new AccessDeniedHttpException('This account does not have permission to access this server.');
6153
}
6254

63-
$this->session->now('server_data.token', $token);
6455
$request->attributes->set('server_token', $token);
6556

6657
return $next($request);

app/Models/Server.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ class Server extends Model implements CleansAttributes, ValidableContract
3535
*/
3636
protected $dates = [self::CREATED_AT, self::UPDATED_AT, 'deleted_at'];
3737

38-
/**
39-
* Always eager load these relationships on the model.
40-
*
41-
* @var array
42-
*/
43-
protected $with = ['key'];
44-
4538
/**
4639
* Fields that are not mass assignable.
4740
*

app/Repositories/Daemon/ServerRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ public function details(): ResponseInterface
115115
public function revokeAccessKey($key): ResponseInterface
116116
{
117117
if (is_array($key)) {
118-
return $this->getHttpClient()->request('POST', 'keys', [
119-
'json' => $key,
118+
return $this->getHttpClient()->request('POST', 'keys/batch-delete', [
119+
'json' => ['keys' => $key],
120120
]);
121121
}
122122

app/Repositories/Eloquent/DatabaseHostRepository.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use Illuminate\Support\Collection;
66
use Pterodactyl\Models\DatabaseHost;
7-
use Illuminate\Database\Eloquent\ModelNotFoundException;
8-
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
97
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
108

119
class DatabaseHostRepository extends EloquentRepository implements DatabaseHostRepositoryInterface
@@ -30,22 +28,4 @@ public function getWithViewDetails(): Collection
3028
{
3129
return $this->getBuilder()->withCount('databases')->with('node')->get();
3230
}
33-
34-
/**
35-
* Return a database host with the databases and associated servers
36-
* that are attached to said databases.
37-
*
38-
* @param int $id
39-
* @return \Pterodactyl\Models\DatabaseHost
40-
*
41-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
42-
*/
43-
public function getWithServers(int $id): DatabaseHost
44-
{
45-
try {
46-
return $this->getBuilder()->with('databases.server')->findOrFail($id, $this->getColumns());
47-
} catch (ModelNotFoundException $exception) {
48-
throw new RecordNotFoundException;
49-
}
50-
}
5131
}

0 commit comments

Comments
 (0)