2018-02-25 22:30:56 +01:00
|
|
|
<?php
|
|
|
|
|
2019-11-04 02:37:06 +01:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2022-05-14 21:51:05 +02:00
|
|
|
use Pterodactyl\Http\Controllers\Api\Client;
|
2022-06-18 18:07:32 +02:00
|
|
|
use Pterodactyl\Http\Middleware\Activity\ServerSubject;
|
|
|
|
use Pterodactyl\Http\Middleware\Activity\AccountSubject;
|
2020-12-06 22:56:14 +01:00
|
|
|
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
|
2021-01-20 06:19:17 +01:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer;
|
2018-08-26 00:07:42 +02:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess;
|
2018-02-25 22:30:56 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Client Control API
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Endpoint: /api/client
|
|
|
|
|
|
|
|
|
*/
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\ClientController::class, 'index'])->name('api:client.index');
|
|
|
|
Route::get('/permissions', [Client\ClientController::class, 'permissions']);
|
2018-02-25 22:30:56 +01:00
|
|
|
|
2022-06-18 18:07:32 +02:00
|
|
|
Route::prefix('/account')->middleware(AccountSubject::class)->group(function () {
|
2022-05-29 19:56:39 +02:00
|
|
|
Route::prefix('/')->withoutMiddleware(RequireTwoFactorAuthentication::class)->group(function () {
|
|
|
|
Route::get('/', [Client\AccountController::class, 'index'])->name('api:client.account');
|
|
|
|
Route::get('/two-factor', [Client\TwoFactorController::class, 'index']);
|
|
|
|
Route::post('/two-factor', [Client\TwoFactorController::class, 'store']);
|
2024-10-24 19:30:24 +02:00
|
|
|
Route::post('/two-factor/disable', [Client\TwoFactorController::class, 'delete']);
|
2022-05-29 19:56:39 +02:00
|
|
|
});
|
2018-06-12 07:56:57 +02:00
|
|
|
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::put('/email', [Client\AccountController::class, 'updateEmail'])->name('api:client.account.update-email');
|
|
|
|
Route::put('/password', [Client\AccountController::class, 'updatePassword'])->name('api:client.account.update-password');
|
2020-03-23 02:15:38 +01:00
|
|
|
|
2022-05-30 02:34:48 +02:00
|
|
|
Route::get('/activity', Client\ActivityLogController::class)->name('api:client.account.activity');
|
|
|
|
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/api-keys', [Client\ApiKeyController::class, 'index']);
|
|
|
|
Route::post('/api-keys', [Client\ApiKeyController::class, 'store']);
|
|
|
|
Route::delete('/api-keys/{identifier}', [Client\ApiKeyController::class, 'delete']);
|
2022-05-14 23:31:53 +02:00
|
|
|
|
|
|
|
Route::prefix('/ssh-keys')->group(function () {
|
|
|
|
Route::get('/', [Client\SSHKeyController::class, 'index']);
|
|
|
|
Route::post('/', [Client\SSHKeyController::class, 'store']);
|
2022-05-30 23:28:42 +02:00
|
|
|
Route::post('/remove', [Client\SSHKeyController::class, 'delete']);
|
2022-05-14 23:31:53 +02:00
|
|
|
});
|
2018-06-06 08:00:01 +02:00
|
|
|
});
|
|
|
|
|
2018-02-25 22:30:56 +01:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Client Control API
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Endpoint: /api/client/servers/{server}
|
|
|
|
|
|
|
|
|
*/
|
2022-05-29 19:56:39 +02:00
|
|
|
Route::group([
|
|
|
|
'prefix' => '/servers/{server}',
|
|
|
|
'middleware' => [
|
2022-06-18 18:07:32 +02:00
|
|
|
ServerSubject::class,
|
2022-05-29 19:56:39 +02:00
|
|
|
AuthenticateServerAccess::class,
|
|
|
|
ResourceBelongsToServer::class,
|
|
|
|
],
|
|
|
|
], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\Servers\ServerController::class, 'index'])->name('api:client:server.view');
|
|
|
|
Route::get('/websocket', Client\Servers\WebsocketController::class)->name('api:client:server.ws');
|
|
|
|
Route::get('/resources', Client\Servers\ResourceUtilizationController::class)->name('api:client:server.resources');
|
2022-06-12 21:16:48 +02:00
|
|
|
Route::get('/activity', Client\Servers\ActivityLogController::class)->name('api:client:server.activity');
|
2018-02-25 22:30:56 +01:00
|
|
|
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::post('/command', [Client\Servers\CommandController::class, 'index']);
|
|
|
|
Route::post('/power', [Client\Servers\PowerController::class, 'index']);
|
2018-08-22 06:47:01 +02:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/databases'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\Servers\DatabaseController::class, 'index']);
|
|
|
|
Route::post('/', [Client\Servers\DatabaseController::class, 'store']);
|
|
|
|
Route::post('/{database}/rotate-password', [Client\Servers\DatabaseController::class, 'rotatePassword']);
|
|
|
|
Route::delete('/{database}', [Client\Servers\DatabaseController::class, 'delete']);
|
2018-08-22 06:47:01 +02:00
|
|
|
});
|
2019-03-17 01:10:04 +01:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/files'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/list', [Client\Servers\FileController::class, 'directory']);
|
|
|
|
Route::get('/contents', [Client\Servers\FileController::class, 'contents']);
|
|
|
|
Route::get('/download', [Client\Servers\FileController::class, 'download']);
|
|
|
|
Route::put('/rename', [Client\Servers\FileController::class, 'rename']);
|
|
|
|
Route::post('/copy', [Client\Servers\FileController::class, 'copy']);
|
|
|
|
Route::post('/write', [Client\Servers\FileController::class, 'write']);
|
|
|
|
Route::post('/compress', [Client\Servers\FileController::class, 'compress']);
|
|
|
|
Route::post('/decompress', [Client\Servers\FileController::class, 'decompress']);
|
|
|
|
Route::post('/delete', [Client\Servers\FileController::class, 'delete']);
|
|
|
|
Route::post('/create-folder', [Client\Servers\FileController::class, 'create']);
|
|
|
|
Route::post('/chmod', [Client\Servers\FileController::class, 'chmod']);
|
|
|
|
Route::post('/pull', [Client\Servers\FileController::class, 'pull'])->middleware(['throttle:10,5']);
|
|
|
|
Route::get('/upload', Client\Servers\FileUploadController::class);
|
2019-03-17 01:10:04 +01:00
|
|
|
});
|
2019-03-24 01:47:20 +01:00
|
|
|
|
2020-02-09 00:23:08 +01:00
|
|
|
Route::group(['prefix' => '/schedules'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\Servers\ScheduleController::class, 'index']);
|
|
|
|
Route::post('/', [Client\Servers\ScheduleController::class, 'store']);
|
|
|
|
Route::get('/{schedule}', [Client\Servers\ScheduleController::class, 'view']);
|
|
|
|
Route::post('/{schedule}', [Client\Servers\ScheduleController::class, 'update']);
|
|
|
|
Route::post('/{schedule}/execute', [Client\Servers\ScheduleController::class, 'execute']);
|
|
|
|
Route::delete('/{schedule}', [Client\Servers\ScheduleController::class, 'delete']);
|
|
|
|
|
|
|
|
Route::post('/{schedule}/tasks', [Client\Servers\ScheduleTaskController::class, 'store']);
|
|
|
|
Route::post('/{schedule}/tasks/{task}', [Client\Servers\ScheduleTaskController::class, 'update']);
|
|
|
|
Route::delete('/{schedule}/tasks/{task}', [Client\Servers\ScheduleTaskController::class, 'delete']);
|
2020-02-09 00:23:08 +01:00
|
|
|
});
|
|
|
|
|
2021-01-20 06:19:17 +01:00
|
|
|
Route::group(['prefix' => '/network'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/allocations', [Client\Servers\NetworkAllocationController::class, 'index']);
|
|
|
|
Route::post('/allocations', [Client\Servers\NetworkAllocationController::class, 'store']);
|
|
|
|
Route::post('/allocations/{allocation}', [Client\Servers\NetworkAllocationController::class, 'update']);
|
|
|
|
Route::post('/allocations/{allocation}/primary', [Client\Servers\NetworkAllocationController::class, 'setPrimary']);
|
|
|
|
Route::delete('/allocations/{allocation}', [Client\Servers\NetworkAllocationController::class, 'delete']);
|
2019-03-24 01:47:20 +01:00
|
|
|
});
|
2019-11-03 21:20:11 +01:00
|
|
|
|
2021-01-20 06:19:17 +01:00
|
|
|
Route::group(['prefix' => '/users'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\Servers\SubuserController::class, 'index']);
|
|
|
|
Route::post('/', [Client\Servers\SubuserController::class, 'store']);
|
|
|
|
Route::get('/{user}', [Client\Servers\SubuserController::class, 'view']);
|
|
|
|
Route::post('/{user}', [Client\Servers\SubuserController::class, 'update']);
|
|
|
|
Route::delete('/{user}', [Client\Servers\SubuserController::class, 'delete']);
|
2019-11-03 21:20:11 +01:00
|
|
|
});
|
2019-12-10 07:03:10 +01:00
|
|
|
|
2020-04-04 19:59:25 +02:00
|
|
|
Route::group(['prefix' => '/backups'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\Servers\BackupController::class, 'index']);
|
|
|
|
Route::post('/', [Client\Servers\BackupController::class, 'store']);
|
|
|
|
Route::get('/{backup}', [Client\Servers\BackupController::class, 'view']);
|
|
|
|
Route::get('/{backup}/download', [Client\Servers\BackupController::class, 'download']);
|
|
|
|
Route::post('/{backup}/lock', [Client\Servers\BackupController::class, 'toggleLock']);
|
|
|
|
Route::post('/{backup}/restore', [Client\Servers\BackupController::class, 'restore']);
|
|
|
|
Route::delete('/{backup}', [Client\Servers\BackupController::class, 'delete']);
|
2020-04-04 19:59:25 +02:00
|
|
|
});
|
|
|
|
|
2020-08-23 03:13:59 +02:00
|
|
|
Route::group(['prefix' => '/startup'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::get('/', [Client\Servers\StartupController::class, 'index']);
|
|
|
|
Route::put('/variable', [Client\Servers\StartupController::class, 'update']);
|
2020-08-23 03:13:59 +02:00
|
|
|
});
|
|
|
|
|
2019-12-10 07:03:10 +01:00
|
|
|
Route::group(['prefix' => '/settings'], function () {
|
2022-05-14 21:51:05 +02:00
|
|
|
Route::post('/rename', [Client\Servers\SettingsController::class, 'rename']);
|
|
|
|
Route::post('/reinstall', [Client\Servers\SettingsController::class, 'reinstall']);
|
|
|
|
Route::put('/docker-image', [Client\Servers\SettingsController::class, 'dockerImage']);
|
2019-12-10 07:03:10 +01:00
|
|
|
});
|
2018-02-25 22:30:56 +01:00
|
|
|
});
|