File tree Expand file tree Collapse file tree
app/Console/Commands/BlueprintFramework Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414use Illuminate \Console \Command ;
1515use Illuminate \Support \Facades \DB ;
16+ use Illuminate \Support \Facades \Http ;
1617use Pterodactyl \Models \ExtensionCachedMetadata ;
1718use Pterodactyl \BlueprintFramework \Services \PlaceholderService \BlueprintPlaceholderService ;
1819use Pterodactyl \BlueprintFramework \Libraries \ExtensionLibrary \Console \BlueprintConsoleLibrary as BlueprintExtensionLibrary ;
@@ -41,12 +42,8 @@ public function handle()
4142 $ installedExtensions = $ this ->blueprint ->extensions ();
4243
4344 // get version info
44- $ context = stream_context_create (['http ' => ['method ' => 'GET ' , 'header ' => 'User-Agent: BlueprintFramework ' ]]);
45- $ remoteVersions = @file_get_contents (
46- $ this ->PlaceholderService ->api_url () . '/api/extensions/latest ' ,
47- false ,
48- $ context
49- );
45+ $ res = Http::get ($ this ->PlaceholderService ->api_url () . '/api/extensions/latest ' );
46+ $ remoteVersions = $ res ->body ();
5047
5148 if ($ remoteVersions ) {
5249 $ remoteVersionsData = json_decode ($ remoteVersions , true );
Original file line number Diff line number Diff line change 33namespace Pterodactyl \Console \Commands \BlueprintFramework \Version ;
44
55use Illuminate \Console \Command ;
6+ use Illuminate \Support \Facades \Http ;
67use Pterodactyl \BlueprintFramework \Services \PlaceholderService \BlueprintPlaceholderService ;
78use Pterodactyl \BlueprintFramework \Libraries \ExtensionLibrary \Console \BlueprintConsoleLibrary as BlueprintExtensionLibrary ;
89
@@ -20,22 +21,16 @@ public function __construct(
2021
2122 public function handle ()
2223 {
23- $ api_url = $ this ->PlaceholderService ->api_url () . '/api/latest ' ;
24- $ context = stream_context_create ([
25- 'http ' => [
26- 'method ' => 'GET ' ,
27- 'header ' => 'User-Agent: BlueprintFramework ' ,
28- ],
29- ]);
30- $ response = @file_get_contents ($ api_url , false , $ context );
24+ $ res = Http::get ($ this ->PlaceholderService ->api_url () . '/api/latest ' );
25+ $ body = $ res ->body ();
3126
32- if ($ response === false || empty ($ response )) {
27+ if ($ body === false || empty ($ body )) {
3328 $ this ->blueprint ->dbSet ('blueprint ' , 'internal:version:latest ' , 'unknown ' );
3429 return false ;
3530 }
3631
37- if ($ response ) {
38- $ cleaned_response = preg_replace ('/[[:^print:]]/ ' , '' , $ response );
32+ if ($ body ) {
33+ $ cleaned_response = preg_replace ('/[[:^print:]]/ ' , '' , $ body );
3934 $ data = json_decode ($ cleaned_response , true );
4035 if (isset ($ data ['name ' ])) {
4136 $ latest_version = $ data ['name ' ];
You can’t perform that action at this time.
0 commit comments