Skip to content

Commit c0cef1f

Browse files
committed
Merge branch 'release/v0.7.2'
2 parents e4425ee + 2460d99 commit c0cef1f

File tree

34 files changed

+347
-68
lines changed

34 files changed

+347
-68
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ 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.2 (Derelict Dermodactylus)
7+
### Fixed
8+
* Fixes an exception thrown when trying to access the `/nests/:id/eggs/:id` API endpoint.
9+
* Fixes search on server listing page.
10+
* Schedules with no names are now clickable to allow editing.
11+
* Fixes broken permissions check that would deny access to API keys that did in fact have permission.
12+
13+
### Added
14+
* Adds ability to include egg variables on an API request.
15+
* Added `external_id` column to servers that allows for easier linking with external services such as WHMCS.
16+
* Added back the sidebar when viewing servers that allows for quick-switching to a different server.
17+
* Added API endpoint to get a server by external ID.
18+
619
## v0.7.1 (Derelict Dermodactylus)
720
### Fixed
821
* Fixes an exception when no token is entered on the 2-Factor enable/disable page and the form is submitted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ If you've found what you believe is a security issue please email us at `support
4141
### Where to find Us
4242
You can find us in a couple places online. First and foremost, we're active right here on Github. If you encounter a bug or other problem open an issue on here for us to take a look at it. We also accept feature requests here as well.
4343

44-
You can also find us on [Discord](https://pterodactyl.io/discord). In the event that you need to get in contact with us privately feel free to contact us at `support@pterodactyl.io`. Try not to email us with requests for support regarding the panel, we'll probably just direct you to our forums or Discord.
44+
You can also find us on [Discord](https://pterodactyl.io/discord). In the event that you need to get in contact with us privately feel free to contact us at `support@pterodactyl.io`. Try not to email us with requests for support regarding the panel, we'll probably just direct you to our Discord.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Pterodactyl Panel is the free, open-source, game agnostic, self-hosted control panel for users, networks, and game service providers. Pterodactyl supports games and servers such as Minecraft (including Spigot, Bungeecord, and Sponge), ARK: Evolution Evolved, CS:GO, Team Fortress 2, Insurgency, Teamspeak 3, Mumble, and many more. Control all of your games from one unified interface.
77

88
## Support & Documentation
9-
Support for using Pterodactyl can be found on our [Documentation Website](https://docs.pterodactyl.io), our [Discord Chat](https://discord.gg/QRDZvVm), or via our [Forums](https://forums.pterodactyl.io).
9+
Support for using Pterodactyl can be found on our [Documentation Website](https://docs.pterodactyl.io) or via our [Discord Chat](https://discord.gg/QRDZvVm).
1010

1111
## License
1212
```

app/Contracts/Repository/ServerRepositoryInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ public function getDaemonServiceData(Server $server, bool $refresh = false): arr
103103
*
104104
* @param \Pterodactyl\Models\User $user
105105
* @param int $level
106-
* @return \Illuminate\Pagination\LengthAwarePaginator
106+
* @param bool $paginate
107+
* @return \Illuminate\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection
107108
*/
108-
public function filterUserAccessServers(User $user, int $level): LengthAwarePaginator;
109+
public function filterUserAccessServers(User $user, int $level, bool $paginate = true);
109110

110111
/**
111112
* Return a server by UUID.

app/Http/Controllers/Admin/ServersController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,13 @@ public function __construct(
201201
/**
202202
* Display the index page with all servers currently on the system.
203203
*
204+
* @param \Illuminate\Http\Request $request
204205
* @return \Illuminate\View\View
205206
*/
206-
public function index()
207+
public function index(Request $request)
207208
{
208209
return view('admin.servers.index', [
209-
'servers' => $this->repository->getAllServers(
210+
'servers' => $this->repository->setSearchTerm($request->input('query'))->getAllServers(
210211
$this->config->get('pterodactyl.paginate.admin.servers')
211212
),
212213
]);
@@ -405,7 +406,7 @@ public function viewDelete(Server $server)
405406
public function setDetails(Request $request, Server $server)
406407
{
407408
$this->detailsModificationService->handle($server, $request->only([
408-
'owner_id', 'name', 'description',
409+
'owner_id', 'external_id', 'name', 'description',
409410
]));
410411

411412
$this->alert->success(trans('admin/server.alerts.details_updated'))->flash();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
4+
5+
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
6+
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
7+
use Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest;
8+
9+
class ExternalServerController extends ApplicationApiController
10+
{
11+
/**
12+
* Retrieve a specific server from the database using its external ID.
13+
*
14+
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest $request
15+
* @return array
16+
*/
17+
public function index(GetExternalServerRequest $request): array
18+
{
19+
return $this->fractal->item($request->getServerModel())
20+
->transformWith($this->getTransformer(ServerTransformer::class))
21+
->toArray();
22+
}
23+
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Pterodactyl\Services\Servers\ServerDeletionService;
1010
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
1111
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
12+
use Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest;
1213
use Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest;
1314
use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;
1415
use Pterodactyl\Http\Requests\Api\Application\Servers\StoreServerRequest;
@@ -91,10 +92,10 @@ public function store(StoreServerRequest $request): JsonResponse
9192
/**
9293
* Show a single server transformed for the application API.
9394
*
94-
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
95+
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest $request
9596
* @return array
9697
*/
97-
public function view(ServerWriteRequest $request): array
98+
public function view(GetServerRequest $request): array
9899
{
99100
return $this->fractal->item($request->getModel(Server::class))
100101
->transformWith($this->getTransformer(ServerTransformer::class))

app/Http/Middleware/Api/Application/AuthenticateUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AuthenticateUser
1919
public function handle(Request $request, Closure $next)
2020
{
2121
if (is_null($request->user()) || ! $request->user()->root_admin) {
22-
throw new AccessDeniedHttpException;
22+
throw new AccessDeniedHttpException('This account does not have permission to access the API.');
2323
}
2424

2525
return $next($request);

app/Http/Requests/Api/Application/ApplicationApiRequest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Pterodactyl\Exceptions\PterodactylException;
1010
use Pterodactyl\Http\Middleware\Api\ApiSubstituteBindings;
1111
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
12+
use Symfony\Component\Routing\Exception\InvalidParameterException;
1213

1314
abstract class ApplicationApiRequest extends FormRequest
1415
{
@@ -76,22 +77,23 @@ public function key(): ApiKey
7677
}
7778

7879
/**
79-
* Grab a model from the route parameters. If no model exists under
80-
* the specified key a default response is returned.
80+
* Grab a model from the route parameters. If no model is found in the
81+
* binding mappings an exception will be thrown.
8182
*
8283
* @param string $model
83-
* @param mixed $default
8484
* @return mixed
85+
*
86+
* @throws \Symfony\Component\Routing\Exception\InvalidParameterException
8587
*/
86-
public function getModel(string $model, $default = null)
88+
public function getModel(string $model)
8789
{
8890
$parameterKey = array_get(array_flip(ApiSubstituteBindings::getMappings()), $model);
8991

90-
if (! is_null($parameterKey)) {
91-
$model = $this->route()->parameter($parameterKey);
92+
if (is_null($parameterKey)) {
93+
throw new InvalidParameterException;
9294
}
9395

94-
return $model ?? $default;
96+
return $this->route()->parameter($parameterKey);
9597
}
9698

9799
/*

app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php

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

33
namespace Pterodactyl\Http\Requests\Api\Application\Nests\Eggs;
44

5+
use Pterodactyl\Models\Egg;
6+
use Pterodactyl\Models\Nest;
57
use Pterodactyl\Services\Acl\Api\AdminAcl;
68
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
79

@@ -24,6 +26,6 @@ class GetEggRequest extends ApplicationApiRequest
2426
*/
2527
public function resourceExists(): bool
2628
{
27-
return $this->getModel('nest')->id === $this->getModel('egg')->nest_id;
29+
return $this->getModel(Nest::class)->id === $this->getModel(Egg::class)->nest_id;
2830
}
2931
}

0 commit comments

Comments
 (0)