Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Pterodactyl\Models\ExtensionCachedMetadata;
use Pterodactyl\BlueprintFramework\Services\PlaceholderService\BlueprintPlaceholderService;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary as BlueprintExtensionLibrary;
Expand Down Expand Up @@ -41,12 +42,8 @@ public function handle()
$installedExtensions = $this->blueprint->extensions();

// get version info
$context = stream_context_create(['http' => ['method' => 'GET', 'header' => 'User-Agent: BlueprintFramework']]);
$remoteVersions = @file_get_contents(
$this->PlaceholderService->api_url() . '/api/extensions/latest',
false,
$context
);
$res = Http::get($this->PlaceholderService->api_url() . '/api/extensions/latest');
$remoteVersions = $res->body();

if($remoteVersions) {
$remoteVersionsData = json_decode($remoteVersions, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Pterodactyl\Console\Commands\BlueprintFramework\Version;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Pterodactyl\BlueprintFramework\Services\PlaceholderService\BlueprintPlaceholderService;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary as BlueprintExtensionLibrary;

Expand All @@ -20,22 +21,16 @@ public function __construct(

public function handle()
{
$api_url = $this->PlaceholderService->api_url() . '/api/latest';
$context = stream_context_create([
'http' => [
'method' => 'GET',
'header' => 'User-Agent: BlueprintFramework',
],
]);
$response = @file_get_contents($api_url, false, $context);
$res = Http::get($this->PlaceholderService->api_url() . '/api/latest');
$body = $res->body();

if ($response === false || empty($response)) {
if ($body === false || empty($body)) {
$this->blueprint->dbSet('blueprint', 'internal:version:latest', 'unknown');
return false;
}

if ($response) {
$cleaned_response = preg_replace('/[[:^print:]]/', '', $response);
if ($body) {
$cleaned_response = preg_replace('/[[:^print:]]/', '', $body);
$data = json_decode($cleaned_response, true);
if (isset($data['name'])) {
$latest_version = $data['name'];
Expand Down
Loading