diff --git a/api b/api index 8b0679e4949..89cf1c63bc2 100755 --- a/api +++ b/api @@ -1379,24 +1379,6 @@ app_prefix_category() { #lists all apps in a category with format "category/app" fi } -# bitly_link() { #Runs whenever an app is installed/uninstalled to tally the number of users for each app -# #This cannot possibly be used to identify you, or any information about you. -# #It simply "clicks" a bitly link - a shortened URL - so that the total number of clicks can be tallied to determine how popular a certain app is. -# app="$1" -# trigger="$2" -# -# [ -z "$app" ] && error "bitly_link(): requires an app argument" -# [ -z "$trigger" ] && error "bitly_link(): requires a trigger argument" -# -# #if the 'Enable Analytics' setting is enabled -# if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics")" == 'Yes' ];then -# #determine the name of the link to "click" -# bitlylink="https://bit.ly/pi-apps-$trigger-$(echo "$app" | tr -d ' ' | sed 's/[^a-zA-Z0-9]//g')" -# #click it -# curl -L --user-agent "Pi-Apps Raspberry Pi app store" "$bitlylink" &>/dev/null & -# fi -# } - bitly_link() { #compatibility function pointing to shlink_link (incase old manage script is running with new api) shlink_link "$@" } @@ -1404,18 +1386,25 @@ bitly_link() { #compatibility function pointing to shlink_link (incase old manag shlink_link() { #Runs whenever an app is installed/uninstalled to tally the number of users for each app #This cannot possibly be used to identify you, or any information about you. #It simply "clicks" a shlink link - a shortened URL - so that the total number of clicks can be tallied to determine how popular a certain app is. - app="$1" - trigger="$2" + local app="$1" + local trigger="$2" + local override="$3" [ -z "$app" ] && error "shlink_link(): requires an app argument" [ -z "$trigger" ] && error "shlink_link(): requires a trigger argument" #if the 'Enable Analytics' setting is enabled - if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics")" == 'Yes' ];then + if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics" 2>/dev/null)" == 'Yes' ] || [ "$override" == always ] ;then + #obtain model name + get_model &>/dev/null + local model="$(echo $model | tr -d '"'\; | head -1)" + #obtain operating system name + local os_name="$(cat /etc/os-release | grep PRETTY_NAME | tr -d '"'\; | awk -F= '{print $2}' | head -1)" + #determine the name of the link to "click" - shlinklink="https://analytics.pi-apps.io/pi-apps-$trigger-$(echo "$app" | tr -d ' ' | sed 's/[^a-zA-Z0-9]//g')/track" + local shlinklink="https://analytics.pi-apps.io/pi-apps-$trigger-$(echo "$app" | tr -d ' ' | sed 's/[^a-zA-Z0-9]//g')/track" #click it - curl -s -X 'GET' "$shlinklink" -H 'accept: image/gif' -A "Pi-Apps Raspberry Pi app store" >/dev/null & + curl -s -X 'GET' "$shlinklink" -H 'accept: image/gif' -A "Pi-Apps Raspberry Pi app store; $model; $os_name" >/dev/null & fi } diff --git a/gui b/gui index 1b341d914e5..6cb2a6a5bc6 100755 --- a/gui +++ b/gui @@ -109,11 +109,8 @@ mkdir -p "${DIRECTORY}/data/status" "${DIRECTORY}/data/update-status" \ "${DIRECTORY}/updater" set-status & trap "kill $! &>/dev/null" EXIT #kill the above subprocess on exit -#Click pi-apps usage link every time the GUI is run only if the 'Enable Analytics' setting is enabled -if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics")" == 'Yes' ];then - #click it - curl -s -X 'GET' "https://analytics.pi-apps.io/pi-apps-active-usage/track" -H 'accept: image/gif' -A "Pi-Apps Raspberry Pi app store" >/dev/null & -fi +#Click pi-apps usage link every time the GUI is run +shlink_link usage active } #Determine the app list mode. Allowed values: 'yad-*', 'xlunch-*' diff --git a/install b/install index 3f515328c22..8181320d56d 100755 --- a/install +++ b/install @@ -64,7 +64,7 @@ elif [ ! -d "$DIRECTORY" ];then error "Pi-Apps download failed!\ngit clone output was: $output" fi #click new installation analytics link - curl -s -X 'GET' "https://analytics.pi-apps.io/pi-apps-install-script/track" -H 'accept: image/gif' -A "Pi-Apps Raspberry Pi app store" >/dev/null & + "${DIRECTORY}/api" shlink_link script install always fi #Past this point, DIRECTORY variable populated with valid pi-apps directory diff --git a/uninstall b/uninstall index e6440cd5419..998a15f9699 100755 --- a/uninstall +++ b/uninstall @@ -8,9 +8,7 @@ function error { DIRECTORY="$(readlink -f "$(dirname "$0")")" #click new uninstallation analytics link -if [ "$(cat "${DIRECTORY}/data/settings/Enable analytics")" == 'Yes' ];then - curl -s -X 'GET' "https://analytics.pi-apps.io/pi-apps-uninstall-script/track" -H 'accept: image/gif' -A "Pi-Apps Raspberry Pi app store" >/dev/null & -fi +"${DIRECTORY}/api" shlink_link script uninstall always if [ -z "$(dpkg-query -W --showformat='${Status}\n' yad 2>/dev/null | grep "install ok installed")" ];then zenity --title='Pi-Apps' --window-icon="${DIRECTORY}/icons/logo.png" \