analytics a separate script

pull/129/head
Botspot 4 years ago
parent 7f28b86f44
commit 6ff7384fe7

@ -0,0 +1,29 @@
#!/bin/bash
#$1 is app name
#$2 is trigger
DIRECTORY="$(dirname "$(readlink -f "$(dirname "$0")")")"
function error {
echo -e "\e[91m$1\e[39m"
exit 1
}
app="$1"
trigger="$2"
if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics")" == 'Yes' ];then
#this is used to let Botspot see the daily installs for each app.
#Botspot created an individual bitly link for each app. When you install an app, the cooresponding bit.ly link is "clicked" by a headless chromium-browser instance.
#Chromium accesses the bit.ly link, then exits.
#Allowing analytics does not identify you, or any personal information about you. Botspot can only see the total number of "clicks", as well as the top 3 countries of origin.
bitlylink="https://bit.ly/pi-apps-$trigger-$(echo "$app" | tr -d ' ' | sed 's/[^a-zA-Z0-9]//g')"
if command -v chromium-browser ;then
chromium-browser --headless "$bitlylink" &>/dev/null &
elif command -v chromium ;then
chromium --headless "$bitlylink" &>/dev/null &
fi
#echo "clicked $bitlylink" 1>&2
fi

@ -81,15 +81,7 @@ elif [ "$1" == 'install' ];then
fi
#analytics
if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics")" == 'Yes' ];then
#this is used to let Botspot see the daily installs for each app.
#Botspot created an individual bitly link for each app. When you install an app, the cooresponding bit.ly link is "clicked" by a headless chromium-browser instance.
#Chromium accesses the bit.ly link, then exits.
#Allowing analytics does not identify you, or any personal information about you. Botspot can only see the number of "clicks" per day, as well as the top 10 countries of origin.
bitlylink="https://bit.ly/pi-apps-install-$(echo "$app" | tr -d ' ' | sed 's/[^a-zA-Z0-9]//g')"
chromium-browser --headless "$bitlylink" &>/dev/null &
fi
"${DIRECTORY}/etc/bitlylink" "$app" install
#determine which script to run
if [ -f "${DIRECTORY}/apps/${app}/install-32" ] && [ $arch == 32 ];then
@ -133,6 +125,9 @@ elif [ "$1" == 'uninstall' ];then
--button=No!"${DIRECTORY}/icons/exit.png":1 --button=Yes!"${DIRECTORY}/icons/check.png":0 || exit 0
fi
#analytics
"${DIRECTORY}/etc/bitlylink" "$app" uninstall
echo -e "\e[96mUninstalling $app\e[39m"
cd $HOME
echo 'corrupted' > "${DIRECTORY}/data/status/${app}"

Loading…
Cancel
Save