repository = $repository; $this->nodeRepository = $nodeRepository; $this->daemonTransferRepository = $daemonTransferRepository; } /** * The daemon notifies us about the archive status. * * @param \Illuminate\Http\Request $request * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function archive(Request $request, Server $server) { // Unsuspend the server and don't continue the transfer. if (!$request->input('successful')) { // $this->suspensionService->toggle($server, 'unsuspend'); return JsonResponse::create([], Response::HTTP_NO_CONTENT); } $now = Chronos::now(); $signer = new Sha256; $token = (new Builder)->issuedBy(config('app.url')) ->permittedFor($server->node->getConnectionAddress()) ->identifiedBy(hash('sha256', $server->uuid), true) ->issuedAt($now->getTimestamp()) ->canOnlyBeUsedAfter($now->getTimestamp()) ->expiresAt($now->addMinutes(15)->getTimestamp()) ->relatedTo($server->id, true) ->getToken($signer, new Key($server->node->daemonSecret)); $this->daemonTransferRepository->notify($server, $token->__toString()); return JsonResponse::create([], Response::HTTP_NO_CONTENT); } }