diff --git a/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php b/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php index e243099..e0d8d3f 100644 --- a/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php +++ b/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php @@ -9,6 +9,7 @@ use Illuminate\Contracts\Console\Kernel; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Helpers\SoftwareVersionService; use Pterodactyl\Services\Helpers\BlueprintVariableService; +use Pterodactyl\Services\Helpers\BlueprintTelemetryService; use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface; use Illuminate\Contracts\Config\Repository as ConfigRepository; use Pterodactyl\Http\Requests\Admin\Extensions\Blueprint\BlueprintSettingsFormRequest; @@ -22,6 +23,7 @@ class BlueprintExtensionController extends Controller */ public function __construct( private BlueprintVariableService $bp, + private BlueprintTelemetryService $telemetry, private SoftwareVersionService $version, private ViewFactory $view, @@ -44,6 +46,7 @@ class BlueprintExtensionController extends Controller 'admin.extensions.blueprint.index', [ 'version' => $this->version, 'bp' => $this->bp, + 'telemetry' => $this->telemetry, 'root' => "/admin/extensions/blueprint", 'a' => $this->bp->a(), 'b' => $this->bp->b(), diff --git a/app/Services/Helpers/BlueprintExtensionLibrary.php b/app/Services/Helpers/BlueprintExtensionLibrary.php index 957b601..c86b657 100644 --- a/app/Services/Helpers/BlueprintExtensionLibrary.php +++ b/app/Services/Helpers/BlueprintExtensionLibrary.php @@ -8,19 +8,12 @@ */ namespace Pterodactyl\Services\Helpers; -use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface; -use Pterodactyl\Services\Helpers\BlueprintVariableService; -use Pterodactyl\Services\Helpers\BlueprintTelemetryService; -use Pterodactyl\Services\Helpers\BlueprintPlaceholderService; class BlueprintExtensionLibrary { // Construct BlueprintExtensionLibrary public function __construct( private SettingsRepositoryInterface $settings, - private BlueprintVariableService $bp, - private BlueprintTelemetryService $telemetry, - private BlueprintPlaceholderService $placeholder, ) { } diff --git a/app/Services/Helpers/BlueprintPlaceholderService.php b/app/Services/Helpers/BlueprintPlaceholderService.php index c8dc67e..f1b08b6 100644 --- a/app/Services/Helpers/BlueprintPlaceholderService.php +++ b/app/Services/Helpers/BlueprintPlaceholderService.php @@ -2,18 +2,12 @@ namespace Pterodactyl\Services\Helpers; use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface; -use Pterodactyl\Services\Helpers\BlueprintVariableService; -use Pterodactyl\Services\Helpers\BlueprintExtensionLibrary; -use Pterodactyl\Services\Helpers\BlueprintTelemetryService; class BlueprintPlaceholderService { // Construct BlueprintPlaceholderService public function __construct( private SettingsRepositoryInterface $settings, - private BlueprintVariableService $bp, - private BlueprintExtensionLibrary $lib, - private BlueprintTelemetryService $telemetry, ) { } diff --git a/app/Services/Helpers/BlueprintTelemetryService.php b/app/Services/Helpers/BlueprintTelemetryService.php index c393099..a4a65b0 100644 --- a/app/Services/Helpers/BlueprintTelemetryService.php +++ b/app/Services/Helpers/BlueprintTelemetryService.php @@ -2,28 +2,35 @@ namespace Pterodactyl\Services\Helpers; use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface; -use Pterodactyl\Services\Helpers\BlueprintVariableService; -use Pterodactyl\Services\Helpers\BlueprintExtensionLibrary; -use Pterodactyl\Services\Helpers\BlueprintPlaceholderService; class BlueprintTelemetryService { // Construct BlueprintTelemetryService public function __construct( private SettingsRepositoryInterface $settings, - private BlueprintVariableService $bp, - private BlueprintExtensionLibrary $lib, - private BlueprintPlaceholderService $placeholder, ) { } - public function db($type, $table, $key, $value) { - if ($type === "get") { - return $this->settings->get($table."::".$key); - }; - if ($type === "set") { - return $this->settings->set($table."::".$key, $value); - }; - return true; + public function send($event) { + if ($this->settings->get('blueprint::telemetry') == "false") { return; }; + if ($this->settings->get('blueprint::telemetry:id') == "") { $this->settings->set('blueprint::telemetry:id', uniqid(rand())); }; + + $curl = curl_init(); + + curl_setopt_array($curl, array( + CURLOPT_URL => 'http://relay.ptero.shop:3511/send/'.$this->settings->get('blueprint::telemetry:id')."/".$event."/", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', + )); + + $response = curl_exec($curl); + + curl_close($curl); + return; } } \ No newline at end of file diff --git a/resources/views/admin/extensions/blueprint/index.blade.php b/resources/views/admin/extensions/blueprint/index.blade.php index af2ecf0..e3c5284 100644 --- a/resources/views/admin/extensions/blueprint/index.blade.php +++ b/resources/views/admin/extensions/blueprint/index.blade.php @@ -16,6 +16,7 @@ @section('content') {{ $bp->rlKey() }} + {{ $telemetry->send("SERVE_BLUEPRINT_ADMIN") }}

Blueprint is the framework that powers all Blueprint-compatible extensions, enabling multiple extensions to be installed and used simultaneously.