diff --git a/CHANGELOG.md b/CHANGELOG.md index 32214a317..979dd26ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Fixed * Scheduled tasks triggered manually no longer improperly change the `next_run_at` time and do not run twice in a row anymore. * Changing the maximum web-based file upload size for a node now properly validates and updates. +* Changing configuration values for a node now correctly updates them on the daemon on the first request, rather than requiring a second request to set them. ### Changed * Egg and server variable values are no longer limited to 191 characters. Turns out some games require a large number of characters in these fields. diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index e9f679006..99be100ee 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -124,7 +124,7 @@ class NodeController extends ApplicationApiController */ public function update(UpdateNodeRequest $request): array { - $node = $this->updateService->returnUpdatedModel()->handle( + $node = $this->updateService->handle( $request->getModel(Node::class), $request->validated() ); diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index ef9349a71..aaf0faed4 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -13,7 +13,6 @@ use Pterodactyl\Models\Node; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use Illuminate\Database\ConnectionInterface; -use Pterodactyl\Traits\Services\ReturnsUpdatedModels; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException; @@ -21,8 +20,6 @@ use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface; class NodeUpdateService { - use ReturnsUpdatedModels; - /** * @var \Illuminate\Database\ConnectionInterface */ @@ -74,14 +71,10 @@ class NodeUpdateService } $this->connection->beginTransaction(); - if ($this->getUpdatedModel()) { - $response = $this->repository->update($node->id, $data); - } else { - $response = $this->repository->withoutFreshModel()->update($node->id, $data); - } + $updatedModel = $this->repository->update($node->id, $data); try { - $this->configRepository->setNode($node)->update(); + $this->configRepository->setNode($updatedModel)->update(); $this->connection->commit(); } catch (RequestException $exception) { // Failed to connect to the Daemon. Let's go ahead and save the configuration @@ -95,6 +88,6 @@ class NodeUpdateService throw new DaemonConnectionException($exception); } - return $response; + return $updatedModel; } }