Add support for seeding nests and eggs

This commit is contained in:
Dane Everitt 2017-11-03 23:07:18 -05:00
parent 99aceaca38
commit f8c89f8331
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
21 changed files with 862 additions and 18 deletions

View file

@ -69,10 +69,12 @@ class EggShareController extends Controller
*/
public function export(Egg $egg): Response
{
$filename = trim(preg_replace('/[^\w]/', '-', kebab_case($egg->name)), '-');
return response($this->exporterService->handle($egg->id), 200, [
'Content-Transfer-Encoding' => 'binary',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename=egg-' . kebab_case($egg->name) . '.json',
'Content-Disposition' => 'attachment; filename=egg-' . $filename . '.json',
'Content-Type' => 'application/json',
]);
}

View file

@ -75,7 +75,7 @@ class EggImporterService
*/
public function handle(UploadedFile $file, int $nest): Egg
{
if (! $file->isValid() || ! $file->isFile()) {
if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) {
throw new InvalidFileUploadException(trans('exceptions.nest.importer.file_error'));
}

View file

@ -56,7 +56,7 @@ class EggUpdateImporterService
*/
public function handle(int $egg, UploadedFile $file)
{
if (! $file->isValid() || ! $file->isFile()) {
if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) {
throw new InvalidFileUploadException(trans('exceptions.nest.importer.file_error'));
}

View file

@ -1,7 +1,6 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder
{
@ -10,8 +9,7 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
Model::unguard();
Model::reguard();
$this->call(NestSeeder::class);
$this->call(EggSeeder::class);
}
}

View file

@ -0,0 +1,142 @@
<?php
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Collection;
use Illuminate\Filesystem\Filesystem;
use Pterodactyl\Services\Eggs\Sharing\EggImporterService;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService;
class EggSeeder extends Seeder
{
/**
* @var \Illuminate\Filesystem\Filesystem
*/
private $filesystem;
/**
* @var \Pterodactyl\Services\Eggs\Sharing\EggImporterService
*/
private $importerService;
/**
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
private $nestRepository;
/**
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
private $repository;
/**
* @var \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService
*/
private $updateImporterService;
/**
* EggSeeder constructor.
*
* @param \Pterodactyl\Services\Eggs\Sharing\EggImporterService $importerService
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
* @param \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService $updateImporterService
* @param \Illuminate\Filesystem\Filesystem $filesystem
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository
*/
public function __construct(
EggImporterService $importerService,
EggRepositoryInterface $repository,
EggUpdateImporterService $updateImporterService,
Filesystem $filesystem,
NestRepositoryInterface $nestRepository
) {
$this->filesystem = $filesystem;
$this->importerService = $importerService;
$this->repository = $repository;
$this->updateImporterService = $updateImporterService;
$this->nestRepository = $nestRepository;
}
/**
* Run the egg seeder.
*/
public function run()
{
$this->getEggsToImport()->each(function ($nest) {
$this->parseEggFiles($this->findMatchingNest($nest));
});
}
/**
* Return a list of eggs to import.
*
* @return \Illuminate\Support\Collection
*/
protected function getEggsToImport(): Collection
{
return collect([
'Minecraft',
'Source Engine',
'Voice Servers',
]);
}
/**
* Find the nest that these eggs should be attached to.
*
* @param string $nestName
* @return \Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
private function findMatchingNest(string $nestName): Nest
{
return $this->nestRepository->findFirstWhere([
['author', '=', 'support@pterodactyl.io'],
['name', '=', $nestName],
]);
}
/**
* Loop through the list of egg files and import them.
*
* @param \Pterodactyl\Models\Nest $nest
*/
private function parseEggFiles(Nest $nest)
{
$files = $this->filesystem->allFiles(database_path('seeds/eggs/' . kebab_case($nest->name)));
$this->command->alert('Updating Eggs for Nest: ' . $nest->name);
collect($files)->each(function ($file) use ($nest) {
/* @var \Symfony\Component\Finder\SplFileInfo $file */
$decoded = json_decode($file->getContents());
if (json_last_error() !== JSON_ERROR_NONE) {
return $this->command->error('JSON decode exception for ' . $file->getFilename() . ': ' . json_last_error_msg());
}
$file = new UploadedFile($file->getPathname(), $file->getFilename(), 'application/json', $file->getSize());
try {
$egg = $this->repository->withColumns('id')->findFirstWhere([
['author', '=', $decoded->author],
['name', '=', $decoded->name],
['nest_id', '=', $nest->id],
]);
$this->updateImporterService->handle($egg->id, $file);
return $this->command->info('Updated ' . $decoded->name);
} catch (RecordNotFoundException $exception) {
$this->importerService->handle($file, $nest->id);
return $this->command->comment('Created ' . $decoded->name);
}
});
$this->command->line('');
}
}

View file

@ -0,0 +1,99 @@
<?php
use Illuminate\Database\Seeder;
use Pterodactyl\Services\Nests\NestCreationService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
class NestSeeder extends Seeder
{
/**
* @var \Pterodactyl\Services\Nests\NestCreationService
*/
private $creationService;
/**
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
private $repository;
/**
* MinecraftNestSeeder constructor.
*
* @param \Pterodactyl\Services\Nests\NestCreationService $creationService
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
*/
public function __construct(
NestCreationService $creationService,
NestRepositoryInterface $repository
) {
$this->creationService = $creationService;
$this->repository = $repository;
}
/**
* Run the seeder to add missing nests to the Panel.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function run()
{
$items = $this->repository->findWhere([
'author' => 'support@pterodactyl.io',
])->keyBy('name')->toArray();
$this->createMinecraftNest(array_get($items, 'Minecraft'));
$this->createSourceEngineNest(array_get($items, 'Source Engine'));
$this->createVoiceServersNest(array_get($items, 'Voice Servers'));
}
/**
* Create the Minecraft nest to be used later on.
*
* @param array|null $nest
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
private function createMinecraftNest(array $nest = null)
{
if (is_null($nest)) {
$this->creationService->handle([
'name' => 'Minecraft',
'description' => 'Minecraft - the classic game from Mojang. With support for Vanilla MC, Spigot, and many others!',
]);
}
}
/**
* Create the Source Engine Games nest to be used later on.
*
* @param array|null $nest
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
private function createSourceEngineNest(array $nest = null)
{
if (is_null($nest)) {
$this->creationService->handle([
'name' => 'Source Engine',
'description' => 'Includes support for most Source Dedicated Server games.',
]);
}
}
/**
* Create the Source Engine Games nest to be used later on.
*
* @param array|null $nest
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
private function createVoiceServersNest(array $nest = null)
{
if (is_null($nest)) {
$this->creationService->handle([
'name' => 'Voice Servers',
'description' => 'Voice servers such as Mumble and Teamspeak 3.',
]);
}
}
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:15:10-05:00",
"name": "Bungeecord",
"author": "support@pterodactyl.io",
"description": "For a long time, Minecraft server owners have had a dream that encompasses a free, easy, and reliable way to connect multiple Minecraft servers together. BungeeCord is the answer to said dream. Whether you are a small server wishing to string multiple game-modes together, or the owner of the ShotBow Network, BungeeCord is the ideal solution for you. With the help of BungeeCord, you will be able to unlock your community's full potential.",
"image": "quay.io\/pterodactyl\/core:java",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
"config": {
"files": "{\r\n \"config.yml\": {\r\n \"parser\": \"yaml\",\r\n \"find\": {\r\n \"listeners[0].query_enabled\": true,\r\n \"listeners[0].query_port\": \"{{server.build.default.port}}\",\r\n \"listeners[0].host\": \"0.0.0.0:{{server.build.default.port}}\",\r\n \"servers.*.address\": {\r\n \"127.0.0.1\": \"{{config.docker.interface}}\",\r\n \"localhost\": \"{{config.docker.interface}}\"\r\n }\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"Listening on \",\r\n \"userInteraction\": [\r\n \"Listening on \/0.0.0.0:25577\"\r\n ]\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"proxy.log.0\"\r\n}",
"stop": "end"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\n# Bungeecord Installation Script\n#\n# Server Files: \/mnt\/server\napk update\napk add curl\n\ncd \/mnt\/server\n\nif [ -z \"${BUNGEE_VERSION}\" ] || [ \"${BUNGEE_VERSION}\" == \"latest\" ]; then\n BUNGEE_VERSION=\"lastStableBuild\"\nfi\n\ncurl -o ${SERVER_JARFILE} https:\/\/ci.md-5.net\/job\/BungeeCord\/${BUNGEE_VERSION}\/artifact\/bootstrap\/target\/BungeeCord.jar",
"container": "alpine:3.4",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Bungeecord Version",
"description": "The version of Bungeecord to download and use.",
"env_variable": "BUNGEE_VERSION",
"default_value": "latest",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|alpha_num|between:1,6"
},
{
"name": "Bungeecord Jar File",
"description": "The name of the Jarfile to use when running Bungeecord.",
"env_variable": "SERVER_JARFILE",
"default_value": "bungeecord.jar",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/"
}
]
}

View file

@ -0,0 +1,36 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:15:10-05:00",
"name": "Forge Minecraft",
"author": "support@pterodactyl.io",
"description": "Minecraft Forge Server. Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other.",
"image": "quay.io\/pterodactyl\/core:java",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
"config": {
"files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"enable-query\": \"true\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \")! For help, type \",\r\n \"userInteraction\": [\r\n \"Go to eula.txt for more info.\"\r\n ]\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}",
"stop": "stop"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\n# Forge Installation Script\n#\n# Server Files: \/mnt\/server\napk update\napk add curl\n\nGET_VERSIONS=$(curl -sl http:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/ | grep -A1 Latest | grep -o -e '[1]\\.[0-9][0-9] - [0-9][0-9]\\.[0-9][0-9]\\.[0-9]\\.[0-9][0-9][0-9][0-9]')\nLATEST_VERSION=$(echo $GET_VERSIONS | sed 's\/ \/\/g')\n\ncd \/mnt\/server\n\ncurl -sS http:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/$LATEST_VERSION\/forge-$LATEST_VERSION-installer.jar -o installer.jar\ncurl -sS http:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/$LATEST_VERSION\/forge-$LATEST_VERSION-universal.jar -o server.jar\n\njava -jar installer.jar --installServer\nrm -rf installer.jar",
"container": "frolvlad\/alpine-oraclejdk8:cleaned",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Server Jar File",
"description": "The name of the Jarfile to use when running Forge Mod.",
"env_variable": "SERVER_JARFILE",
"default_value": "server.jar",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/"
}
]
}

View file

@ -0,0 +1,54 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:15:08-05:00",
"name": "Spigot",
"author": "support@pterodactyl.io",
"description": "Spigot is the most widely-used modded Minecraft server software in the world. It powers many of the top Minecraft server networks around to ensure they can cope with their huge player base and ensure the satisfaction of their players. Spigot works by reducing and eliminating many causes of lag, as well as adding in handy features and settings that help make your job of server administration easier.",
"image": "quay.io\/pterodactyl\/core:java-glibc",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
"config": {
"files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"enable-query\": \"true\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \")! For help, type \",\r\n \"userInteraction\": [\r\n \"Go to eula.txt for more info.\"\r\n ]\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}",
"stop": "stop"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\n# Spigot Installation Script\n#\n# Server Files: \/mnt\/server\n\n## Only download if a path is provided, otherwise continue.\nif [ ! -z \"${DL_PATH}\" ]; then\n apk update\n apk add curl\n\n cd \/mnt\/server\n\n MODIFIED_DOWNLOAD=`eval echo $(echo ${DL_PATH} | sed -e 's\/{{\/${\/g' -e 's\/}}\/}\/g')`\n curl -sSL -o ${SERVER_JARFILE} ${MODIFIED_DOWNLOAD}\nfi",
"container": "alpine:3.4",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Server Jar File",
"description": "The name of the server jarfile to run the server with.",
"env_variable": "SERVER_JARFILE",
"default_value": "server.jar",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/"
},
{
"name": "Spigot Version",
"description": "The version of Spigot to download (using the --rev tag). Use \"latest\" for latest.",
"env_variable": "DL_VERSION",
"default_value": "latest",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|between:3,7"
},
{
"name": "Download Path",
"description": "A URL to use to download Spigot rather than building it on the server. This is not user viewable. Use <code>{{DL_VERSION}}<\/code> in the URL to automatically insert the assigned version into the URL. If you do not enter a URL Spigot will build directly in the container (this will fail on low memory containers).",
"env_variable": "DL_PATH",
"default_value": "",
"user_viewable": 0,
"user_editable": 0,
"rules": "string"
}
]
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:20:03-05:00",
"name": "Sponge (SpongeVanilla)",
"author": "support@pterodactyl.io",
"description": "SpongeVanilla is the SpongeAPI implementation for Vanilla Minecraft.",
"image": "quay.io\/pterodactyl\/core:java-glibc",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
"config": {
"files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"enable-query\": \"true\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \")! For help, type \",\r\n \"userInteraction\": [\r\n \"Go to eula.txt for more info.\"\r\n ]\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}",
"stop": "stop"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\n# Sponge Installation Script\n#\n# Server Files: \/mnt\/server\n\napk update\napk add curl\n\ncd \/mnt\/server\n\ncurl -sSL \"https:\/\/repo.spongepowered.org\/maven\/org\/spongepowered\/spongevanilla\/${SPONGE_VERSION}\/spongevanilla-${SPONGE_VERSION}.jar\" -o ${SERVER_JARFILE}",
"container": "alpine:3.4",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Sponge Version",
"description": "The version of SpongeVanilla to download and use.",
"env_variable": "SPONGE_VERSION",
"default_value": "1.11.2-6.1.0-BETA-21",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|regex:\/^([a-zA-Z0-9.\\-_]+)$\/"
},
{
"name": "Server Jar File",
"description": "The name of the Jarfile to use when running SpongeVanilla.",
"env_variable": "SERVER_JARFILE",
"default_value": "server.jar",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/"
}
]
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:15:07-05:00",
"name": "Vanilla Minecraft",
"author": "support@pterodactyl.io",
"description": "Minecraft is a game about placing blocks and going on adventures. Explore randomly generated worlds and build amazing things from the simplest of homes to the grandest of castles. Play in Creative Mode with unlimited resources or mine deep in Survival Mode, crafting weapons and armor to fend off dangerous mobs. Do all this alone or with friends.",
"image": "quay.io\/pterodactyl\/core:java",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
"config": {
"files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"enable-query\": \"true\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \")! For help, type \",\r\n \"userInteraction\": [\r\n \"Go to eula.txt for more info.\"\r\n ]\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}",
"stop": "stop"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\r\n# Vanilla MC Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napk update\r\napk add curl\r\n\r\ncd \/mnt\/server\r\n\r\nLATEST_VERSION=`curl -s https:\/\/s3.amazonaws.com\/Minecraft.Download\/versions\/versions.json | grep -o \"[[:digit:]]\\.[0-9]*\\.[0-9]\" | head -n 1`\r\n\r\nif [ -z \"$VANILLA_VERSION\" ] || [ \"$VANILLA_VERSION\" == \"latest\" ]; then\r\n DL_VERSION=$LATEST_VERSION\r\nelse\r\n DL_VERSION=$VANILLA_VERSION\r\nfi\r\n\r\ncurl -o ${SERVER_JARFILE} https:\/\/s3.amazonaws.com\/Minecraft.Download\/versions\/${DL_VERSION}\/minecraft_server.${DL_VERSION}.jar",
"container": "alpine:3.4",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Server Jar File",
"description": "The name of the server jarfile to run the server with.",
"env_variable": "SERVER_JARFILE",
"default_value": "server.jar",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/"
},
{
"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,
"rules": "required|string|between:3,7"
}
]
}

View file

@ -0,0 +1,54 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:29:34-05:00",
"name": "Ark: Survival Evolved",
"author": "support@pterodactyl.io",
"description": "As a man or woman stranded, naked, freezing, and starving on the unforgiving shores of a mysterious island called ARK, use your skill and cunning to kill or tame and ride the plethora of leviathan dinosaurs and other primeval creatures roaming the land. Hunt, harvest resources, craft items, grow crops, research technologies, and build shelters to withstand the elements and store valuables, all while teaming up with (or preying upon) hundreds of other players to survive, dominate... and escape! \u2014 Gamepedia: ARK",
"image": "quay.io\/pterodactyl\/core:source",
"startup": ".\/ShooterGame\/Binaries\/Linux\/ShooterGameServer TheIsland?listen?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?MaxPlayers={{SERVER_MAX_PLAYERS}}",
"config": {
"files": "{}",
"startup": "{\"done\": \"gameserver Steam ID\", \"userInteraction\": []}",
"logs": "{\"custom\": true, \"location\": \"logs\/latest.log\"}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\n# ARK: Installation Script\n#\n# Server Files: \/mnt\/server\napt -y update\napt -y --no-install-recommends install curl lib32gcc1 ca-certificates\n\ncd \/tmp\ncurl -sSL -o steamcmd.tar.gz http:\/\/media.steampowered.com\/installer\/steamcmd_linux.tar.gz\n\nmkdir -p \/mnt\/server\/steamcmd\nmkdir -p \/mnt\/server\/Engine\/Binaries\/ThirdParty\/SteamCMD\/Linux\n\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/Engine\/Binaries\/ThirdParty\/SteamCMD\/Linux\n\ncd \/mnt\/server\/steamcmd\n\n# SteamCMD fails otherwise for some reason, even running as root.\n# This is changed at the end of the install process anyways.\nchown -R root:root \/mnt\n\nexport HOME=\/mnt\/server\n.\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update 376030 +quit\n\nmkdir -p \/mnt\/server\/.steam\/sdk32\ncp -v linux32\/steamclient.so ..\/.steam\/sdk32\/steamclient.so",
"container": "ubuntu:16.04",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Server Password",
"description": "If specified, players must provide this password to join the server.",
"env_variable": "ARK_PASSWORD",
"default_value": "",
"user_viewable": 1,
"user_editable": 1,
"rules": "alpha_dash|between:1,100"
},
{
"name": "Admin Password",
"description": "If specified, players must provide this password (via the in-game console) to gain access to administrator commands on the server.",
"env_variable": "ARK_ADMIN_PASSWORD",
"default_value": "",
"user_viewable": 1,
"user_editable": 1,
"rules": "alpha_dash|between:1,100"
},
{
"name": "Maximum Players",
"description": "Specifies the maximum number of players that can play on the server simultaneously.",
"env_variable": "SERVER_MAX_PLAYERS",
"default_value": "20",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|numeric|digits_between:1,4"
}
]
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:29:36-05:00",
"name": "Counter-Strike: Global Offensive",
"author": "support@pterodactyl.io",
"description": "Counter-Strike: Global Offensive is a multiplayer first-person shooter video game developed by Hidden Path Entertainment and Valve Corporation.",
"image": "quay.io\/pterodactyl\/core:source",
"startup": ".\/srcds_run -game csgo -console -port {{SERVER_PORT}} +ip 0.0.0.0 +map {{SRCDS_MAP}} -strictportbind -norestart +sv_setsteamaccount {{STEAM_ACC}}",
"config": {
"files": "{}",
"startup": "{\"done\": \"gameserver Steam ID\", \"userInteraction\": []}",
"logs": "{\"custom\": true, \"location\": \"logs\/latest.log\"}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\n# CSGO Installation Script\n#\n# Server Files: \/mnt\/server\napt -y update\napt -y --no-install-recommends install curl lib32gcc1 ca-certificates\n\ncd \/tmp\ncurl -sSL -o steamcmd.tar.gz http:\/\/media.steampowered.com\/installer\/steamcmd_linux.tar.gz\n\nmkdir -p \/mnt\/server\/steamcmd\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\ncd \/mnt\/server\/steamcmd\n\n# SteamCMD fails otherwise for some reason, even running as root.\n# This is changed at the end of the install process anyways.\nchown -R root:root \/mnt\n\nexport HOME=\/mnt\/server\n.\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update 740 +quit\n\nmkdir -p \/mnt\/server\/.steam\/sdk32\ncp -v linux32\/steamclient.so ..\/.steam\/sdk32\/steamclient.so",
"container": "ubuntu:16.04",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Map",
"description": "The default map for the server.",
"env_variable": "SRCDS_MAP",
"default_value": "de_dust2",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|alpha_dash"
},
{
"name": "Steam Account Token",
"description": "The Steam Account Token required for the server to be displayed publicly.",
"env_variable": "STEAM_ACC",
"default_value": "",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|alpha_num|size:32"
}
]
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:30:06-05:00",
"name": "Custom Source Engine Game",
"author": "support@pterodactyl.io",
"description": "This option allows modifying the startup arguments and other details to run a custo SRCDS based game on the panel.",
"image": "quay.io\/pterodactyl\/core:source",
"startup": ".\/srcds_run -game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} +ip 0.0.0.0 -strictportbind -norestart",
"config": {
"files": "{}",
"startup": "{\r\n \"done\": \"gameserver Steam ID\",\r\n \"userInteraction\": []\r\n}",
"logs": "{\r\n \"custom\": true,\r\n \"location\": \"logs\/latest.log\"\r\n}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\n# SRCDS Base Installation Script\n#\n# Server Files: \/mnt\/server\napt -y update\napt -y --no-install-recommends install curl lib32gcc1 ca-certificates\n\ncd \/tmp\ncurl -sSL -o steamcmd.tar.gz http:\/\/media.steampowered.com\/installer\/steamcmd_linux.tar.gz\n\nmkdir -p \/mnt\/server\/steamcmd\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\ncd \/mnt\/server\/steamcmd\n\n# SteamCMD fails otherwise for some reason, even running as root.\n# This is changed at the end of the install process anyways.\nchown -R root:root \/mnt\n\nexport HOME=\/mnt\/server\n.\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update ${SRCDS_APPID} +quit\n\nmkdir -p \/mnt\/server\/.steam\/sdk32\ncp -v linux32\/steamclient.so ..\/.steam\/sdk32\/steamclient.so",
"container": "ubuntu:16.04",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Game ID",
"description": "The ID corresponding to the game to download and run using SRCDS.",
"env_variable": "SRCDS_APPID",
"default_value": "",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|numeric|digits_between:1,6"
},
{
"name": "Game Name",
"description": "The name corresponding to the game to download and run using SRCDS.",
"env_variable": "SRCDS_GAME",
"default_value": "",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|alpha_dash|between:1,100"
}
]
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:29:37-05:00",
"name": "Garrys Mod",
"author": "support@pterodactyl.io",
"description": "Garrys Mod, is a sandbox physics game created by Garry Newman, and developed by his company, Facepunch Studios.",
"image": "quay.io\/pterodactyl\/core:source",
"startup": ".\/srcds_run -game garrysmod -console -port {{SERVER_PORT}} +ip 0.0.0.0 +map {{SRCDS_MAP}} -strictportbind -norestart +sv_setsteamaccount {{STEAM_ACC}}",
"config": {
"files": "{}",
"startup": "{\"done\": \"gameserver Steam ID\", \"userInteraction\": []}",
"logs": "{\"custom\": true, \"location\": \"logs\/latest.log\"}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\n# Garry's Mod Installation Script\n#\n# Server Files: \/mnt\/server\napt -y update\napt -y --no-install-recommends install curl lib32gcc1 ca-certificates\n\ncd \/tmp\ncurl -sSL -o steamcmd.tar.gz http:\/\/media.steampowered.com\/installer\/steamcmd_linux.tar.gz\n\nmkdir -p \/mnt\/server\/steamcmd\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\ncd \/mnt\/server\/steamcmd\n\n# SteamCMD fails otherwise for some reason, even running as root.\n# This is changed at the end of the install process anyways.\nchown -R root:root \/mnt\n\nexport HOME=\/mnt\/server\n.\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update 4020 +quit\n\nmkdir -p \/mnt\/server\/.steam\/sdk32\ncp -v linux32\/steamclient.so ..\/.steam\/sdk32\/steamclient.so",
"container": "ubuntu:16.04",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Map",
"description": "The default map for the server.",
"env_variable": "SRCDS_MAP",
"default_value": "gm_flatgrass",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|alpha_dash"
},
{
"name": "Steam Account Token",
"description": "The Steam Account Token required for the server to be displayed publicly.",
"env_variable": "STEAM_ACC",
"default_value": "",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|alpha_num|size:32"
}
]
}

View file

@ -0,0 +1,54 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:29:33-05:00",
"name": "Insurgency",
"author": "support@pterodactyl.io",
"description": "Take to the streets for intense close quarters combat, where a team's survival depends upon securing crucial strongholds and destroying enemy supply in this multiplayer and cooperative Source Engine based experience.",
"image": "quay.io\/pterodactyl\/core:source",
"startup": ".\/srcds_run -game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} +ip 0.0.0.0 -strictportbind -norestart",
"config": {
"files": "{}",
"startup": "{\"done\": \"gameserver Steam ID\", \"userInteraction\": []}",
"logs": "{\"custom\": true, \"location\": \"logs\/latest.log\"}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\n# SRCDS Base Installation Script\n#\n# Server Files: \/mnt\/server\napt -y update\napt -y --no-install-recommends install curl lib32gcc1 ca-certificates\n\ncd \/tmp\ncurl -sSL -o steamcmd.tar.gz http:\/\/media.steampowered.com\/installer\/steamcmd_linux.tar.gz\n\nmkdir -p \/mnt\/server\/steamcmd\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\ncd \/mnt\/server\/steamcmd\n\n# SteamCMD fails otherwise for some reason, even running as root.\n# This is changed at the end of the install process anyways.\nchown -R root:root \/mnt\n\nexport HOME=\/mnt\/server\n.\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update ${SRCDS_APPID} +quit\n\nmkdir -p \/mnt\/server\/.steam\/sdk32\ncp -v linux32\/steamclient.so ..\/.steam\/sdk32\/steamclient.so",
"container": "ubuntu:16.04",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Game ID",
"description": "The ID corresponding to the game to download and run using SRCDS.",
"env_variable": "SRCDS_APPID",
"default_value": "17705",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|regex:\/^(17705)$\/"
},
{
"name": "Game Name",
"description": "The name corresponding to the game to download and run using SRCDS.",
"env_variable": "SRCDS_GAME",
"default_value": "insurgency",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|regex:\/^(insurgency)$\/"
},
{
"name": "Default Map",
"description": "The default map to use when starting the server.",
"env_variable": "SRCDS_MAP",
"default_value": "sinjar",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^(\\w{1,20})$\/"
}
]
}

View file

@ -0,0 +1,54 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:29:33-05:00",
"name": "Team Fortress 2",
"author": "support@pterodactyl.io",
"description": "Team Fortress 2 is a team-based first-person shooter multiplayer video game developed and published by Valve Corporation. It is the sequel to the 1996 mod Team Fortress for Quake and its 1999 remake.",
"image": "quay.io\/pterodactyl\/core:source",
"startup": ".\/srcds_run -game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} +ip 0.0.0.0 -strictportbind -norestart",
"config": {
"files": "{}",
"startup": "{\"done\": \"gameserver Steam ID\", \"userInteraction\": []}",
"logs": "{\"custom\": true, \"location\": \"logs\/latest.log\"}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\n# SRCDS Base Installation Script\n#\n# Server Files: \/mnt\/server\napt -y update\napt -y --no-install-recommends install curl lib32gcc1 ca-certificates\n\ncd \/tmp\ncurl -sSL -o steamcmd.tar.gz http:\/\/media.steampowered.com\/installer\/steamcmd_linux.tar.gz\n\nmkdir -p \/mnt\/server\/steamcmd\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\ncd \/mnt\/server\/steamcmd\n\n# SteamCMD fails otherwise for some reason, even running as root.\n# This is changed at the end of the install process anyways.\nchown -R root:root \/mnt\n\nexport HOME=\/mnt\/server\n.\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update ${SRCDS_APPID} +quit\n\nmkdir -p \/mnt\/server\/.steam\/sdk32\ncp -v linux32\/steamclient.so ..\/.steam\/sdk32\/steamclient.so",
"container": "ubuntu:16.04",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Game ID",
"description": "The ID corresponding to the game to download and run using SRCDS.",
"env_variable": "SRCDS_APPID",
"default_value": "232250",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|regex:\/^(232250)$\/"
},
{
"name": "Game Name",
"description": "The name corresponding to the game to download and run using SRCDS.",
"env_variable": "SRCDS_GAME",
"default_value": "tf",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|regex:\/^(tf)$\/"
},
{
"name": "Default Map",
"description": "The default map to use when starting the server.",
"env_variable": "SRCDS_MAP",
"default_value": "cp_dustbowl",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^(\\w{1,20})$\/"
}
]
}

View file

@ -0,0 +1,45 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:53:04-05:00",
"name": "Mumble Server",
"author": "support@pterodactyl.io",
"description": "Mumble is an open source, low-latency, high quality voice chat software primarily intended for use while gaming.",
"image": "quay.io\/pterodactyl\/core:glibc",
"startup": ".\/murmur.x86 -fg",
"config": {
"files": "{\"murmur.ini\":{\"parser\": \"ini\", \"find\":{\"logfile\": \"murmur.log\", \"port\": \"{{server.build.default.port}}\", \"host\": \"0.0.0.0\", \"users\": \"{{server.build.env.MAX_USERS}}\"}}}",
"startup": "{\"done\": \"Server listening on\", \"userInteraction\": [ \"Generating new server certificate\"]}",
"logs": "{\"custom\": true, \"location\": \"logs\/murmur.log\"}",
"stop": "^C"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\n# Mumble Installation Script\n#\n# Server Files: \/mnt\/server\napk update\napk add tar curl\n\ncd \/tmp\n\ncurl -sSLO https:\/\/github.com\/mumble-voip\/mumble\/releases\/download\/${MUMBLE_VERSION}\/murmur-static_x86-${MUMBLE_VERSION}.tar.bz2\n\ntar -xjvf murmur-static_x86-${MUMBLE_VERSION}.tar.bz2\ncp -r murmur-static_x86-${MUMBLE_VERSION}\/* \/mnt\/server",
"container": "alpine:3.4",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Maximum Users",
"description": "Maximum concurrent users on the mumble server.",
"env_variable": "MAX_USERS",
"default_value": "100",
"user_viewable": 1,
"user_editable": 0,
"rules": "required|numeric|digits_between:1,5"
},
{
"name": "Server Version",
"description": "Version of Mumble Server to download and use.",
"env_variable": "MUMBLE_VERSION",
"default_value": "1.2.19",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([0-9_\\.-]{5,8})$\/"
}
]
}

View file

@ -0,0 +1,36 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2017-11-03T22:53:05-05:00",
"name": "Teamspeak3 Server",
"author": "support@pterodactyl.io",
"description": "VoIP software designed with security in mind, featuring crystal clear voice quality, endless customization options, and scalabilty up to thousands of simultaneous users.",
"image": "quay.io\/pterodactyl\/core:glibc",
"startup": ".\/ts3server_minimal_runscript.sh default_voice_port={{SERVER_PORT}} query_port={{SERVER_PORT}}",
"config": {
"files": "{\"ts3server.ini\":{\"parser\": \"ini\", \"find\":{\"default_voice_port\": \"{{server.build.default.port}}\", \"voice_ip\": \"0.0.0.0\", \"query_port\": \"{{server.build.default.port}}\", \"query_ip\": \"0.0.0.0\"}}}",
"startup": "{\"done\": \"listening on 0.0.0.0:\", \"userInteraction\": []}",
"logs": "{\"custom\": true, \"location\": \"logs\/ts3.log\"}",
"stop": "^C"
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\n# TS3 Installation Script\n#\n# Server Files: \/mnt\/server\napk update\napk add tar curl\n\ncd \/tmp\n\ncurl -sSLO http:\/\/dl.4players.de\/ts\/releases\/${TS_VERSION}\/teamspeak3-server_linux_amd64-${TS_VERSION}.tar.bz2\n\ntar -xjvf teamspeak3-server_linux_amd64-${TS_VERSION}.tar.bz2\ncp -r teamspeak3-server_linux_amd64\/* \/mnt\/server\n\necho \"machine_id=\ndefault_voice_port=${SERVER_PORT}\nvoice_ip=0.0.0.0\nlicensepath=\nfiletransfer_port=30033\nfiletransfer_ip=\nquery_port=${SERVER_PORT}\nquery_ip=0.0.0.0\nquery_ip_whitelist=query_ip_whitelist.txt\nquery_ip_blacklist=query_ip_blacklist.txt\ndbplugin=ts3db_sqlite3\ndbpluginparameter=\ndbsqlpath=sql\/\ndbsqlcreatepath=create_sqlite\/\ndbconnections=10\nlogpath=logs\nlogquerycommands=0\ndbclientkeepdays=30\nlogappend=0\nquery_skipbruteforcecheck=0\" > \/mnt\/server\/ts3server.ini",
"container": "alpine:3.4",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Server Version",
"description": "The version of Teamspeak 3 to use when running the server.",
"env_variable": "TS_VERSION",
"default_value": "3.0.13.8",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|regex:\/^([0-9_\\.-]{5,10})$\/"
}
]
}

View file

@ -85,7 +85,7 @@ class EggImporterServiceTest extends TestCase
$egg = factory(Egg::class)->make();
$nest = factory(Nest::class)->make();
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn(json_encode([
@ -122,7 +122,7 @@ class EggImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfFileIsInvalid()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(false);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_NO_FILE);
try {
$this->service->handle($this->file, 1234);
} catch (PterodactylException $exception) {
@ -136,7 +136,7 @@ class EggImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfFileIsNotAFile()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(false);
try {
@ -152,7 +152,7 @@ class EggImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfJsonMetaDataIsInvalid()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn(json_encode([
@ -172,7 +172,7 @@ class EggImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfBadJsonIsProvided()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn('}');

View file

@ -65,7 +65,7 @@ class EggUpdateImporterServiceTest extends TestCase
$egg = factory(Egg::class)->make();
$variable = factory(EggVariable::class)->make();
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn(json_encode([
@ -105,7 +105,7 @@ class EggUpdateImporterServiceTest extends TestCase
$variable1 = factory(EggVariable::class)->make();
$variable2 = factory(EggVariable::class)->make();
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn(json_encode([
@ -145,7 +145,7 @@ class EggUpdateImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfFileIsInvalid()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(false);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_NO_FILE);
try {
$this->service->handle(1234, $this->file);
} catch (PterodactylException $exception) {
@ -159,7 +159,7 @@ class EggUpdateImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfFileIsNotAFile()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(false);
try {
@ -175,7 +175,7 @@ class EggUpdateImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfJsonMetaDataIsInvalid()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn(json_encode([
@ -195,7 +195,7 @@ class EggUpdateImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfBadJsonIsProvided()
{
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getError')->withNoArgs()->once()->andReturn(UPLOAD_ERR_OK);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(100);
$this->file->shouldReceive('openFile->fread')->with(100)->once()->andReturn('}');