Skip to content

Commit 777e713

Browse files
committed
Update regex checking for minecraft services
closes pterodactyl#193
1 parent e39c750 commit 777e713

File tree

3 files changed

+88
-7
lines changed

3 files changed

+88
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1212
### Changed
1313
* File uploads now account for a maximum file size that is assigned for the daemon, and gives cleaner errors when that limit is reached.
1414
* File upload limit can now be controlled from the panel.
15+
* Updates regex and default values for some Minecraft services to reflect current technology.
1516

1617
### Fixed
1718
* Fixes potential for generated password to not meet own validation requirements.
19+
* Fixes some regex checking issues with newer versions of Minecraft.
1820

1921
## v0.5.3 (Bodacious Boreopterus)
2022
### Fixed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CorrectServiceVariables extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
DB::transaction(function () {
17+
// Modify Default Spigot Startup Line
18+
DB::table('service_options')->where([
19+
['name', 'Spigot'],
20+
['tag', 'spigot'],
21+
['startup', '-Xms128M -Xmx{{SERVER_MEMORY}}M -Djline.terminal=jline.UnsupportedTerminal -jar {{SERVER_JARFILE}}'],
22+
])->update([
23+
'startup' => null,
24+
]);
25+
26+
// Correct Spigot Version Checking
27+
DB::table('service_variables')->where([
28+
['name', 'Spigot Version'],
29+
['env_variable', 'DL_VERSION'],
30+
['default_value', 'latest'],
31+
['regex', '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/'],
32+
])->update([
33+
'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/',
34+
]);
35+
36+
// Correct Vanilla Version Checking (as well as naming)
37+
DB::table('service_variables')->where([
38+
['name', 'Server Jar File'],
39+
['env_variable', 'VANILLA_VERSION'],
40+
['default_value', 'latest'],
41+
['regex', '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/']
42+
])->update([
43+
'name' => 'Server Version',
44+
'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/',
45+
]);
46+
47+
// Update Sponge Version Checking and Update Default Version
48+
DB::table('service_variables')->where([
49+
['name', 'Sponge Version'],
50+
['env_variable', 'SPONGE_VERSION'],
51+
['default_value', '1.8.9-4.2.0-BETA-351'],
52+
['regex', '/^(.*)$/'],
53+
])->update([
54+
'default_value' => '1.10.2-5.1.0-BETA-359',
55+
'regex' => '/^([a-zA-Z0-9.\-_]+)$/',
56+
]);
57+
58+
// Update Bungeecord Version Checking
59+
DB::table('service_variables')->where([
60+
['name', 'Bungeecord Version'],
61+
['env_variable', 'BUNGEE_VERSION'],
62+
['default_value', 'latest'],
63+
['regex', '/^(latest|[\d]{3,5})$/'],
64+
])->update([
65+
'regex' => '/^(latest|[\d]{1,6})$/',
66+
]);
67+
});
68+
}
69+
70+
/**
71+
* Reverse the migrations.
72+
*
73+
* @return void
74+
*/
75+
public function down()
76+
{
77+
// do nothing
78+
}
79+
}

database/seeds/MinecraftServiceTableSeeder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private function addCoreOptions()
8484
'tag' => 'spigot',
8585
'docker_image' => 'quay.io/pterodactyl/minecraft:spigot',
8686
'executable' => null,
87-
'startup' => '-Xms128M -Xmx{{SERVER_MEMORY}}M -Djline.terminal=jline.UnsupportedTerminal -jar {{SERVER_JARFILE}}'
87+
'startup' => '-Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}'
8888
]);
8989

9090
$this->option['sponge'] = Models\ServiceOptions::create([
@@ -132,14 +132,14 @@ private function addVanillaVariables()
132132

133133
Models\ServiceVariables::create([
134134
'option_id' => $this->option['vanilla']->id,
135-
'name' => 'Server Jar File',
135+
'name' => 'Server Version',
136136
'description' => 'The version of Minecraft Vanilla to install. Use "latest" to install the latest version.',
137137
'env_variable' => 'VANILLA_VERSION',
138138
'default_value' => 'latest',
139139
'user_viewable' => 1,
140140
'user_editable' => 1,
141141
'required' => 1,
142-
'regex' => '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/'
142+
'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/'
143143
]);
144144
}
145145

@@ -166,7 +166,7 @@ private function addSpigotVariables()
166166
'user_viewable' => 1,
167167
'user_editable' => 1,
168168
'required' => 1,
169-
'regex' => '/^(latest|[a-zA-Z0-9_\.-]{5,6})$/'
169+
'regex' => '/^(latest|[a-zA-Z0-9_\.-]{3,7})$/'
170170
]);
171171

172172
Models\ServiceVariables::create([
@@ -189,11 +189,11 @@ private function addSpongeVariables()
189189
'name' => 'Sponge Version',
190190
'description' => 'The version of SpongeVanilla to download and use.',
191191
'env_variable' => 'SPONGE_VERSION',
192-
'default_value' => '1.8.9-4.2.0-BETA-351',
192+
'default_value' => '1.10.2-5.1.0-BETA-359',
193193
'user_viewable' => 1,
194194
'user_editable' => 0,
195195
'required' => 1,
196-
'regex' => '/^(.*)$/'
196+
'regex' => '/^([a-zA-Z0-9.\-_]+)$/'
197197
]);
198198

199199
Models\ServiceVariables::create([
@@ -220,7 +220,7 @@ private function addBungeecordVariables()
220220
'user_viewable' => 1,
221221
'user_editable' => 1,
222222
'required' => 1,
223-
'regex' => '/^(latest|[\d]{3,5})$/'
223+
'regex' => '/^(latest|[\d]{1,6})$/'
224224
]);
225225

226226
Models\ServiceVariables::create([

0 commit comments

Comments
 (0)