diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index 28266eac5..8d48f9dff 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -10,6 +10,7 @@ namespace Pterodactyl\Http\Controllers\Admin; use Javascript; +use Cake\Chronos\Chronos; use Illuminate\Http\Request; use Pterodactyl\Models\Node; use Illuminate\Http\Response; @@ -396,7 +397,7 @@ class NodesController extends Controller public function setToken(Node $node) { $token = bin2hex(random_bytes(16)); - $this->cache->put('Node:Configuration:' . $token, $node->id, 5); + $this->cache->put('Node:Configuration:' . $token, $node->id, Chronos::now()->addMinutes(5)); return response()->json(['token' => $token]); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index a3419412c..9cfbfee49 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Http\Controllers\Auth; +use Cake\Chronos\Chronos; use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Auth\AuthManager; @@ -100,7 +101,7 @@ class LoginController extends AbstractLoginController if ($user->use_totp) { $token = Str::random(64); - $this->cache->put($token, $user->id, 5); + $this->cache->put($token, $user->id, Chronos::now()->addMinutes(5)); return JsonResponse::create([ 'data' => [ diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 33945578c..f7efba65a 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Services\Helpers; +use Cake\Chronos\Chronos; use Illuminate\Filesystem\FilesystemManager; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Cache\Repository as CacheRepository; @@ -134,7 +135,7 @@ class AssetHashService } $contents = json_decode($this->filesystem->get(self::MANIFEST_PATH), true); - $this->cache->put('Core:AssetManifest', $contents, 1440); + $this->cache->put('Core:AssetManifest', $contents, Chronos::now()->addMinutes(1440)); return self::$manifest = $contents; } diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index 0d91bb9aa..8ab51f457 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -12,6 +12,7 @@ namespace Pterodactyl\Services\Helpers; use stdClass; use Exception; use GuzzleHttp\Client; +use Cake\Chronos\Chronos; use Illuminate\Contracts\Cache\Repository as CacheRepository; use Illuminate\Contracts\Config\Repository as ConfigRepository; use Pterodactyl\Exceptions\Service\Helper\CdnVersionFetchingException; @@ -118,7 +119,7 @@ class SoftwareVersionService */ protected function cacheVersionData() { - $this->cache->remember(self::VERSION_CACHE_KEY, $this->config->get('pterodactyl.cdn.cache_time'), function () { + $this->cache->remember(self::VERSION_CACHE_KEY, Chronos::now()->addMinutes(config('pterodactyl.cdn.cache_time')), function () { try { $response = $this->client->request('GET', $this->config->get('pterodactyl.cdn.url'));