From 777e7138e6789460d5f82c392af653a45e871191 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 2 Dec 2016 19:06:14 -0500 Subject: [PATCH] Update regex checking for minecraft services closes #193 --- CHANGELOG.md | 2 + ...12_02_185206_correct_service_variables.php | 79 +++++++++++++++++++ .../seeds/MinecraftServiceTableSeeder.php | 14 ++-- 3 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 database/migrations/2016_12_02_185206_correct_service_variables.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 126b69c4d..40c7aa6cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,11 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Changed * File uploads now account for a maximum file size that is assigned for the daemon, and gives cleaner errors when that limit is reached. * File upload limit can now be controlled from the panel. +* Updates regex and default values for some Minecraft services to reflect current technology. ### Fixed * Fixes potential for generated password to not meet own validation requirements. +* Fixes some regex checking issues with newer versions of Minecraft. ## v0.5.3 (Bodacious Boreopterus) ### Fixed diff --git a/database/migrations/2016_12_02_185206_correct_service_variables.php b/database/migrations/2016_12_02_185206_correct_service_variables.php new file mode 100644 index 000000000..f3da07e0a --- /dev/null +++ b/database/migrations/2016_12_02_185206_correct_service_variables.php @@ -0,0 +1,79 @@ +where([ + ['name', 'Spigot'], + ['tag', 'spigot'], + ['startup', '-Xms128M -Xmx{{SERVER_MEMORY}}M -Djline.terminal=jline.UnsupportedTerminal -jar {{SERVER_JARFILE}}'], + ])->update([ + 'startup' => null, + ]); + + // Correct Spigot Version Checking + DB::table('service_variables')->where([ + ['name', 'Spigot Version'], + ['env_variable', 'DL_VERSION'], + ['default_value', 'latest'], + ['regex', '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/'], + ])->update([ + 'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/', + ]); + + // Correct Vanilla Version Checking (as well as naming) + DB::table('service_variables')->where([ + ['name', 'Server Jar File'], + ['env_variable', 'VANILLA_VERSION'], + ['default_value', 'latest'], + ['regex', '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/'] + ])->update([ + 'name' => 'Server Version', + 'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/', + ]); + + // Update Sponge Version Checking and Update Default Version + DB::table('service_variables')->where([ + ['name', 'Sponge Version'], + ['env_variable', 'SPONGE_VERSION'], + ['default_value', '1.8.9-4.2.0-BETA-351'], + ['regex', '/^(.*)$/'], + ])->update([ + 'default_value' => '1.10.2-5.1.0-BETA-359', + 'regex' => '/^([a-zA-Z0-9.\-_]+)$/', + ]); + + // Update Bungeecord Version Checking + DB::table('service_variables')->where([ + ['name', 'Bungeecord Version'], + ['env_variable', 'BUNGEE_VERSION'], + ['default_value', 'latest'], + ['regex', '/^(latest|[\d]{3,5})$/'], + ])->update([ + 'regex' => '/^(latest|[\d]{1,6})$/', + ]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // do nothing + } +} diff --git a/database/seeds/MinecraftServiceTableSeeder.php b/database/seeds/MinecraftServiceTableSeeder.php index ff141abdb..9f55abb80 100644 --- a/database/seeds/MinecraftServiceTableSeeder.php +++ b/database/seeds/MinecraftServiceTableSeeder.php @@ -84,7 +84,7 @@ class MinecraftServiceTableSeeder extends Seeder 'tag' => 'spigot', 'docker_image' => 'quay.io/pterodactyl/minecraft:spigot', 'executable' => null, - 'startup' => '-Xms128M -Xmx{{SERVER_MEMORY}}M -Djline.terminal=jline.UnsupportedTerminal -jar {{SERVER_JARFILE}}' + 'startup' => '-Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}' ]); $this->option['sponge'] = Models\ServiceOptions::create([ @@ -132,14 +132,14 @@ class MinecraftServiceTableSeeder extends Seeder Models\ServiceVariables::create([ 'option_id' => $this->option['vanilla']->id, - 'name' => 'Server Jar File', + 'name' => 'Server Version', 'description' => 'The version of Minecraft Vanilla to install. Use "latest" to install the latest version.', 'env_variable' => 'VANILLA_VERSION', 'default_value' => 'latest', 'user_viewable' => 1, 'user_editable' => 1, 'required' => 1, - 'regex' => '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/' + 'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/' ]); } @@ -166,7 +166,7 @@ class MinecraftServiceTableSeeder extends Seeder 'user_viewable' => 1, 'user_editable' => 1, 'required' => 1, - 'regex' => '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/' + 'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/' ]); Models\ServiceVariables::create([ @@ -189,11 +189,11 @@ class MinecraftServiceTableSeeder extends Seeder 'name' => 'Sponge Version', 'description' => 'The version of SpongeVanilla to download and use.', 'env_variable' => 'SPONGE_VERSION', - 'default_value' => '1.8.9-4.2.0-BETA-351', + 'default_value' => '1.10.2-5.1.0-BETA-359', 'user_viewable' => 1, 'user_editable' => 0, 'required' => 1, - 'regex' => '/^(.*)$/' + 'regex' => '/^([a-zA-Z0-9.\-_]+)$/' ]); Models\ServiceVariables::create([ @@ -220,7 +220,7 @@ class MinecraftServiceTableSeeder extends Seeder 'user_viewable' => 1, 'user_editable' => 1, 'required' => 1, - 'regex' => '/^(latest|[\d]{3,5})$/' + 'regex' => '/^(latest|[\d]{1,6})$/' ]); Models\ServiceVariables::create([