mirror of
https://github.com/pelican-dev/panel.git
synced 2026-03-01 11:21:31 +03:00
Fix suspension/installed handling for servers
closes Pterodactyl/Panel#891
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Illuminate\Http\Response;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Foundation\Testing\HttpException;
|
||||
@@ -75,12 +76,11 @@ class ValidateKeyController extends Controller
|
||||
* @return array
|
||||
*
|
||||
* @throws \Illuminate\Foundation\Testing\HttpException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function index($token)
|
||||
{
|
||||
if (! starts_with($token, DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER)) {
|
||||
throw new HttpException(501);
|
||||
throw new HttpException(Response::HTTP_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -89,6 +89,10 @@ class ValidateKeyController extends Controller
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
if ($key->getRelation('server')->suspended || $key->getRelation('server')->installed !== 1) {
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
return $this->fractal->item($key, $this->app->make(ApiKeyTransformer::class), 'server')
|
||||
->serializeWith(JsonApiSerializer::class)
|
||||
->toArray();
|
||||
|
||||
Reference in New Issue
Block a user