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-01-15 17:59:09 -05:00
|
|
|
# === CACHEREMINDER ===
|
2023-08-11 15:39:46 -04:00
|
|
|
updateCacheReminder() {
|
2024-06-23 10:38:57 -04:00
|
|
|
cd "${BLUEPRINT__FOLDER}" || return
|
2023-08-11 15:39:46 -04:00
|
|
|
# Overwrite previous adminCacheReminderHider with the default one.
|
2023-11-20 17:48:20 -05:00
|
|
|
oldClassName=$(cat .blueprint/extensions/blueprint/private/db/randomclassname)
|
2023-12-17 07:43:59 -05:00
|
|
|
newClassName=$RANDOM$RANDOM$RANDOM$RANDOM
|
|
|
|
mv .blueprint/extensions/blueprint/assets/misc/cacheOverlay-"${oldClassName}".css .blueprint/extensions/blueprint/assets/misc/cacheOverlay-"${newClassName}".css
|
2023-12-03 12:53:19 -05:00
|
|
|
sed -i "s~cacheOverlay-$oldClassName~cacheOverlay-$newClassName~g" .blueprint/extensions/blueprint/assets/blueprint.style.css
|
2024-02-17 15:38:10 -05:00
|
|
|
sed -i "s~I0TWHOPKAB-$oldClassName~I0TWHOPKAB-$newClassName~g" resources/views/blueprint/admin/admin.blade.php
|
2023-12-17 07:43:59 -05:00
|
|
|
sed -i "s~I0TWHOPKAB-$oldClassName~I0TWHOPKAB-$newClassName~g" .blueprint/extensions/blueprint/assets/misc/cacheOverlay-"${newClassName}".css
|
2023-11-20 17:48:20 -05:00
|
|
|
echo "$newClassName" > .blueprint/extensions/blueprint/private/db/randomclassname
|
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
|
|
|
}
|