diff --git a/jetbrains-toolbox.sh b/jetbrains-toolbox.sh old mode 100644 new mode 100755 index d8c22c2..9a446cb --- a/jetbrains-toolbox.sh +++ b/jetbrains-toolbox.sh @@ -4,11 +4,17 @@ echo -e " \e[94mInstalling Jetbrains Toolbox\e[39m" echo "" -URL="https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.0.2095.tar.gz" +function getLatestUrl() { +USER_AGENT=('User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36') -FILE=$(basename ${URL}) +URL=$(curl 'https://data.services.jetbrains.com//products/releases?code=TBA&latest=true&type=release' -H 'Origin: https://www.jetbrains.com' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8' -H "${USER_AGENT[@]}" -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://www.jetbrains.com/toolbox/download/' -H 'Connection: keep-alive' -H 'DNT: 1' --compressed | grep -Po '"linux":.*?[^\\]",' | awk -F ':' '{print $3,":"$4}'| sed 's/[", ]//g') +echo $URL +} +getLatestUrl +FILE=$(basename ${URL}) DEST=$PWD/$FILE + echo "" echo -e "\e[94mDownloading Toolbox files \e[39m" echo ""