2016-09-05 20:21:36 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Pterodactyl - Panel
|
2017-01-24 22:57:08 +00:00
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
2016-09-05 20:21:36 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2016-09-05 20:21:36 +00:00
|
|
|
namespace Pterodactyl\Http\Routes;
|
|
|
|
|
|
|
|
use Illuminate\Routing\Router;
|
|
|
|
|
|
|
|
class APIRoutes
|
|
|
|
{
|
2016-12-07 22:46:38 +00:00
|
|
|
public function map(Router $router)
|
|
|
|
{
|
2016-09-05 20:21:36 +00:00
|
|
|
$api = app('Dingo\Api\Routing\Router');
|
2016-10-15 00:22:23 +00:00
|
|
|
$api->version('v1', ['prefix' => 'api/me', 'middleware' => 'api.auth'], function ($api) {
|
|
|
|
$api->get('/', [
|
2016-10-20 22:20:58 +00:00
|
|
|
'as' => 'api.user.me',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\User\InfoController@me',
|
2016-10-15 00:22:23 +00:00
|
|
|
]);
|
2016-10-20 17:39:39 +00:00
|
|
|
|
|
|
|
$api->get('/server/{uuid}', [
|
|
|
|
'as' => 'api.user.server',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\User\ServerController@info',
|
2016-10-20 17:39:39 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->put('/server/{uuid}', [
|
|
|
|
'as' => 'api.user.server.power',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\User\ServerController@power',
|
2016-10-20 17:39:39 +00:00
|
|
|
]);
|
2016-10-15 00:22:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$api->version('v1', ['prefix' => 'api', 'middleware' => 'api.auth'], function ($api) {
|
2016-09-05 20:21:36 +00:00
|
|
|
|
2016-12-07 22:46:38 +00:00
|
|
|
/*
|
2016-09-05 20:21:36 +00:00
|
|
|
* User Routes
|
|
|
|
*/
|
|
|
|
$api->get('users', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.users.list',
|
2016-12-12 19:30:57 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@lists',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('users', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.users.create',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@create',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('users/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.users.view',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@view',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->patch('users/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.users.update',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@update',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->delete('users/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.users.delete',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@delete',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
2016-12-07 22:46:38 +00:00
|
|
|
/*
|
2016-09-05 20:21:36 +00:00
|
|
|
* Server Routes
|
|
|
|
*/
|
|
|
|
$api->get('servers', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.list',
|
2016-12-12 19:30:57 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@lists',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('servers', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.create',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@create',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('servers/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.view',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@view',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->patch('servers/{id}/config', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.config',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@config',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->patch('servers/{id}/build', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.build',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@build',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('servers/{id}/suspend', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.suspend',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@suspend',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('servers/{id}/unsuspend', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.unsuspend',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@unsuspend',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->delete('servers/{id}/{force?}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.servers.delete',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@delete',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
2016-12-07 22:46:38 +00:00
|
|
|
/*
|
2016-09-05 20:21:36 +00:00
|
|
|
* Node Routes
|
|
|
|
*/
|
|
|
|
$api->get('nodes', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.nodes.list',
|
2016-12-12 19:30:57 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@lists',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('nodes', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.nodes.create',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@create',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('nodes/allocations', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.nodes.allocations',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@allocations',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
2016-12-05 03:17:35 +00:00
|
|
|
$api->get('nodes/allocations/{id}', [
|
|
|
|
'as' => 'api.admin.nodes.allocations',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@allocationsView',
|
2016-12-05 03:17:35 +00:00
|
|
|
]);
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2016-09-05 20:21:36 +00:00
|
|
|
$api->get('nodes/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.nodes.view',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@view',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
2016-10-12 19:42:23 +00:00
|
|
|
$api->get('nodes/{id}/config', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.nodes.view',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@config',
|
2016-10-12 19:42:23 +00:00
|
|
|
]);
|
|
|
|
|
2016-09-05 20:21:36 +00:00
|
|
|
$api->delete('nodes/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.nodes.delete',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@delete',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
2016-12-07 22:46:38 +00:00
|
|
|
/*
|
2016-09-05 20:21:36 +00:00
|
|
|
* Location Routes
|
|
|
|
*/
|
|
|
|
$api->get('locations', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.locations.list',
|
2016-12-12 19:30:57 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\LocationController@lists',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
2016-12-07 22:46:38 +00:00
|
|
|
/*
|
2016-09-05 20:21:36 +00:00
|
|
|
* Service Routes
|
|
|
|
*/
|
|
|
|
$api->get('services', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.services.list',
|
2016-12-12 19:30:57 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServiceController@lists',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('services/{id}', [
|
2016-10-15 00:22:23 +00:00
|
|
|
'as' => 'api.admin.services.view',
|
2016-12-07 22:46:38 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServiceController@view',
|
2016-09-05 20:21:36 +00:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|