From 6ff7384fe76902d051a38fe99de97c7e2fcd89ec Mon Sep 17 00:00:00 2001 From: Botspot Date: Mon, 30 Nov 2020 14:19:34 -0600 Subject: [PATCH] analytics a separate script --- etc/bitlylink | 29 +++++++++++++++++++++++++++++ manage | 13 ++++--------- 2 files changed, 33 insertions(+), 9 deletions(-) create mode 100755 etc/bitlylink diff --git a/etc/bitlylink b/etc/bitlylink new file mode 100755 index 0000000..ceaa844 --- /dev/null +++ b/etc/bitlylink @@ -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 diff --git a/manage b/manage index 3ccef78..a0620c5 100755 --- a/manage +++ b/manage @@ -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}"