2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
2016-01-20 00:10:39 +00:00
|
|
|
/**
|
|
|
|
* Pterodactyl Panel
|
|
|
|
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2015-12-06 18:58:49 +00:00
|
|
|
namespace Pterodactyl\Http\Routes;
|
|
|
|
|
|
|
|
use Illuminate\Routing\Router;
|
|
|
|
|
|
|
|
class ServerRoutes {
|
|
|
|
|
|
|
|
public function map(Router $router) {
|
2016-01-04 21:09:39 +00:00
|
|
|
$router->group([
|
|
|
|
'prefix' => 'server/{server}',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
2016-01-13 02:50:43 +00:00
|
|
|
'server',
|
|
|
|
'csrf'
|
2016-01-04 21:09:39 +00:00
|
|
|
]
|
|
|
|
], function ($server) use ($router) {
|
|
|
|
// Index View for Server
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'server.index',
|
|
|
|
'uses' => 'Server\ServerController@getIndex'
|
|
|
|
]);
|
2015-12-06 18:58:49 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// File Manager Routes
|
|
|
|
$router->get('/files', [
|
|
|
|
'as' => 'files.index',
|
|
|
|
'uses' => 'Server\ServerController@getFiles'
|
|
|
|
]);
|
2015-12-06 18:58:49 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
$router->get('/files/edit/{file}', [
|
|
|
|
'as' => 'files.edit',
|
|
|
|
'uses' => 'Server\ServerController@getEditFile'
|
|
|
|
])->where('file', '.*');
|
|
|
|
|
|
|
|
$router->get('/files/download/{file}', [
|
|
|
|
'as' => 'files.download',
|
|
|
|
'uses' => 'Server\ServerController@getDownloadFile'
|
|
|
|
])->where('file', '.*');
|
|
|
|
|
|
|
|
$router->get('/files/add', [
|
|
|
|
'as' => 'files.add',
|
|
|
|
'uses' => 'Server\ServerController@getAddFile'
|
|
|
|
]);
|
|
|
|
|
2016-01-09 00:54:06 +00:00
|
|
|
$router->post('files/directory-list', [
|
|
|
|
'as' => 'server.files.directory-list',
|
|
|
|
'uses' => 'Server\AjaxController@postDirectoryList'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('files/save', [
|
|
|
|
'as' => 'server.files.save',
|
|
|
|
'uses' => 'Server\AjaxController@postSaveFile'
|
|
|
|
]);
|
|
|
|
|
2016-01-18 06:24:33 +00:00
|
|
|
// Sub-User Routes
|
|
|
|
$router->get('users', [
|
|
|
|
'as' => 'server.subusers',
|
|
|
|
'uses' => 'Server\SubuserController@getIndex'
|
|
|
|
]);
|
|
|
|
|
2016-01-19 00:57:10 +00:00
|
|
|
$router->get('users/new', [
|
|
|
|
'as' => 'server.subusers.new',
|
|
|
|
'uses' => 'Server\SubuserController@getNew'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('users/new', [
|
|
|
|
'uses' => 'Server\SubuserController@postNew'
|
|
|
|
]);
|
|
|
|
|
2016-01-18 06:24:33 +00:00
|
|
|
$router->get('users/view/{id}', [
|
|
|
|
'as' => 'server.subusers.view',
|
|
|
|
'uses' => 'Server\SubuserController@getView'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('users/view/{id}', [
|
|
|
|
'uses' => 'Server\SubuserController@postView'
|
|
|
|
]);
|
|
|
|
|
2016-01-19 00:57:10 +00:00
|
|
|
$router->delete('users/delete/{id}', [
|
|
|
|
'uses' => 'Server\SubuserController@deleteSubuser'
|
|
|
|
]);
|
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Assorted AJAX Routes
|
2015-12-06 18:58:49 +00:00
|
|
|
$router->group(['prefix' => 'ajax'], function ($server) use ($router) {
|
2016-01-04 21:09:39 +00:00
|
|
|
// Returns Server Status
|
|
|
|
$router->get('status', [
|
|
|
|
'uses' => 'Server\AjaxController@getStatus'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Sets the Default Connection for the Server
|
|
|
|
$router->post('set-connection', [
|
|
|
|
'uses' => 'Server\AjaxController@postSetConnection'
|
|
|
|
]);
|
2016-01-09 00:54:06 +00:00
|
|
|
});
|
2016-01-04 21:09:39 +00:00
|
|
|
|
2016-01-09 00:54:06 +00:00
|
|
|
// Assorted AJAX Routes
|
|
|
|
$router->group(['prefix' => 'js'], function ($server) use ($router) {
|
|
|
|
// Returns Server Status
|
|
|
|
$router->get('{file}', [
|
|
|
|
'as' => 'server.js',
|
|
|
|
'uses' => 'Server\ServerController@getJavascript'
|
|
|
|
])->where('file', '.*');
|
2016-01-04 21:09:39 +00:00
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|