Fixup merge

This commit is contained in:
Dane Everitt 2017-04-20 17:26:20 -04:00
parent 8d24e5f168
commit c8f1335a09
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 13 additions and 589 deletions

View file

@ -13,7 +13,7 @@ DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=memcached
CACHE_DRIVER=file
SESSION_DRIVER=database
MAIL_DRIVER=smtp

View file

@ -233,10 +233,8 @@ class OptionController extends Controller
$repo = new OptionRepository;
try {
$repo->scripts($id, $request->only([
'script_install', 'script_upgrade',
]));
Alert::success('Successfully updated option scripts to be run when servers are installed or updated.')->flash();
$repo->scripts($id, $request->only('script_install'));
Alert::success('Successfully updated option scripts to be run when servers are installed.')->flash();
} catch (DisplayValidationException $ex) {
return redirect()->route('admin.services.option.scripts', $id)->withErrors(json_decode($ex->getMessage()));
} catch (\Exception $ex) {

View file

@ -42,7 +42,7 @@ class OptionController extends Controller
return response()->json([
'scripts' => [
'install' => str_replace(["\r\n", "\n", "\r"], "\n", $server->option->script_install),
'upgrade' => str_replace(["\r\n", "\n", "\r"], "\n", $server->option->script_upgrade),
// 'upgrade' => str_replace(["\r\n", "\n", "\r"], "\n", $server->option->script_upgrade),
'privileged' => $server->option->script_is_privileged,
],
'env' => $environment->merge([

View file

@ -1,486 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>.
*
* 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.
*/
namespace Pterodactyl\Http\Routes;
use Illuminate\Routing\Router;
class AdminRoutes
{
public function map(Router $router)
{
// Admin Index
$router->get('admin', [
'as' => 'admin.index',
'middleware' => [
'auth',
'admin',
'csrf',
],
'uses' => 'Admin\BaseController@getIndex',
]);
$router->group([
'prefix' => 'admin/databases',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.databases',
'uses' => 'Admin\DatabaseController@index',
]);
$router->post('/', 'Admin\DatabaseController@create');
$router->get('/view/{id}', [
'as' => 'admin.databases.view',
'uses' => 'Admin\DatabaseController@view',
]);
$router->post('/view/{id}', 'Admin\DatabaseController@update');
});
$router->group([
'prefix' => 'admin/locations',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.locations',
'uses' => 'Admin\LocationController@index',
]);
$router->post('/', 'Admin\LocationController@create');
$router->get('/view/{id}', [
'as' => 'admin.locations.view',
'uses' => 'Admin\LocationController@view',
]);
$router->post('/view/{id}', 'Admin\LocationController@update');
});
$router->group([
'prefix' => 'admin/settings',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.settings',
'uses' => 'Admin\BaseController@getSettings',
]);
$router->post('/', [
'uses' => 'Admin\BaseController@postSettings',
]);
});
$router->group([
'prefix' => 'admin/users',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
// View All Accounts on System
$router->get('/', [
'as' => 'admin.users',
'uses' => 'Admin\UserController@getIndex',
]);
$router->get('/accounts.json', [
'as' => 'admin.users.json',
'uses' => 'Admin\UserController@getJson',
]);
// View Specific Account
$router->get('/view/{id}', [
'as' => 'admin.users.view',
'uses' => 'Admin\UserController@getView',
]);
// View Specific Account
$router->post('/view/{id}', [
'uses' => 'Admin\UserController@updateUser',
]);
// Delete an Account Matching an ID
$router->delete('/view/{id}', [
'uses' => 'Admin\UserController@deleteUser',
]);
// Show Create Account Page
$router->get('/new', [
'as' => 'admin.users.new',
'uses' => 'Admin\UserController@getNew',
]);
// Handle Creating New Account
$router->post('/new', [
'uses' => 'Admin\UserController@postNew',
]);
});
// Server Routes
$router->group([
'prefix' => 'admin/servers',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
// View All Servers
$router->get('/', [
'as' => 'admin.servers',
'uses' => 'Admin\ServersController@index',
]);
// View Create Server Page
$router->get('/new', [
'as' => 'admin.servers.new',
'uses' => 'Admin\ServersController@new',
]);
// Handle POST Request for Creating Server
$router->post('/new', [
'uses' => 'Admin\ServersController@create',
]);
// Assorted Page Helpers
$router->post('/new/nodes', [
'as' => 'admin.servers.new.nodes',
'uses' => 'Admin\ServersController@newServerNodes',
]);
$router->get('/view/{id}', [
'as' => 'admin.servers.view',
'uses' => 'Admin\ServersController@viewIndex',
]);
$router->get('/view/{id}/details', [
'as' => 'admin.servers.view.details',
'uses' => 'Admin\ServersController@viewDetails',
]);
$router->post('/view/{id}/details', [
'uses' => 'Admin\ServersController@setDetails',
]);
$router->post('/view/{id}/details/container', [
'as' => 'admin.servers.view.details.container',
'uses' => 'Admin\ServersController@setContainer',
]);
$router->get('/view/{id}/build', [
'as' => 'admin.servers.view.build',
'uses' => 'Admin\ServersController@viewBuild',
]);
$router->post('/view/{id}/build', [
'uses' => 'Admin\ServersController@updateBuild',
]);
$router->get('/view/{id}/startup', [
'as' => 'admin.servers.view.startup',
'uses' => 'Admin\ServersController@viewStartup',
]);
$router->post('/view/{id}/startup', [
'uses' => 'Admin\ServersController@saveStartup',
]);
$router->get('/view/{id}/database', [
'as' => 'admin.servers.view.database',
'uses' => 'Admin\ServersController@viewDatabase',
]);
$router->post('/view/{id}/database', [
'uses' => 'Admin\ServersController@newDatabase',
]);
$router->patch('/view/{id}/database', [
'uses' => 'Admin\ServersController@resetDatabasePassword',
]);
$router->delete('/view/{id}/database/{database}/delete', [
'as' => 'admin.servers.view.database.delete',
'uses' => 'Admin\ServersController@deleteDatabase',
]);
$router->get('/view/{id}/manage', [
'as' => 'admin.servers.view.manage',
'uses' => 'Admin\ServersController@viewManage',
]);
$router->post('/view/{id}/manage/toggle', [
'as' => 'admin.servers.view.manage.toggle',
'uses' => 'Admin\ServersController@toggleInstall',
]);
$router->post('/view/{id}/manage/rebuild', [
'as' => 'admin.servers.view.manage.rebuild',
'uses' => 'Admin\ServersController@rebuildContainer',
]);
$router->post('/view/{id}/manage/suspension', [
'as' => 'admin.servers.view.manage.suspension',
'uses' => 'Admin\ServersController@manageSuspension',
]);
$router->get('/view/{id}/delete', [
'as' => 'admin.servers.view.delete',
'uses' => 'Admin\ServersController@viewDelete',
]);
$router->post('/view/{id}/delete', [
'uses' => 'Admin\ServersController@delete',
]);
$router->post('/view/{id}/delete/continue/{force?}', [
'as' => 'admin.servers.view.delete.continue',
'uses' => 'Admin\ServersController@continueDeletion',
]);
$router->post('/view/{id}/delete/cancel', [
'as' => 'admin.servers.view.delete.cancel',
'uses' => 'Admin\ServersController@cancelDeletion',
]);
});
// Node Routes
$router->group([
'prefix' => 'admin/nodes',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
// View All Nodes
$router->get('/', [
'as' => 'admin.nodes',
'uses' => 'Admin\NodesController@index',
]);
// Add New Node
$router->get('/new', [
'as' => 'admin.nodes.new',
'uses' => 'Admin\NodesController@new',
]);
$router->post('/new', [
'uses' => 'Admin\NodesController@create',
]);
$router->get('/view/{id}', [
'as' => 'admin.nodes.view',
'uses' => 'Admin\NodesController@viewIndex',
]);
$router->get('/view/{id}/settings', [
'as' => 'admin.nodes.view.settings',
'uses' => 'Admin\NodesController@viewSettings',
]);
$router->post('/view/{id}/settings', [
'uses' => 'Admin\NodesController@updateSettings',
]);
$router->get('/view/{id}/configuration', [
'as' => 'admin.nodes.view.configuration',
'uses' => 'Admin\NodesController@viewConfiguration',
]);
$router->get('/view/{id}/allocation', [
'as' => 'admin.nodes.view.allocation',
'uses' => 'Admin\NodesController@viewAllocation',
]);
$router->post('/view/{id}/allocation', [
'uses' => 'Admin\NodesController@createAllocation',
]);
$router->get('/view/{id}/servers', [
'as' => 'admin.nodes.view.servers',
'uses' => 'Admin\NodesController@viewServers',
]);
$router->delete('/view/{id}/delete', [
'as' => 'admin.nodes.view.delete',
'uses' => 'Admin\NodesController@delete',
]);
$router->delete('/view/{id}/allocation/remove/{allocation}', [
'as' => 'admin.nodes.view.allocation.removeSingle',
'uses' => 'Admin\NodesController@allocationRemoveSingle',
]);
$router->post('/view/{id}/allocation/remove', [
'as' => 'admin.nodes.view.allocation.removeBlock',
'uses' => 'Admin\NodesController@allocationRemoveBlock',
]);
$router->post('/view/{id}/allocation/alias', [
'as' => 'admin.nodes.view.allocation.setAlias',
'uses' => 'Admin\NodesController@allocationSetAlias',
]);
$router->get('/view/{id}/settings/token', [
'as' => 'admin.nodes.view.configuration.token',
'uses' => 'Admin\NodesController@setToken',
]);
});
// Service Routes
$router->group([
'prefix' => 'admin/services',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.services',
'uses' => 'Admin\ServiceController@index',
]);
$router->get('/new', [
'as' => 'admin.services.new',
'uses' => 'Admin\ServiceController@new',
]);
$router->post('/new', [
'uses' => 'Admin\ServiceController@create',
]);
$router->get('/view/{id}', [
'as' => 'admin.services.view',
'uses' => 'Admin\ServiceController@view',
]);
$router->post('/view/{id}', 'Admin\ServiceController@edit');
$router->get('/view/{id}/functions', [
'as' => 'admin.services.view.functions',
'uses' => 'Admin\ServiceController@viewFunctions',
]);
$router->delete('/view/{id}', [
'uses' => 'Admin\ServiceController@delete',
]);
// ---------------------
// Service Option Routes
// ---------------------
$router->get('/option/new', [
'as' => 'admin.services.option.new',
'uses' => 'Admin\OptionController@new',
]);
$router->post('/option/new', 'Admin\OptionController@create');
$router->get('/option/{id}', [
'as' => 'admin.services.option.view',
'uses' => 'Admin\OptionController@viewConfiguration',
]);
$router->post('/option/{id}', 'Admin\OptionController@editConfiguration');
$router->get('/option/{id}/variables', [
'as' => 'admin.services.option.variables',
'uses' => 'Admin\OptionController@viewVariables',
]);
$router->post('/option/{id}/variables', 'Admin\OptionController@createVariable');
$router->post('/option/{id}/variables/{variable}', [
'as' => 'admin.services.option.variables.edit',
'uses' => 'Admin\OptionController@editVariable',
]);
$router->get('/option/{id}/scripts', [
'as' => 'admin.services.option.scripts',
'uses' => 'Admin\OptionController@viewScripts',
]);
$router->post('/option/{id}/scripts', 'Admin\OptionController@updateScripts');
});
// Service Packs
$router->group([
'prefix' => 'admin/packs',
'middleware' => [
'auth',
'admin',
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.packs',
'uses' => 'Admin\PackController@index',
]);
$router->get('/new', [
'as' => 'admin.packs.new',
'uses' => 'Admin\PackController@new',
]);
$router->post('/new', 'Admin\PackController@create');
$router->get('/new/template', [
'as' => 'admin.packs.new.template',
'uses' => 'Admin\PackController@newTemplate',
]);
$router->get('/view/{id}', [
'as' => 'admin.packs.view',
'uses' => 'Admin\PackController@view',
]);
$router->post('/view/{id}', 'Admin\PackController@update');
$router->post('/view/{id}/export/{files?}', [
'as' => 'admin.packs.view.export',
'uses' => 'Admin\PackController@export',
]);
});
}
}

View file

@ -1,59 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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.
*/
namespace Pterodactyl\Http\Routes;
use Illuminate\Routing\Router;
class DaemonRoutes
{
public function map(Router $router)
{
$router->group(['prefix' => 'daemon', 'middleware' => 'daemon'], function () use ($router) {
$router->get('services', [
'as' => 'daemon.services',
'uses' => 'Daemon\ServiceController@list',
]);
$router->get('services/pull/{service}/{file}', [
'as' => 'remote.install',
'uses' => 'Daemon\ServiceController@pull',
]);
$router->get('packs/pull/{uuid}', [
'as' => 'daemon.pack.pull',
'uses' => 'Daemon\PackController@pull',
]);
$router->get('packs/pull/{uuid}/hash', [
'as' => 'daemon.pack.hash',
'uses' => 'Daemon\PackController@hash',
]);
$router->get('details/option/{server}', [
'as' => 'daemon.pack.hash',
'uses' => 'Daemon\OptionController@details',
]);
});
}
}

View file

@ -42,7 +42,6 @@ class ServiceOption extends Model
*/
protected $guarded = ['id', 'created_at', 'updated_at'];
<<<<<<< HEAD
/**
* Cast values to correct type.
*
@ -52,16 +51,6 @@ class ServiceOption extends Model
'service_id' => 'integer',
'script_is_privileged' => 'boolean',
];
=======
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'service_id' => 'integer',
];
>>>>>>> develop
/**
* Returns the display startup string for the option and will use the parent

View file

@ -169,11 +169,9 @@ class OptionRepository
$option = ServiceOption::findOrFail($id);
$data['script_install'] = empty($data['script_install']) ? null : $data['script_install'];
$data['script_upgrade'] = empty($data['script_upgrade']) ? null : $data['script_upgrade'];
$validator = Validator::make($data, [
'script_install' => 'sometimes|nullable|string',
'script_upgrade' => 'sometimes|nullable|string',
'script_is_privileged' => 'sometimes|required|boolean',
]);

View file

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddInstallAndUpgradePaths extends Migration
class AddScriptsToServiceOptions extends Migration
{
/**
* Run the migrations.
@ -14,9 +14,8 @@ class AddInstallAndUpgradePaths extends Migration
public function up()
{
Schema::table('service_options', function (Blueprint $table) {
$table->text('script_upgrade')->after('startup')->nullable();
$table->text('script_install')->after('startup')->nullable();
$table->boolean('script_is_privileged')->default(false)->after('startup');
$table->boolean('script_is_privileged')->default(true)->after('startup');
});
}
@ -28,7 +27,6 @@ class AddInstallAndUpgradePaths extends Migration
public function down()
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('script_upgrade');
$table->dropColumn('script_install');
$table->dropColumn('script_is_privileged');
});

File diff suppressed because one or more lines are too long

View file

@ -55,20 +55,9 @@
<div class="box-body no-padding">
<div id="editor_install"style="height:300px">{{ $option->script_install }}</div>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Upgrade Script</h3>
</div>
<div class="box-body no-padding">
<div id="editor_upgrade"style="height:300px">{{ $option->script_upgrade }}</div>
</div>
<div class="box-footer">
{!! csrf_field() !!}
<textarea name="script_install" class="hidden"></textarea>
<textarea name="script_upgrade" class="hidden"></textarea>
<button type="submit" class="btn btn-primary btn-sm pull-right">Save Scripts</button>
</div>
</div>
@ -79,13 +68,11 @@
@section('footer-scripts')
@parent
{!! Theme::js('js/vendor/ace/ace.js') !!}
{!! Theme::js('js/vendor/ace/ext-modelist.js') !!}
{!! Theme::js('vendor/ace/ace.js') !!}
{!! Theme::js('vendor/ace/ext-modelist.js') !!}
<script>
$(document).ready(function () {
const InstallEditor = ace.edit('editor_install');
const UpgradeEditor = ace.edit('editor_upgrade');
const Modelist = ace.require('ace/ext/modelist')
InstallEditor.setTheme('ace/theme/chrome');
@ -93,15 +80,10 @@
InstallEditor.getSession().setUseWrapMode(true);
InstallEditor.setShowPrintMargin(false);
UpgradeEditor.setTheme('ace/theme/chrome');
UpgradeEditor.getSession().setMode('ace/mode/sh');
UpgradeEditor.getSession().setUseWrapMode(true);
UpgradeEditor.setShowPrintMargin(false);
$('form').on('submit', function (e) {
$('textarea[name="script_install"]').val(InstallEditor.getValue());
$('textarea[name="script_upgrade"]').val(UpgradeEditor.getValue());
});
});
</script>
@endsection

View file

@ -169,11 +169,13 @@ Route::group(['prefix' => 'services'], function () {
Route::get('/option/new', 'OptionController@create')->name('admin.services.option.new');
Route::get('/option/{id}', 'OptionController@viewConfiguration')->name('admin.services.option.view');
Route::get('/option/{id}/variables', 'OptionController@viewVariables')->name('admin.services.option.variables');
Route::get('/option/{id}/scripts', 'OptionController@viewScripts')->name('admin.services.option.scripts');
Route::post('/new', 'ServiceController@store');
Route::post('/view/{id}', 'ServiceController@edit');
Route::post('/option/new', 'OptionController@store');
Route::post('/option/{id}', 'OptionController@editConfiguration');
Route::post('/option/{id}/scripts', 'OptionController@updateScripts');
Route::post('/option/{id}/variables', 'OptionController@createVariable');
Route::post('/option/{id}/variables/{variable}', 'OptionController@editVariable')->name('admin.services.option.variables.edit');

View file

@ -25,3 +25,4 @@ Route::get('/services', 'ServiceController@list')->name('daemon.services');
Route::get('/services/pull/{service}/{file}', 'ServiceController@pull')->name('daemon.pull');
Route::get('/packs/pull/{uuid}', 'PackController@pull')->name('daemon.pack.pull');
Route::get('/packs/pull/{uuid}/hash', 'PackController@hash')->name('daemon.pack.hash');
Route::get('/details/option/{server}', 'OptionController@details')->name('daemon.option.details');