MODDIR=${0%/*}

# Alias for Curl
alias curl='$MODDIR/bin/curl --dns-servers 1.1.1.1,1.0.0.1'

# Variables
Latest=$(curl -s https://api.github.com/repos/uazo/cromite/releases | grep arm64_SystemWebView.apk | grep -m 1 -o https://github.com/uazo/cromite/releases/download/.*.apk)

echo "Downloading Update..."
curl -L -o /data/local/tmp/CromiteWebView.apk $Latest
sleep 1
echo "Installing Update..."
pm install --install-location 1 /data/local/tmp/CromiteWebView.apk
sleep 1
echo "Cleaning Up..."
rm -rf /data/local/tmp/CromiteWebView.apk
sleep 1
echo "Update Done!"
