forked from Alex/Pterodactyl-Panel
Remove unused controllers
This commit is contained in:
parent
fd2ceacfe2
commit
605c154812
@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Server;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
|
||||||
use Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService;
|
|
||||||
|
|
||||||
class CredentialsController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService
|
|
||||||
*/
|
|
||||||
private $keyProviderService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CredentialsController constructor.
|
|
||||||
*
|
|
||||||
* @param \Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService $keyProviderService
|
|
||||||
*/
|
|
||||||
public function __construct(DaemonKeyProviderService $keyProviderService)
|
|
||||||
{
|
|
||||||
$this->keyProviderService = $keyProviderService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a set of credentials that the currently authenticated user can use to access
|
|
||||||
* a given server with.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*
|
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
||||||
*/
|
|
||||||
public function index(Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
/** @var \Pterodactyl\Models\Server $server */
|
|
||||||
$server = $request->attributes->get('server');
|
|
||||||
$server->loadMissing('node');
|
|
||||||
|
|
||||||
return JsonResponse::create([
|
|
||||||
'node' => $server->getRelation('node')->getConnectionAddress(),
|
|
||||||
'key' => $this->keyProviderService->handle($server, $request->user()),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Server;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use GuzzleHttp\Exception\TransferException;
|
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
|
||||||
use Pterodactyl\Contracts\Repository\Daemon\FileRepositoryInterface;
|
|
||||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
|
||||||
|
|
||||||
class FileController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \Pterodactyl\Contracts\Repository\Daemon\FileRepositoryInterface
|
|
||||||
*/
|
|
||||||
private $fileRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FileController constructor.
|
|
||||||
*
|
|
||||||
* @param \Pterodactyl\Contracts\Repository\Daemon\FileRepositoryInterface $fileRepository
|
|
||||||
*/
|
|
||||||
public function __construct(FileRepositoryInterface $fileRepository)
|
|
||||||
{
|
|
||||||
$this->fileRepository = $fileRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*
|
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
|
||||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
|
||||||
*/
|
|
||||||
public function index(Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
$server = $request->attributes->get('server');
|
|
||||||
$this->authorize('list-files', $server);
|
|
||||||
|
|
||||||
$requestDirectory = '/' . trim(urldecode($request->route()->parameter('directory', '/')), '/');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$contents = $this->fileRepository->setServer($server)->setToken(
|
|
||||||
$request->attributes->get('server_token')
|
|
||||||
)->getDirectory($requestDirectory);
|
|
||||||
} catch (TransferException $exception) {
|
|
||||||
throw new DaemonConnectionException($exception, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return JsonResponse::create([
|
|
||||||
'contents' => $contents,
|
|
||||||
'editable' => config('pterodactyl.files.editable'),
|
|
||||||
'current_directory' => $requestDirectory,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,13 +6,5 @@
|
|||||||
* This software is licensed under the terms of the MIT license.
|
* This software is licensed under the terms of the MIT license.
|
||||||
* https://opensource.org/licenses/MIT
|
* https://opensource.org/licenses/MIT
|
||||||
*/
|
*/
|
||||||
Route::get('/credentials', 'CredentialsController@index')->name('server.credentials');
|
|
||||||
|
|
||||||
Route::group(['prefix' => '/files'], function () {
|
|
||||||
Route::get('/{directory?}', 'FileController@index')
|
|
||||||
->name('server.files')
|
|
||||||
->where('directory', '.*');
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::get('/')->name('server.index');
|
Route::get('/')->name('server.index');
|
||||||
Route::get('/console')->name('server.console');
|
Route::get('/console')->name('server.console');
|
||||||
|
Loading…
Reference in New Issue
Block a user