Skip to content

Commit 6b7ea92

Browse files
committed
feat: add flags to telemetry
1 parent 4421ecc commit 6b7ea92

5 files changed

Lines changed: 19 additions & 4 deletions

File tree

app/Services/Telemetry/BlueprintTelemetryCollectionService.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\Http;
88
use Pterodactyl\BlueprintFramework\Services\PlaceholderService\BlueprintPlaceholderService;
99
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary as BlueprintExtensionLibrary;
10+
use Database\Seeders\BlueprintSeeder;
1011

1112
class BlueprintTelemetryCollectionService
1213
{
@@ -16,6 +17,7 @@ class BlueprintTelemetryCollectionService
1617
public function __construct(
1718
private BlueprintExtensionLibrary $blueprint,
1819
private BlueprintPlaceholderService $placeholderService,
20+
private BlueprintSeeder $seeder,
1921
) {
2022
}
2123

@@ -46,13 +48,30 @@ public function collect(): array
4648
$this->blueprint->dbSet('blueprint', 'internal:uuid', $uuid);
4749
}
4850

51+
$schema = $this->seeder->getSchema();
52+
$flags = [];
53+
54+
if (isset($schema['flags'])) {
55+
foreach ($schema['flags'] as $flagName => $config) {
56+
$path = "flags:{$flagName}";
57+
$value = $this->blueprint->dbGet('blueprint', $path);
58+
59+
if (is_null($value)) {
60+
$value = $this->seeder->getDefaultsForFlag($path);
61+
}
62+
63+
$flags[$flagName] = $value;
64+
}
65+
}
66+
4967
return [
5068
'id' => $uuid,
5169
'telemetry_version' => 1,
5270

5371
'blueprint' => [
5472
'version' => $this->placeholderService->version(),
5573
'extensions' => $this->blueprint->extensions()->toArray(),
74+
'flags' => $flags,
5675
'developer' => $this->blueprint->dbGet('blueprint', 'flags:is_developer', 'false') === "true",
5776
'docker' => file_exists('/.dockerenv'),
5877
],

scripts/commands/developer/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22

33
Command() {
4-
# Check for developer mode through the database library.
54
if ! is_developer; then PRINT FATAL "Developer mode is not enabled.";exit 2; fi
65

76
if [[ -z $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then

scripts/commands/developer/export.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22

33
Command() {
4-
# Check for developer mode through the database library.
54
if ! is_developer; then PRINT FATAL "Developer mode is not enabled.";exit 2; fi
65

76
if [[ -z $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then

scripts/commands/developer/init.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22

33
Command() {
4-
# Check for developer mode through the database library.
54
if ! is_developer; then PRINT FATAL "Developer mode is not enabled.";exit 2; fi
65

76
# To prevent accidental wiping of your dev directory, you are unable to initialize another extension

scripts/commands/developer/wipe.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22

33
Command() {
4-
# Check for developer mode through the database library.
54
if ! is_developer; then PRINT FATAL "Developer mode is not enabled.";exit 2; fi
65

76
if [[ -z $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then

0 commit comments

Comments
 (0)