2018-02-25 21:30:56 +00:00
|
|
|
<?php
|
|
|
|
|
2019-11-04 01:37:06 +00:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2020-12-06 21:56:14 +00:00
|
|
|
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
|
2020-08-20 03:21:12 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\Server\SubuserBelongsToServer;
|
2021-01-20 05:19:17 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer;
|
2018-08-25 22:07:42 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess;
|
2020-07-10 03:36:08 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\Server\AllocationBelongsToServer;
|
2018-02-25 21:30:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Client Control API
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Endpoint: /api/client
|
|
|
|
|
|
|
|
|
*/
|
2020-04-26 20:21:39 +00:00
|
|
|
Route::get('/', 'ClientController@index')->name('api:client.index');
|
2019-11-04 01:37:06 +00:00
|
|
|
Route::get('/permissions', 'ClientController@permissions');
|
2018-02-25 21:30:56 +00:00
|
|
|
|
2018-06-06 06:00:01 +00:00
|
|
|
Route::group(['prefix' => '/account'], function () {
|
2020-12-06 21:56:14 +00: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 05:56:57 +00:00
|
|
|
|
2020-04-26 20:21:39 +00: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 01:15:38 +00:00
|
|
|
|
|
|
|
Route::get('/api-keys', 'ApiKeyController@index');
|
|
|
|
Route::post('/api-keys', 'ApiKeyController@store');
|
2020-03-23 02:10:49 +00:00
|
|
|
Route::delete('/api-keys/{identifier}', 'ApiKeyController@delete');
|
2018-06-06 06:00:01 +00:00
|
|
|
});
|
|
|
|
|
2018-02-25 21:30:56 +00:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Client Control API
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Endpoint: /api/client/servers/{server}
|
|
|
|
|
|
|
|
|
*/
|
2021-01-20 05:19:17 +00:00
|
|
|
Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServerAccess::class, ResourceBelongsToServer::class]], function () {
|
2020-04-26 20:21:39 +00: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 21:30:56 +00:00
|
|
|
|
2020-04-26 20:21:39 +00:00
|
|
|
Route::post('/command', 'Servers\CommandController@index');
|
|
|
|
Route::post('/power', 'Servers\PowerController@index');
|
2018-08-22 04:47:01 +00:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/databases'], function () {
|
2020-04-26 20:21:39 +00:00
|
|
|
Route::get('/', 'Servers\DatabaseController@index');
|
2018-08-23 05:29:20 +00:00
|
|
|
Route::post('/', 'Servers\DatabaseController@store');
|
2019-07-27 22:17:50 +00:00
|
|
|
Route::post('/{database}/rotate-password', 'Servers\DatabaseController@rotatePassword');
|
2020-04-26 20:21:39 +00:00
|
|
|
Route::delete('/{database}', 'Servers\DatabaseController@delete');
|
2018-08-22 04:47:01 +00:00
|
|
|
});
|
2019-03-17 00:10:04 +00:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/files'], function () {
|
2020-07-11 23:00:30 +00:00
|
|
|
Route::get('/list', 'Servers\FileController@directory');
|
|
|
|
Route::get('/contents', 'Servers\FileController@contents');
|
2019-10-26 21:36:37 +00:00
|
|
|
Route::get('/download', 'Servers\FileController@download');
|
2020-07-11 23:00:30 +00:00
|
|
|
Route::put('/rename', 'Servers\FileController@rename');
|
|
|
|
Route::post('/copy', 'Servers\FileController@copy');
|
|
|
|
Route::post('/write', 'Servers\FileController@write');
|
|
|
|
Route::post('/compress', 'Servers\FileController@compress');
|
2020-07-15 04:16:49 +00:00
|
|
|
Route::post('/decompress', 'Servers\FileController@decompress');
|
2020-04-26 20:21:39 +00:00
|
|
|
Route::post('/delete', 'Servers\FileController@delete');
|
2020-07-11 23:00:30 +00:00
|
|
|
Route::post('/create-folder', 'Servers\FileController@create');
|
2020-11-29 20:49:29 +00:00
|
|
|
Route::post('/chmod', 'Servers\FileController@chmod');
|
2020-12-25 23:09:02 +00:00
|
|
|
Route::post('/pull', 'Servers\FileController@pull')->middleware(['throttle:10,5']);
|
2020-07-12 22:42:32 +00:00
|
|
|
Route::get('/upload', 'Servers\FileUploadController');
|
2019-03-17 00:10:04 +00:00
|
|
|
});
|
2019-03-24 00:47:20 +00:00
|
|
|
|
2020-02-08 23:23:08 +00:00
|
|
|
Route::group(['prefix' => '/schedules'], function () {
|
|
|
|
Route::get('/', 'Servers\ScheduleController@index');
|
2020-03-22 20:56:15 +00:00
|
|
|
Route::post('/', 'Servers\ScheduleController@store');
|
2020-03-18 06:33:53 +00:00
|
|
|
Route::get('/{schedule}', 'Servers\ScheduleController@view');
|
2020-03-22 20:56:15 +00:00
|
|
|
Route::post('/{schedule}', 'Servers\ScheduleController@update');
|
2020-10-15 03:38:59 +00:00
|
|
|
Route::post('/{schedule}/execute', 'Servers\ScheduleController@execute');
|
2020-03-22 20:56:15 +00:00
|
|
|
Route::delete('/{schedule}', 'Servers\ScheduleController@delete');
|
|
|
|
|
2020-03-19 05:28:32 +00:00
|
|
|
Route::post('/{schedule}/tasks', 'Servers\ScheduleTaskController@store');
|
|
|
|
Route::post('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@update');
|
2020-03-19 04:08:32 +00:00
|
|
|
Route::delete('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@delete');
|
2020-02-08 23:23:08 +00:00
|
|
|
});
|
|
|
|
|
2021-01-20 05:19:17 +00:00
|
|
|
Route::group(['prefix' => '/network'], function () {
|
2020-07-10 03:36:08 +00:00
|
|
|
Route::get('/allocations', 'Servers\NetworkAllocationController@index');
|
2020-10-31 21:58:15 +00:00
|
|
|
Route::post('/allocations', 'Servers\NetworkAllocationController@store');
|
2020-07-10 03:36:08 +00: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 00:47:20 +00:00
|
|
|
});
|
2019-11-03 20:20:11 +00:00
|
|
|
|
2021-01-20 05:19:17 +00:00
|
|
|
Route::group(['prefix' => '/users'], function () {
|
2019-11-03 20:20:11 +00:00
|
|
|
Route::get('/', 'Servers\SubuserController@index');
|
2020-03-27 21:23:13 +00:00
|
|
|
Route::post('/', 'Servers\SubuserController@store');
|
2020-08-20 03:21:12 +00:00
|
|
|
Route::get('/{user}', 'Servers\SubuserController@view');
|
|
|
|
Route::post('/{user}', 'Servers\SubuserController@update');
|
|
|
|
Route::delete('/{user}', 'Servers\SubuserController@delete');
|
2019-11-03 20:20:11 +00:00
|
|
|
});
|
2019-12-10 06:03:10 +00:00
|
|
|
|
2020-04-04 17:59:25 +00:00
|
|
|
Route::group(['prefix' => '/backups'], function () {
|
|
|
|
Route::get('/', 'Servers\BackupController@index');
|
2020-04-10 05:35:38 +00:00
|
|
|
Route::post('/', 'Servers\BackupController@store');
|
2020-04-04 17:59:25 +00:00
|
|
|
Route::get('/{backup}', 'Servers\BackupController@view');
|
2020-04-05 02:54:59 +00:00
|
|
|
Route::get('/{backup}/download', 'Servers\DownloadBackupController');
|
2020-04-04 17:59:25 +00:00
|
|
|
Route::delete('/{backup}', 'Servers\BackupController@delete');
|
|
|
|
});
|
|
|
|
|
2020-08-23 01:13:59 +00:00
|
|
|
Route::group(['prefix' => '/startup'], function () {
|
2020-08-26 02:22:17 +00:00
|
|
|
Route::get('/', 'Servers\StartupController@index');
|
2020-08-23 01:13:59 +00:00
|
|
|
Route::put('/variable', 'Servers\StartupController@update');
|
|
|
|
});
|
|
|
|
|
2019-12-10 06:03:10 +00:00
|
|
|
Route::group(['prefix' => '/settings'], function () {
|
|
|
|
Route::post('/rename', 'Servers\SettingsController@rename');
|
2020-04-03 21:43:24 +00:00
|
|
|
Route::post('/reinstall', 'Servers\SettingsController@reinstall');
|
2020-12-13 19:07:29 +00:00
|
|
|
Route::put('/docker-image', 'Servers\SettingsController@dockerImage');
|
2019-12-10 06:03:10 +00:00
|
|
|
});
|
2018-02-25 21:30:56 +00:00
|
|
|
});
|