2018-02-25 22:30:56 +01:00
|
|
|
<?php
|
|
|
|
|
2019-11-04 02:37:06 +01:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2021-07-28 06:23:11 +02:00
|
|
|
use Pterodactyl\Http\Controllers\Api\Client;
|
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
|
|
|
|
|
|
|
|
|
*/
|
2020-04-26 22:21:39 +02:00
|
|
|
Route::get('/', 'ClientController@index')->name('api:client.index');
|
2019-11-04 02:37:06 +01:00
|
|
|
Route::get('/permissions', 'ClientController@permissions');
|
2018-02-25 22:30:56 +01:00
|
|
|
|
2018-06-06 08:00:01 +02:00
|
|
|
Route::group(['prefix' => '/account'], function () {
|
2020-12-06 22:56:14 +01:00
|
|
|
Route::get('/', 'AccountController@index')->name('api:client.account')->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
|
|
|
Route::get('/two-factor', 'TwoFactorController@index')->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
|
|
|
Route::post('/two-factor', 'TwoFactorController@store')->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
|
|
|
Route::delete('/two-factor', 'TwoFactorController@delete')->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
2018-06-12 07:56:57 +02:00
|
|
|
|
2020-04-26 22:21:39 +02:00
|
|
|
Route::put('/email', 'AccountController@updateEmail')->name('api:client.account.update-email');
|
|
|
|
Route::put('/password', 'AccountController@updatePassword')->name('api:client.account.update-password');
|
2020-03-23 02:15:38 +01:00
|
|
|
|
2021-07-28 06:23:11 +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']);
|
2021-07-17 21:20:03 +02:00
|
|
|
|
2021-08-08 19:48:35 +02:00
|
|
|
Route::get('/security-keys', [Client\SecurityKeyController::class, 'index'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
|
|
|
Route::get('/security-keys/register', [Client\SecurityKeyController::class, 'create'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
|
|
|
Route::post('/security-keys/register', [Client\SecurityKeyController::class, 'store'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
|
|
|
Route::delete('/security-keys/{securityKey}', [Client\SecurityKeyController::class, 'delete'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
|
2021-07-17 23:45:46 +02:00
|
|
|
|
|
|
|
Route::get('/ssh', 'SSHKeyController@index');
|
|
|
|
Route::post('/ssh', 'SSHKeyController@store');
|
|
|
|
Route::delete('/ssh/{ssh_key}', 'SSHKeyController@delete');
|
2018-06-06 08:00:01 +02:00
|
|
|
});
|
|
|
|
|
2018-02-25 22:30:56 +01:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Client Control API
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Endpoint: /api/client/servers/{server}
|
|
|
|
|
|
|
|
|
*/
|
2021-07-28 06:23:11 +02:00
|
|
|
Route::group([
|
|
|
|
'prefix' => '/servers/{server}',
|
|
|
|
'middleware' => [AuthenticateServerAccess::class, ResourceBelongsToServer::class],
|
|
|
|
], function () {
|
2020-04-26 22:21:39 +02:00
|
|
|
Route::get('/', 'Servers\ServerController@index')->name('api:client:server.view');
|
|
|
|
Route::get('/websocket', 'Servers\WebsocketController')->name('api:client:server.ws');
|
|
|
|
Route::get('/resources', 'Servers\ResourceUtilizationController')->name('api:client:server.resources');
|
2018-02-25 22:30:56 +01:00
|
|
|
|
2020-04-26 22:21:39 +02:00
|
|
|
Route::post('/command', 'Servers\CommandController@index');
|
|
|
|
Route::post('/power', 'Servers\PowerController@index');
|
2018-08-22 06:47:01 +02:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/databases'], function () {
|
2020-04-26 22:21:39 +02:00
|
|
|
Route::get('/', 'Servers\DatabaseController@index');
|
2018-08-23 07:29:20 +02:00
|
|
|
Route::post('/', 'Servers\DatabaseController@store');
|
2019-07-28 00:17:50 +02:00
|
|
|
Route::post('/{database}/rotate-password', 'Servers\DatabaseController@rotatePassword');
|
2020-04-26 22:21:39 +02:00
|
|
|
Route::delete('/{database}', 'Servers\DatabaseController@delete');
|
2018-08-22 06:47:01 +02:00
|
|
|
});
|
2019-03-17 01:10:04 +01:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/files'], function () {
|
2021-07-25 21:24:52 +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:pull']);
|
2021-08-04 04:41:28 +02:00
|
|
|
Route::get('/upload', [Client\Servers\FileUploadController::class, '__invoke']);
|
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 () {
|
|
|
|
Route::get('/', 'Servers\ScheduleController@index');
|
2020-03-22 21:56:15 +01:00
|
|
|
Route::post('/', 'Servers\ScheduleController@store');
|
2020-03-18 07:33:53 +01:00
|
|
|
Route::get('/{schedule}', 'Servers\ScheduleController@view');
|
2020-03-22 21:56:15 +01:00
|
|
|
Route::post('/{schedule}', 'Servers\ScheduleController@update');
|
2020-10-15 05:38:59 +02:00
|
|
|
Route::post('/{schedule}/execute', 'Servers\ScheduleController@execute');
|
2020-03-22 21:56:15 +01:00
|
|
|
Route::delete('/{schedule}', 'Servers\ScheduleController@delete');
|
|
|
|
|
2020-03-19 06:28:32 +01:00
|
|
|
Route::post('/{schedule}/tasks', 'Servers\ScheduleTaskController@store');
|
|
|
|
Route::post('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@update');
|
2020-03-19 05:08:32 +01:00
|
|
|
Route::delete('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@delete');
|
2020-02-09 00:23:08 +01:00
|
|
|
});
|
|
|
|
|
2021-01-20 06:19:17 +01:00
|
|
|
Route::group(['prefix' => '/network'], function () {
|
2020-07-10 05:36:08 +02:00
|
|
|
Route::get('/allocations', 'Servers\NetworkAllocationController@index');
|
2020-10-31 22:58:15 +01:00
|
|
|
Route::post('/allocations', 'Servers\NetworkAllocationController@store');
|
2020-07-10 05:36:08 +02:00
|
|
|
Route::post('/allocations/{allocation}', 'Servers\NetworkAllocationController@update');
|
|
|
|
Route::post('/allocations/{allocation}/primary', 'Servers\NetworkAllocationController@setPrimary');
|
|
|
|
Route::delete('/allocations/{allocation}', 'Servers\NetworkAllocationController@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 () {
|
2019-11-03 21:20:11 +01:00
|
|
|
Route::get('/', 'Servers\SubuserController@index');
|
2020-03-27 22:23:13 +01:00
|
|
|
Route::post('/', 'Servers\SubuserController@store');
|
2021-08-07 20:15:44 +02:00
|
|
|
Route::get('/{subuser}', [Client\Servers\SubuserController::class, 'view']);
|
|
|
|
Route::post('/{subuser}', [Client\Servers\SubuserController::class, 'update']);
|
|
|
|
Route::delete('/{subuser}', [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 () {
|
|
|
|
Route::get('/', 'Servers\BackupController@index');
|
2020-04-10 07:35:38 +02:00
|
|
|
Route::post('/', 'Servers\BackupController@store');
|
2020-04-04 19:59:25 +02:00
|
|
|
Route::get('/{backup}', 'Servers\BackupController@view');
|
2021-01-18 02:57:34 +01:00
|
|
|
Route::get('/{backup}/download', 'Servers\BackupController@download');
|
2021-05-04 06:26:09 +02:00
|
|
|
Route::post('/{backup}/lock', 'Servers\BackupController@toggleLock');
|
2021-01-18 03:25:13 +01:00
|
|
|
Route::post('/{backup}/restore', 'Servers\BackupController@restore');
|
2020-04-04 19:59:25 +02:00
|
|
|
Route::delete('/{backup}', 'Servers\BackupController@delete');
|
|
|
|
});
|
|
|
|
|
2020-08-23 03:13:59 +02:00
|
|
|
Route::group(['prefix' => '/startup'], function () {
|
2020-08-26 04:22:17 +02:00
|
|
|
Route::get('/', 'Servers\StartupController@index');
|
2020-08-23 03:13:59 +02:00
|
|
|
Route::put('/variable', 'Servers\StartupController@update');
|
|
|
|
});
|
|
|
|
|
2019-12-10 07:03:10 +01:00
|
|
|
Route::group(['prefix' => '/settings'], function () {
|
|
|
|
Route::post('/rename', 'Servers\SettingsController@rename');
|
2020-04-03 23:43:24 +02:00
|
|
|
Route::post('/reinstall', 'Servers\SettingsController@reinstall');
|
2020-12-13 20:07:29 +01:00
|
|
|
Route::put('/docker-image', 'Servers\SettingsController@dockerImage');
|
2019-12-10 07:03:10 +01:00
|
|
|
});
|
2018-02-25 22:30:56 +01:00
|
|
|
});
|