diff --git a/README.md b/README.md index ed499f7..5617767 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Revanced Builder -This repo will allow one to build [ReVanced](https://github.com/revanced/) apps automatically and post it to a telegram channel to access and possibly share the builds with friends. It uses [telegram.sh](https://github.com/fabianonline/telegram.sh) to send messages and [telegram-upload](https://github.com/Nekmo/telegram-upload) to upload files (optionally, disabled out by default). Make sure that `Java >=17` is installed and selected as default. +This repo will allow one to build [ReVanced](https://github.com/revanced/) apps automatically and post it to a telegram channel to access and possibly share the builds with friends. It uses [Gotify](https://gotify.net) or [telegram.sh](https://github.com/fabianonline/telegram.sh) to send messages and [telegram-upload](https://github.com/Nekmo/telegram-upload) to upload files (optionally, disabled out by default). Make sure that `Java >=17` is installed and selected as default. ## How to use Just run `./build_revanced (force/clean/experimental/checkonly)`. Might be a good idea to set it up to run periodically using cron. I currently use the following in a user crontab to run it everyday at 6 AM: @@ -11,7 +11,7 @@ Just run `./build_revanced (force/clean/experimental/checkon - To enable build for a particular apk, copy the `build_settings` file to your working directory and modify it to suit your needs. - The script will download the **automatically selected compatible version** (using compatibility of patches as listed [here](https://github.com/revanced/revanced-patches#list-of-available-patches)) of Youtube on APKMirror, **NOT** latest official version on Google Play. - Under **NO CIRCUMSTANCES** any APKs will be uploaded to this repository to avoid DMCA. -- If you enable the telegram notifications or uploads, make sure to fill up the config options inside the `build_settings` file. For more information about the config, take at look at the repos of `telegram.sh` and `telegram-upload` provided above. +- If you enable the Gotify or telegram notifications or uploads, make sure to fill up the config options inside the `build_settings` file. For more information about the config, take at look at the repos of `telegram.sh` and `telegram-upload` provided above. - It can also run a post script (if exists) called `post_script.sh`. The `timestamp` is passed as `$1`. - In the current configuration, the script only builds YouTube ReVanced and YouTube Music ReVanced (both nonroot), but it's easy to add support for any other ReVanced app. The code for root builds is included but disabled by default. - All the packages are pulled from [APKMirror](https://apkmirror.com) and GitHub (the `revanced/*` repos). diff --git a/build_revanced.sh b/build_revanced.sh index 1b3238b..c76bfa7 100755 --- a/build_revanced.sh +++ b/build_revanced.sh @@ -253,18 +253,30 @@ if $TG_UPLOAD; then /home/sintan/.local/bin/telegram-upload YouTube_ReVanced_nonroot_$timestamp.apk YouTube_Music_ReVanced_nonroot_$timestamp.apk --to "$CHANNEL_ADDRESS" --caption "" && sent=true fi +# Create the message to be sent +msg=$(cat versions.json | tail -n+2 | head -n-1 | cut -c3- | sed "s/\"//g" | sed "s/,//g" | sed "s/com.google.android.apps.youtube.music/YouTube Music/" | + sed "s/com.google.android.youtube/YouTube/" | sed "s/VancedMicroG/Vanced microG/" | sed "s/revanced-/ReVanced /g" | sed "s/patches/Patches/" | + sed "s/cli/CLI/" | sed "s/integrations/Integrations/" | awk 1 ORS=$'\n') # I know, it's a hacky solution + if $TG_NOTIFICATIONS; then echo "Sending messages to telegram" # telegram.sh uses bot account, but it supports formatted messages [[ "$TELEGRAM_TOKEN" == "" || "$TELEGRAM_CHAT" == "" ]] && echo "Please provide valid channel address in the settings!" - msg=$(cat versions.json | tail -n+2 | head -n-1 | cut -c3- | sed "s/\"//g" | sed "s/,//g" | sed "s/com.google.android.apps.youtube.music/YouTube Music/" | - sed "s/com.google.android.youtube/YouTube/" | sed "s/VancedMicroG/Vanced microG/" | sed "s/revanced-/ReVanced /g" | sed "s/patches/Patches/" | - sed "s/cli/CLI/" | sed "s/integrations/Integrations/" | awk 1 ORS=$'\n') # I know, it's a hacky solution - # [ $sent ] && ./telegram.sh -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" -T "⚙⚙⚙ Build Details ⚙⚙⚙" -M "$msg"$'\n'"Timestamp: $timestamp"$'\n'"⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" [ $microg_updated ] && ./telegram.sh -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" -M "_An update of microg was published._" fi +if $GOTIFY_NOTIFICATIONS; then + echo "Sending messages to Gotify" + MESSAGE="$msg"$'\n'"Timestamp: $timestamp" + curl -X POST "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" \ + -F "title=⚙⚙⚙ Build Details ⚙⚙⚙" -F "message=$MESSAGE" -F "priority=5" + + MESSAGE="An update of microg was published." + [ $microg_updated ] && curl -X POST "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" \ + -F "title=⚙⚙⚙ Build Details ⚙⚙⚙" -F "message=$MESSAGE" -F "priority=5" +fi + # Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs mkdir -p archive mv *ReVanced_*_$timestamp.apk archive/ diff --git a/build_settings b/build_settings index be8bacf..c835be8 100644 --- a/build_settings +++ b/build_settings @@ -20,3 +20,11 @@ TELEGRAM_CHAT="" # Check out README for instructions TG_UPLOAD=false CHANNEL_ADDRESS="" + +# Settings for sending Gotify notifications +# In case you decide to use it, please put valid config in the +# URL and TOKEN fields +# Check out README for instructions +GOTIFY_NOTIFICATIONS=false +GOTIFY_URL="https://push.example.com" +GOTIFY_TOKEN=""