2023-08-11 15:39:46 -04:00
|
|
|
#!/bin/bash
|
2024-06-23 10:38:57 -04:00
|
|
|
#
|
2024-01-15 11:40:50 -05:00
|
|
|
# This script has been created as part of the Blueprint source code
|
|
|
|
# and uses the same license as the rest of the codebase.
|
2023-08-11 15:39:46 -04:00
|
|
|
|
2024-01-15 17:59:09 -05:00
|
|
|
|
|
|
|
# === DATABASE ===
|
|
|
|
FLDR=".blueprint/extensions/blueprint/private/db/database"
|
|
|
|
# dbAdd "database.record"
|
|
|
|
dbAdd() { echo "* ${1};" >> $FLDR; }
|
|
|
|
# dbValidate "database.record"
|
|
|
|
dbValidate() { grep -Fxq "* ${1};" $FLDR > /dev/null; }
|
|
|
|
# dbRemove "database.record"
|
|
|
|
dbRemove() { sed -i "s/* ${1};//g" $FLDR > /dev/null; }
|
|
|
|
|
|
|
|
|
|
|
|
# === TELEMETRY ===
|
|
|
|
sendTelemetry() {
|
2024-06-23 10:38:57 -04:00
|
|
|
cd "${BLUEPRINT__FOLDER}" || return
|
2024-01-15 17:59:09 -05:00
|
|
|
key=$(cat .blueprint/extensions/blueprint/private/db/telemetry_id)
|
|
|
|
if [[ $key == "KEY_NOT_UPDATED" ]]; then
|
2024-06-23 10:38:57 -04:00
|
|
|
return 0
|
2024-01-15 17:59:09 -05:00
|
|
|
fi
|
2024-04-10 13:41:19 -04:00
|
|
|
curl --location --silent --connect-timeout 3 "http://api.blueprint.zip:50000/send/$key/$1" &
|
2024-01-15 17:59:09 -05:00
|
|
|
}
|
|
|
|
|
2024-06-22 08:38:49 -04:00
|
|
|
|
2024-06-23 10:38:57 -04:00
|
|
|
# === SHIFTARGS ===
|
|
|
|
shiftArgs() {
|
2024-06-27 16:12:34 -04:00
|
|
|
shift 1
|
2024-06-23 10:38:57 -04:00
|
|
|
args=""
|
|
|
|
for arg in "$@"; do
|
|
|
|
args+="$arg "
|
|
|
|
done
|
|
|
|
echo "$args"
|
2024-06-23 11:53:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# === UNSETVARS ===
|
|
|
|
unsetVariables() {
|
|
|
|
patterns=("^conf_" "^old_" "^Console_" "^OldConsole_" "^Components_" "^OldComponents_" "^F_")
|
|
|
|
for pattern in "${patterns[@]}"; do
|
|
|
|
for var in $(compgen -v | grep "$pattern"); do
|
|
|
|
unset "$var"
|
|
|
|
done
|
|
|
|
done
|
2023-12-03 12:34:37 -05:00
|
|
|
}
|