Pterodactyl-Panel/routes/api-client.php

122 lines
6.2 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Support\Facades\Route;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer;
2018-08-26 00:07:42 +02:00
use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess;
/*
|--------------------------------------------------------------------------
| Client Control API
|--------------------------------------------------------------------------
|
| Endpoint: /api/client
|
*/
Route::get('/', 'ClientController@index')->name('api:client.index');
Route::get('/permissions', 'ClientController@permissions');
Route::group(['prefix' => '/account'], function () {
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);
Route::put('/email', 'AccountController@updateEmail')->name('api:client.account.update-email');
Route::put('/password', 'AccountController@updatePassword')->name('api:client.account.update-password');
Route::get('/api-keys', 'ApiKeyController@index');
Route::post('/api-keys', 'ApiKeyController@store');
Route::delete('/api-keys/{identifier}', 'ApiKeyController@delete');
});
/*
|--------------------------------------------------------------------------
| Client Control API
|--------------------------------------------------------------------------
|
| Endpoint: /api/client/servers/{server}
|
*/
Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServerAccess::class, ResourceBelongsToServer::class]], function () {
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');
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 () {
Route::get('/', 'Servers\DatabaseController@index');
Route::post('/', 'Servers\DatabaseController@store');
2019-07-28 00:17:50 +02:00
Route::post('/{database}/rotate-password', 'Servers\DatabaseController@rotatePassword');
Route::delete('/{database}', 'Servers\DatabaseController@delete');
2018-08-22 06:47:01 +02:00
});
Route::group(['prefix' => '/files'], function () {
Route::get('/list', 'Servers\FileController@directory');
Route::get('/contents', 'Servers\FileController@contents');
Route::get('/download', 'Servers\FileController@download');
Route::put('/rename', 'Servers\FileController@rename');
Route::post('/copy', 'Servers\FileController@copy');
Route::post('/write', 'Servers\FileController@write');
Route::post('/compress', 'Servers\FileController@compress');
Route::post('/decompress', 'Servers\FileController@decompress');
Route::post('/delete', 'Servers\FileController@delete');
Route::post('/create-folder', 'Servers\FileController@create');
Route::post('/chmod', 'Servers\FileController@chmod');
2020-12-26 00:09:02 +01:00
Route::post('/pull', 'Servers\FileController@pull')->middleware(['throttle:10,5']);
Route::get('/upload', 'Servers\FileUploadController');
});
2020-02-09 00:23:08 +01:00
Route::group(['prefix' => '/schedules'], function () {
Route::get('/', 'Servers\ScheduleController@index');
Route::post('/', 'Servers\ScheduleController@store');
2020-03-18 07:33:53 +01:00
Route::get('/{schedule}', 'Servers\ScheduleController@view');
Route::post('/{schedule}', 'Servers\ScheduleController@update');
Route::post('/{schedule}/execute', 'Servers\ScheduleController@execute');
Route::delete('/{schedule}', 'Servers\ScheduleController@delete');
Route::post('/{schedule}/tasks', 'Servers\ScheduleTaskController@store');
Route::post('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@update');
Route::delete('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@delete');
2020-02-09 00:23:08 +01:00
});
Route::group(['prefix' => '/network'], function () {
Route::get('/allocations', 'Servers\NetworkAllocationController@index');
Route::post('/allocations', 'Servers\NetworkAllocationController@store');
Route::post('/allocations/{allocation}', 'Servers\NetworkAllocationController@update');
Route::post('/allocations/{allocation}/primary', 'Servers\NetworkAllocationController@setPrimary');
Route::delete('/allocations/{allocation}', 'Servers\NetworkAllocationController@delete');
});
2019-11-03 21:20:11 +01:00
Route::group(['prefix' => '/users'], function () {
2019-11-03 21:20:11 +01:00
Route::get('/', 'Servers\SubuserController@index');
Route::post('/', 'Servers\SubuserController@store');
Route::get('/{user}', 'Servers\SubuserController@view');
Route::post('/{user}', 'Servers\SubuserController@update');
Route::delete('/{user}', 'Servers\SubuserController@delete');
2019-11-03 21:20:11 +01:00
});
Route::group(['prefix' => '/backups'], function () {
Route::get('/', 'Servers\BackupController@index');
2020-04-10 07:35:38 +02:00
Route::post('/', 'Servers\BackupController@store');
Route::get('/{backup}', 'Servers\BackupController@view');
2021-01-18 02:57:34 +01:00
Route::get('/{backup}/download', 'Servers\BackupController@download');
Route::post('/{backup}/lock', 'Servers\BackupController@toggleLock');
Route::post('/{backup}/restore', 'Servers\BackupController@restore');
Route::delete('/{backup}', 'Servers\BackupController@delete');
});
Route::group(['prefix' => '/startup'], function () {
Route::get('/', 'Servers\StartupController@index');
Route::put('/variable', 'Servers\StartupController@update');
});
Route::group(['prefix' => '/settings'], function () {
Route::post('/rename', 'Servers\SettingsController@rename');
Route::post('/reinstall', 'Servers\SettingsController@reinstall');
Route::put('/docker-image', 'Servers\SettingsController@dockerImage');
});
});