StyleCI cleanup
This commit is contained in:
parent
37a723aa58
commit
1897741381
10 changed files with 17 additions and 36 deletions
|
@ -26,7 +26,6 @@ namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use Log;
|
use Log;
|
||||||
use Alert;
|
use Alert;
|
||||||
use Storage;
|
|
||||||
use Javascript;
|
use Javascript;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Service;
|
use Pterodactyl\Models\Service;
|
||||||
|
@ -67,7 +66,7 @@ class OptionController extends Controller
|
||||||
$option = $repo->create($request->intersect([
|
$option = $repo->create($request->intersect([
|
||||||
'service_id', 'name', 'description', 'tag',
|
'service_id', 'name', 'description', 'tag',
|
||||||
'docker_image', 'startup', 'config_from', 'config_startup',
|
'docker_image', 'startup', 'config_from', 'config_startup',
|
||||||
'config_logs', 'config_files', 'config_stop'
|
'config_logs', 'config_files', 'config_stop',
|
||||||
]));
|
]));
|
||||||
Alert::success('Successfully created new service option.')->flash();
|
Alert::success('Successfully created new service option.')->flash();
|
||||||
|
|
||||||
|
@ -195,7 +194,7 @@ class OptionController extends Controller
|
||||||
Alert::success("The service variable '{$variable->name}' has been updated.")->flash();
|
Alert::success("The service variable '{$variable->name}' has been updated.")->flash();
|
||||||
} else {
|
} else {
|
||||||
$repo->delete($variable);
|
$repo->delete($variable);
|
||||||
Alert::success("That service variable has been deleted.")->flash();
|
Alert::success('That service variable has been deleted.')->flash();
|
||||||
}
|
}
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
return redirect()->route('admin.services.option.variables', $option)->withErrors(json_decode($ex->getMessage()));
|
return redirect()->route('admin.services.option.variables', $option)->withErrors(json_decode($ex->getMessage()));
|
||||||
|
|
|
@ -149,16 +149,4 @@ class ServiceController extends Controller
|
||||||
|
|
||||||
return redirect()->route($redirectTo, $id);
|
return redirect()->route($redirectTo, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edits function file for a service.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param int $id
|
|
||||||
* @return \Illuminate\Response\RedirectResponse
|
|
||||||
*/
|
|
||||||
public function editFunctions(Request $request, $id)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ServiceController extends Controller
|
||||||
|
|
||||||
if ($file === 'index.js') {
|
if ($file === 'index.js') {
|
||||||
return response($service->index_file)->header('Content-Type', 'text/plain');
|
return response($service->index_file)->header('Content-Type', 'text/plain');
|
||||||
} else if ($file === 'main.json') {
|
} elseif ($file === 'main.json') {
|
||||||
return response()->json($this->getConfiguration($service->id));
|
return response()->json($this->getConfiguration($service->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Service extends Model
|
||||||
*/
|
*/
|
||||||
public function defaultIndexFile()
|
public function defaultIndexFile()
|
||||||
{
|
{
|
||||||
return <<<EOF
|
return <<<'EOF'
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,7 +28,6 @@ use DB;
|
||||||
use Validator;
|
use Validator;
|
||||||
use Pterodactyl\Models\ServiceOption;
|
use Pterodactyl\Models\ServiceOption;
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
use Pterodactyl\Repositories\VariableRepository;
|
|
||||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||||
|
|
||||||
class OptionRepository
|
class OptionRepository
|
||||||
|
|
|
@ -25,12 +25,9 @@
|
||||||
namespace Pterodactyl\Repositories;
|
namespace Pterodactyl\Repositories;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Uuid;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
use Pterodactyl\Models\Service;
|
use Pterodactyl\Models\Service;
|
||||||
use Pterodactyl\Models\ServiceVariable;
|
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
use Pterodactyl\Repositories\OptionRepository;
|
|
||||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||||
|
|
||||||
class ServiceRepository
|
class ServiceRepository
|
||||||
|
@ -122,7 +119,7 @@ class ServiceRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::transaction(function () use ($service) {
|
DB::transaction(function () use ($service) {
|
||||||
foreach($service->options as $option) {
|
foreach ($service->options as $option) {
|
||||||
(new OptionRepository)->delete($option->id);
|
(new OptionRepository)->delete($option->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class AddNewServiceOptionsColumns extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
DB::transaction(function() {
|
DB::transaction(function () {
|
||||||
Schema::table('service_options', function (Blueprint $table) {
|
Schema::table('service_options', function (Blueprint $table) {
|
||||||
$table->dropColumn('executable');
|
$table->dropColumn('executable');
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class AddNewServiceOptionsColumns extends Migration
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
DB::transaction(function() {
|
DB::transaction(function () {
|
||||||
Schema::table('service_options', function (Blueprint $table) {
|
Schema::table('service_options', function (Blueprint $table) {
|
||||||
$table->dropForeign('config_from');
|
$table->dropForeign('config_from');
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
*/
|
*/
|
||||||
use Pterodactyl\Models\Service;
|
use Pterodactyl\Models\Service;
|
||||||
use Pterodactyl\Models\ServiceOption;
|
use Pterodactyl\Models\ServiceOption;
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class MigrateToNewServiceSystem extends Migration
|
class MigrateToNewServiceSystem extends Migration
|
||||||
|
@ -69,7 +67,7 @@ class MigrateToNewServiceSystem extends Migration
|
||||||
DB::transaction(function () use ($service) {
|
DB::transaction(function () use ($service) {
|
||||||
$options = ServiceOption::where('service_id', $service->id)->get();
|
$options = ServiceOption::where('service_id', $service->id)->get();
|
||||||
$options->each(function ($item) use ($options) {
|
$options->each(function ($item) use ($options) {
|
||||||
switch($item->tag) {
|
switch ($item->tag) {
|
||||||
case 'vanilla':
|
case 'vanilla':
|
||||||
$item->config_startup = '{"done": ")! For help, type ", "userInteraction": [ "Go to eula.txt for more info."]}';
|
$item->config_startup = '{"done": ")! For help, type ", "userInteraction": [ "Go to eula.txt for more info."]}';
|
||||||
$item->config_files = '{"server.properties":{"parser": "properties", "find":{"server-ip": "0.0.0.0", "enable-query": "true", "server-port": "{{server.build.default.port}}", "query.port": "{{server.build.default.port}}"}}}';
|
$item->config_files = '{"server.properties":{"parser": "properties", "find":{"server-ip": "0.0.0.0", "enable-query": "true", "server-port": "{{server.build.default.port}}", "query.port": "{{server.build.default.port}}"}}}';
|
||||||
|
@ -117,13 +115,13 @@ class MigrateToNewServiceSystem extends Migration
|
||||||
$options->each(function ($item) use ($options) {
|
$options->each(function ($item) use ($options) {
|
||||||
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
|
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
|
||||||
$item->tag = 'insurgency';
|
$item->tag = 'insurgency';
|
||||||
} else if ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') {
|
} elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') {
|
||||||
$item->tag = 'tf2';
|
$item->tag = 'tf2';
|
||||||
} else if ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') {
|
} elseif ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') {
|
||||||
$item->tag = 'source';
|
$item->tag = 'source';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($item->tag) {
|
switch ($item->tag) {
|
||||||
case 'source':
|
case 'source':
|
||||||
$item->config_startup = '{"done": "Assigned anonymous gameserver", "userInteraction": []}';
|
$item->config_startup = '{"done": "Assigned anonymous gameserver", "userInteraction": []}';
|
||||||
$item->config_files = '{}';
|
$item->config_files = '{}';
|
||||||
|
@ -164,7 +162,7 @@ class MigrateToNewServiceSystem extends Migration
|
||||||
DB::transaction(function () use ($service) {
|
DB::transaction(function () use ($service) {
|
||||||
$options = ServiceOption::where('service_id', $service->id)->get();
|
$options = ServiceOption::where('service_id', $service->id)->get();
|
||||||
$options->each(function ($item) use ($options) {
|
$options->each(function ($item) use ($options) {
|
||||||
switch($item->tag) {
|
switch ($item->tag) {
|
||||||
case 'tshock':
|
case 'tshock':
|
||||||
$item->startup = null;
|
$item->startup = null;
|
||||||
$item->config_startup = '{"done": "Type \'help\' for a list of commands", "userInteraction": []}';
|
$item->config_startup = '{"done": "Type \'help\' for a list of commands", "userInteraction": []}';
|
||||||
|
@ -195,7 +193,7 @@ class MigrateToNewServiceSystem extends Migration
|
||||||
DB::transaction(function () use ($service) {
|
DB::transaction(function () use ($service) {
|
||||||
$options = ServiceOption::where('service_id', $service->id)->get();
|
$options = ServiceOption::where('service_id', $service->id)->get();
|
||||||
$options->each(function ($item) use ($options) {
|
$options->each(function ($item) use ($options) {
|
||||||
switch($item->tag) {
|
switch ($item->tag) {
|
||||||
case 'mumble':
|
case 'mumble':
|
||||||
$item->startup = './murmur.x86 -fg';
|
$item->startup = './murmur.x86 -fg';
|
||||||
$item->config_startup = '{"done": "Server listening on", "userInteraction": [ "Generating new server certificate"]}';
|
$item->config_startup = '{"done": "Server listening on", "userInteraction": [ "Generating new server certificate"]}';
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ChangeServiceVariablesValidationRules extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::transaction(function () {
|
DB::transaction(function () {
|
||||||
foreach(ServiceVariable::all() as $variable) {
|
foreach (ServiceVariable::all() as $variable) {
|
||||||
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->regex;
|
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->regex;
|
||||||
$variable->save();
|
$variable->save();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class ChangeServiceVariablesValidationRules extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::transaction(function () {
|
DB::transaction(function () {
|
||||||
foreach(ServiceVariable::all() as $variable) {
|
foreach (ServiceVariable::all() as $variable) {
|
||||||
$variable->regex = str_replace(['required|regex:', 'regex:'], '', $variable->regex);
|
$variable->regex = str_replace(['required|regex:', 'regex:'], '', $variable->regex);
|
||||||
$variable->save();
|
$variable->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
class MoveFunctionsFromFileToDatabase extends Migration
|
class MoveFunctionsFromFileToDatabase extends Migration
|
||||||
{
|
{
|
||||||
|
|
||||||
private $default = <<<EOF
|
private $default = <<<'EOF'
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ class Service extends Core {}
|
||||||
module.exports = Service;
|
module.exports = Service;
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
private $default_mc = <<<EOF
|
private $default_mc = <<<'EOF'
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue