diff --git a/app/Console/Commands/BlueprintFramework/TelemetryCommand.php b/app/Console/Commands/BlueprintFramework/TelemetryCommand.php new file mode 100644 index 00000000..ec719bc3 --- /dev/null +++ b/app/Console/Commands/BlueprintFramework/TelemetryCommand.php @@ -0,0 +1,31 @@ +blueprintTelemetryCollectionService->collect()); + } +} \ No newline at end of file diff --git a/app/Console/Commands/BlueprintFramework/Version/VersionCacheCommand.php b/app/Console/Commands/BlueprintFramework/Version/VersionCacheCommand.php index 665a6a6a..1a505dd3 100644 --- a/app/Console/Commands/BlueprintFramework/Version/VersionCacheCommand.php +++ b/app/Console/Commands/BlueprintFramework/Version/VersionCacheCommand.php @@ -12,7 +12,7 @@ class VersionCacheCommand extends Command protected $signature = 'bp:version:cache'; /** - * VersionFetchCommand constructor. + * VersionCacheCommand constructor. */ public function __construct( private BlueprintPlaceholderService $PlaceholderService, diff --git a/blueprint.sh b/blueprint.sh index f51db367..30c02e0f 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -38,7 +38,7 @@ if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then cmd="${COMP_WORDS[1]}" case "${cmd}" in - -install|-add|-i) + -install|-add|-i|-query|-q) opts="$( find "$BLUEPRINT__SOURCEFOLDER"/*.blueprint 2> /dev/null | sed -e "s|^$BLUEPRINT__SOURCEFOLDER/||g" -e "s|.blueprint$||g" @@ -52,7 +52,7 @@ if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then -export) opts="expose" ;; -upgrade) opts="remote" ;; - *) opts="-install -add -remove -init -build -export -wipe -version -help -info -debug -upgrade -rerun-install" ;; + *) opts="-install -add -remove -query -init -build -export -wipe -version -help -info -debug -upgrade -rerun-install" ;; esac if [[ ${cur} == * ]]; then @@ -358,6 +358,7 @@ cmd="${2}" case "$cmd" in -add|-install|-i) source ./scripts/commands/extensions/install.sh ;; -remove|-r) source ./scripts/commands/extensions/remove.sh ;; + -query|-q) source ./scripts/commands/extensions/query.sh ;; -init|-I) source ./scripts/commands/developer/init.sh ;; -build|-b) source ./scripts/commands/developer/build.sh ;; -wipe|-w) source ./scripts/commands/developer/wipe.sh ;; diff --git a/blueprint/design/schema.txt b/blueprint/design/schema.txt deleted file mode 100644 index d86e4117..00000000 --- a/blueprint/design/schema.txt +++ /dev/null @@ -1,28 +0,0 @@ -blueprint - internal - seed true boolean - uuid * string - cache * integer - version - latest * string - flags - disable_attribution false boolean - is_developer false boolean - show_in_sidebar false boolean - telemetry_enabled true boolean - notification - text - string - - - - -* indicates a value is dynamically changed and - isn't a static value -- indicates an empty value - -structure: - record | default | type - -purpose of this file: - internal overview of database records managed - and used for blueprint \ No newline at end of file diff --git a/scripts/commands/extensions/query.sh b/scripts/commands/extensions/query.sh new file mode 100644 index 00000000..b49f0005 --- /dev/null +++ b/scripts/commands/extensions/query.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +Command() { + if [[ $1 == "" ]]; then PRINT FATAL "Expected 1 argument but got 0.";exit 2;fi + + PRINT INFO "Searching and validating framework dependencies.." + # Check if required programs and libraries are installed. + depend + + PRINT INFO "Extracting extension.." + dev=false + n="$1" + + if [[ $n == *".blueprint" ]]; then n="${n::-10}";fi + FILE="${n}.blueprint" + + if [[ ! -f "$FILE" ]]; then PRINT FATAL "$FILE could not be found or detected.";return 2;fi + + ZIP="${n}.zip" + cp "$FILE" ".blueprint/tmp/$ZIP" + cd ".blueprint/tmp" || cdhalt + unzip -o -qq "$ZIP" + rm "$ZIP" + if [[ ! -f "$n/*" ]]; then + cd ".." || cdhalt + rm -R "tmp" + mkdir -p "tmp" + cd "tmp" || cdhalt + + mkdir -p "./$n" + cp "../../$FILE" "./$n/$ZIP" + cd "$n" || cdhalt + unzip -o -qq "$ZIP" + rm "$ZIP" + cd ".." || cdhalt + fi + + # Return to the Pterodactyl installation folder. + cd "$FOLDER" || cdhalt + + # Get all strings from the conf.yml file and make them accessible as variables. + if [[ ! -f ".blueprint/tmp/$n/conf.yml" ]]; then + # Quit if the extension doesn't have a conf.yml file. + rm -R ".blueprint/tmp/$n" + PRINT FATAL "Extension configuration file not found or detected." + return 1 + fi + + eval "$(parse_yaml .blueprint/tmp/"${n}"/conf.yml conf_)" + + echo $conf__ + + echo -e \ + "\x1b[37;1mnebula.blueprint\x1b[0m" + + rm -R ".blueprint/tmp/$n" + + exit 0 +} \ No newline at end of file diff --git a/scripts/commands/misc/help.sh b/scripts/commands/misc/help.sh index ec93932c..29f9deaa 100644 --- a/scripts/commands/misc/help.sh +++ b/scripts/commands/misc/help.sh @@ -15,6 +15,7 @@ Command() { \x1b[34;1mExtensions\x1b[0m\x1b[34m -install [name] -add -i install/update a blueprint extension -remove [name] -r remove a blueprint extension + -query [name] -q information about a specific blueprint extension \x1b[0m ${help_dev_primary}Developer${help_dev_status}\x1b[0m${help_dev_secondary}