Compare commits

...
41 Commits
14 ... 113
Author SHA1 Message Date
nezumi d24f8939d0 fix: download apk issues 2026-02-24 17:04:12 +07:00
nezumi 3becfad4f7 fix: resolve the utils logic 2026-01-17 13:03:35 +07:00
nezumi 0e85707946 fix: resolve the utils logic 2026-01-17 12:58:05 +07:00
nezumi 117a2fde1b Update email content: add changelog, separate APKs/Modules, use Vietnam timezone 2026-01-09 22:27:26 +07:00
nezumi 8d9c8d40aa Add email notification feature using Resend API 2026-01-09 22:10:54 +07:00
nezumi bbde99482c feat: replace rvx patch to mophe patch 2026-01-04 21:48:54 +07:00
nezumi 9a7d8890aa Update build.sh 2025-05-18 10:16:54 +07:00
nezumi 57d950f57f Update build.sh 2025-05-18 10:06:28 +07:00
nezumi e0a5116d13 Update config.toml 2025-05-18 10:06:05 +07:00
nezumi 6e4565bc1b Update build.sh 2025-05-15 00:11:34 +07:00
nezumi f6d783c176 fix: ignore skipped content 2025-05-02 10:19:13 +07:00
nezumi 2da4a7c7cd update spotify config 2025-04-07 19:25:50 +07:00
nezumi 11af439fd5 add spotify patch 2025-04-07 19:16:28 +07:00
nezumi 1adcc80512 update github action 2025-04-03 22:54:01 +07:00
nezumi 596241c5d7 update github action 2025-04-03 22:51:51 +07:00
nezumi 26540719e9 update config 2025-04-03 22:49:57 +07:00
Loi Phan fbf816533d Update build.yml 2025-02-03 16:47:06 +07:00
Loi Phan d6582d2d63 Update ci.yml 2025-01-30 11:17:50 +07:00
Loi Phan 1a2af75601 Update config.toml 2025-01-30 11:15:35 +07:00
Loi Phan 6b33d5841d Update config.toml 2025-01-30 11:09:49 +07:00
Loi Phan 9f6f043d9a Update config.toml 2025-01-30 10:35:47 +07:00
Loi Phan 88ea74d38f Update ci.yml 2025-01-30 10:20:11 +07:00
Loi Phan ea7dd1d777 Update config.toml 2025-01-30 10:18:56 +07:00
Loi Phan 39e551c73c Update ci.yml 2025-01-30 09:59:04 +07:00
Loi Phan b5aac3781a Update ci.yml 2025-01-30 09:58:26 +07:00
Loi Phan 9ff2c72375 Update ci.yml 2025-01-30 09:57:34 +07:00
Loi Phan e65dfdaa1b Update config.toml 2025-01-30 09:57:20 +07:00
Loi Phan b2312718f9 Update config.toml 2025-01-30 09:53:07 +07:00
Loi Phan f1e8080202 Update config.toml 2025-01-30 09:51:19 +07:00
Loi Phan f428ad0cfe Update ci.yml 2025-01-30 09:50:21 +07:00
Loi Phan d28118c98c Update ci.yml 2025-01-30 09:42:54 +07:00
Loi Phan edfe08657a Update ci.yml 2025-01-30 09:42:09 +07:00
Loi Phan 03352030a1 Update README.md 2025-01-30 09:36:01 +07:00
Loi Phan c57014a391 update config 2025-01-30 09:33:24 +07:00
Loi Phan 1167a7c636 Update config.toml 2025-01-30 09:27:20 +07:00
Loi Phan fb7222a28f Update config.toml 2025-01-30 09:19:27 +07:00
nezumi 8e8c8634ef update config.toml 2025-01-22 22:00:09 +07:00
nezumi 7deb883720 update config 2025-01-22 20:25:45 +07:00
nezumi be1c20bb87 update config 2025-01-22 20:03:31 +07:00
nezumi 88a00ca413 update config 2025-01-22 19:41:27 +07:00
nezumi 788b36f083 update config 2025-01-22 19:24:00 +07:00
10 changed files with 562 additions and 158 deletions
+210 -24
View File
@@ -16,8 +16,8 @@ jobs:
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4
with: with:
distribution: "zulu" distribution: 'zulu'
java-version: "17" java-version: '17'
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -174,35 +174,221 @@ jobs:
${BODY} ${BODY}
**Download Links:** **Download Links:**
"
MODULES_MSG="
**Modules:** **Modules:**
${MODULES} ${MODULES}
"
APKS_MSG="
**APKs:** **APKs:**
${APKS} ${APKS}
" "
# Function to split messages properly by ensuring correct Markdown formatting curl -X POST -H "Content-Type: application/json" \
send_discord_message() { -d "$(jq -n --arg content "$MSG" '{content: $content}')" \
local message="$1" "$DISCORD_WEBHOOK_URL"
local buffer=""
while IFS= read -r line || [ -n "$line" ]; do
# Check if adding the current line exceeds 2000 characters
if [ ${#buffer} -ge 2000 ]; then
# Send the current buffer and reset it
curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$buffer" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL"
buffer=""
fi
buffer+="${line}\n"
done <<< "$message"
# Send any remaining content in the buffer # curl -X POST -H "Content-Type: application/json" \
if [ -n "$buffer" ]; then # -d "$(jq -n --arg content "$MODULES_MSG" '{content: $content}')" \
curl -X POST -H "Content-Type: application/json" \ # "$DISCORD_WEBHOOK_URL"
-d "$(jq -n --arg content "$buffer" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL" curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$APKS_MSG" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL"
- name: Report to Noob Discord
env:
DISCORD_WEBHOOK_NOOB_URL: ${{ secrets.DISCORD_WEBHOOK_NOOB_URL }}
if: env.DISCORD_WEBHOOK_NOOB_URL != null
run: |
cd build || { echo "build folder not found"; exit 1; }
NL=$'\n'
APKS=""
MODULES=""
for OUTPUT in *; do
DL_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}/${OUTPUT}"
if [[ $OUTPUT = *.apk ]]; then
APKS+="${NL}- [${OUTPUT}](${DL_URL})"
elif [[ $OUTPUT = *.zip ]]; then
MODULES+="${NL}- [${OUTPUT}](${DL_URL})"
fi fi
} done
send_discord_message "$MSG" MODULES=${MODULES#"$NL"}
APKS=${APKS#"$NL"}
BODY="$(sed 's/^\* \*\*/- \*\*/g; s/^\* `/- \*\*/g; s/`/\*/g; s/^\* /\-/g; s/\*\*/\*/g; s/###//g; s/^- /- /g; /^==/d;' ../build.md)"
MSG="**New build is ready!**
${BODY}
**Download Links:**
"
MODULES_MSG="
**Modules:**
${MODULES}
"
APKS_MSG="
**APKs:**
${APKS}
"
curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$MSG" '{content: $content}')" \
"$DISCORD_WEBHOOK_NOOB_URL"
# curl -X POST -H "Content-Type: application/json" \
# -d "$(jq -n --arg content "$MODULES_MSG" '{content: $content}')" \
# "$DISCORD_WEBHOOK_NOOB_URL"
curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$APKS_MSG" '{content: $content}')" \
"$DISCORD_WEBHOOK_NOOB_URL"
- name: Send Email Notification (Resend)
env:
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
MAIL_TO: ${{ secrets.MAIL_TO }}
MAIL_CC: ${{ secrets.MAIL_CC }}
MAIL_BCC: ${{ secrets.MAIL_BCC }}
MAIL_FROM: ${{ secrets.MAIL_FROM }}
if: env.RESEND_API_KEY != null && env.MAIL_TO != null
run: |
VERSION="${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}"
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/${VERSION}"
REPO="${{ github.repository }}"
# Set default FROM address if not provided
FROM_ADDRESS="${MAIL_FROM:-ReVanced Build Bot <onboarding@resend.dev>}"
# Build download links from build folder (separate APKs and Modules)
cd build || { echo "build folder not found"; exit 1; }
APK_LINKS=""
MODULE_LINKS=""
for OUTPUT in *; do
DL_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/${VERSION}/${OUTPUT}"
if [[ $OUTPUT = *.apk ]]; then
APK_LINKS+="<li style=\"margin: 8px 0;\">📦 <a href=\"${DL_URL}\" style=\"color: #667eea; text-decoration: none;\">${OUTPUT}</a></li>"
elif [[ $OUTPUT = *.zip ]]; then
MODULE_LINKS+="<li style=\"margin: 8px 0;\">📁 <a href=\"${DL_URL}\" style=\"color: #667eea; text-decoration: none;\">${OUTPUT}</a></li>"
fi
done
cd ..
# Get current time in Vietnam timezone (UTC+7)
BUILD_TIME=$(TZ='Asia/Ho_Chi_Minh' date '+%Y-%m-%d %H:%M:%S (UTC+7)')
# Get changelog from build.md and convert to HTML
if [ -f "build.md" ]; then
# Convert markdown to simple HTML
CHANGELOG_HTML=$(sed 's/^### \(.*\)/<h3 style="color: #667eea; font-size: 16px; margin: 15px 0 8px 0;">\1<\/h3>/g;
s/^\* \*\*\(.*\)\*\*/<li style="margin: 5px 0;"><strong>\1<\/strong><\/li>/g;
s/^\* \(.*\)/<li style="margin: 5px 0;">\1<\/li>/g;
s/^- \(.*\)/<li style="margin: 5px 0;">\1<\/li>/g;
s/`\([^`]*\)`/<code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 13px;">\1<\/code>/g;
/^==/d;
/^$/d' build.md | tr '\n' ' ')
else
CHANGELOG_HTML="<p>No changelog available.</p>"
fi
# Create HTML email body (similar structure to Telegram)
HTML_BODY=$(cat <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 0;">
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center;">
<h1 style="margin: 0;">🎉 New ReVanced Build!</h1>
<p style="margin: 10px 0 0 0; font-size: 18px;">Version: v${VERSION}</p>
<p style="margin: 5px 0 0 0; font-size: 14px; opacity: 0.9;">🕐 ${BUILD_TIME}</p>
</div>
<div style="padding: 25px; background: #f9f9f9;">
<!-- Changelog Section -->
<div style="margin-bottom: 25px; background: white; padding: 20px; border-radius: 8px; border-left: 4px solid #667eea;">
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 15px 0;">📋 Changelog</h2>
<div style="font-size: 14px;">
${CHANGELOG_HTML}
</div>
</div>
<!-- Download Links Section -->
<div style="margin-bottom: 25px; background: white; padding: 20px; border-radius: 8px;">
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 15px 0;"> Download Links</h2>
<!-- Modules -->
$(if [ -n "$MODULE_LINKS" ]; then echo "
<div style=\"margin-bottom: 15px;\">
<h3 style=\"color: #555; font-size: 15px; margin: 0 0 10px 0;\"> Modules:</h3>
<ul style=\"list-style: none; padding: 0; margin: 0;\">
${MODULE_LINKS}
</ul>
</div>
"; fi)
<!-- APKs -->
$(if [ -n "$APK_LINKS" ]; then echo "
<div>
<h3 style=\"color: #555; font-size: 15px; margin: 0 0 10px 0;\">📱 APKs:</h3>
<ul style=\"list-style: none; padding: 0; margin: 0;\">
${APK_LINKS}
</ul>
</div>
"; fi)
</div>
<!-- GitHub Button -->
<div style="text-align: center;">
<a href="${RELEASE_URL}" style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 30px; text-decoration: none; border-radius: 25px; font-weight: bold;">
View Release on GitHub
</a>
</div>
</div>
<div style="text-align: center; padding: 20px; background: #333; color: #999; font-size: 12px;">
<p style="margin: 0;">This is an automated message from ReVanced Build Bot</p>
<p style="margin: 5px 0 0 0;">Repository: ${REPO}</p>
</div>
</body>
</html>
EOF
)
# Build JSON payload with TO, CC and BCC recipients
# Resend allows up to 50 recipients per field (to, cc, bcc)
JSON_PAYLOAD=$(jq -n \
--arg from "$FROM_ADDRESS" \
--arg to "$MAIL_TO" \
--arg cc "$MAIL_CC" \
--arg bcc "$MAIL_BCC" \
--arg subject "🚀 New ReVanced Build Available - v${VERSION}" \
--arg html "$HTML_BODY" \
'{
from: $from,
to: ($to | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; ""))),
subject: $subject,
html: $html
}
+ (if $cc != "" then {cc: ($cc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)
+ (if $bcc != "" then {bcc: ($bcc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)'
)
echo "📧 Sending email notification..."
# Send email via Resend API
RESPONSE=$(curl -s -X POST "https://api.resend.com/emails" \
-H "Authorization: Bearer ${RESEND_API_KEY}" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD")
echo "Response: $RESPONSE"
echo "✅ Email sent successfully!"
+1 -1
View File
@@ -46,5 +46,5 @@ jobs:
permissions: write-all permissions: write-all
needs: check needs: check
uses: ./.github/workflows/build.yml uses: ./.github/workflows/build.yml
if: ${{ needs.check.outputs.SHOULD_BUILD == 0 }} if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
secrets: inherit secrets: inherit
+127
View File
@@ -0,0 +1,127 @@
name: Email Notification Test
on:
workflow_dispatch:
inputs:
recipient_email:
description: 'Email address to send test to (leave empty to use MAIL_TO secret)'
required: false
type: string
jobs:
send-test-email:
runs-on: ubuntu-latest
steps:
- name: Send Test Email (Resend)
env:
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
MAIL_TO: ${{ inputs.recipient_email || secrets.MAIL_TO }}
MAIL_CC: ${{ secrets.MAIL_CC }}
MAIL_BCC: ${{ secrets.MAIL_BCC }}
MAIL_FROM: ${{ secrets.MAIL_FROM }}
run: |
if [ -z "$RESEND_API_KEY" ]; then
echo "❌ Error: RESEND_API_KEY secret is not set!"
exit 1
fi
if [ -z "$MAIL_TO" ]; then
echo "❌ Error: No email recipient specified!"
echo "Either provide recipient_email input or set MAIL_TO secret."
exit 1
fi
# Set default FROM address if not provided
FROM_ADDRESS="${MAIL_FROM:-ReVanced Build Bot <onboarding@resend.dev>}"
# Use Vietnam timezone (UTC+7)
VERSION="TEST-$(TZ='Asia/Ho_Chi_Minh' date +%Y%m%d-%H%M%S)"
SENT_TIME=$(TZ='Asia/Ho_Chi_Minh' date '+%Y-%m-%d %H:%M:%S (UTC+7)')
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases"
REPO="${{ github.repository }}"
# Create test HTML email body
HTML_BODY=$(cat <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 0;">
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center;">
<h1 style="margin: 0;">🧪 Test Email</h1>
<p style="margin: 10px 0 0 0; font-size: 18px;">Version: ${VERSION}</p>
</div>
<div style="padding: 25px; background: #f9f9f9;">
<div style="margin-bottom: 25px;">
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 10px 0;">✅ Email Configuration Working!</h2>
<p style="margin: 0;">If you received this email, it means your Resend configuration is working correctly!</p>
</div>
<div style="margin-bottom: 25px;">
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 10px 0;">📋 Configuration Details</h2>
<ul style="list-style: none; padding: 0; margin: 0;">
<li>📧 From: ${FROM_ADDRESS}</li>
<li>📬 To: ${MAIL_TO}</li>
<li>🕐 Sent at: ${SENT_TIME}</li>
</ul>
</div>
<div style="margin-bottom: 25px; text-align: center;">
<a href="${RELEASE_URL}" style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 30px; text-decoration: none; border-radius: 25px; font-weight: bold;">
View Releases
</a>
</div>
</div>
<div style="text-align: center; padding: 20px; background: #333; color: #999; font-size: 12px;">
<p style="margin: 0;">This is a TEST email from ReVanced Build Bot</p>
<p style="margin: 5px 0 0 0;">Repository: ${REPO}</p>
</div>
</body>
</html>
EOF
)
# Build JSON payload
JSON_PAYLOAD=$(jq -n \
--arg from "$FROM_ADDRESS" \
--arg to "$MAIL_TO" \
--arg cc "$MAIL_CC" \
--arg bcc "$MAIL_BCC" \
--arg subject "🧪 [TEST] ReVanced Build Email - ${VERSION}" \
--arg html "$HTML_BODY" \
'{
from: $from,
to: ($to | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; ""))),
subject: $subject,
html: $html
}
+ (if $cc != "" then {cc: ($cc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)
+ (if $bcc != "" then {bcc: ($bcc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)'
)
echo "📧 Sending test email to: $MAIL_TO"
if [ -n "$MAIL_CC" ]; then echo "📋 CC: $MAIL_CC"; fi
if [ -n "$MAIL_BCC" ]; then echo "🔒 BCC: $MAIL_BCC"; fi
echo ""
# Send email via Resend API
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://api.resend.com/emails" \
-H "Authorization: Bearer ${RESEND_API_KEY}" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')
echo "Response: $BODY"
echo "HTTP Code: $HTTP_CODE"
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
echo ""
echo "✅ Test email sent successfully!"
echo "📬 Check your inbox at: $MAIL_TO"
else
echo ""
echo "❌ Failed to send email!"
echo "Please check your RESEND_API_KEY and email addresses."
exit 1
fi
+8 -1
View File
@@ -1,6 +1,7 @@
# Config # Config
Adding another revanced app is as easy as this: Adding another revanced app is as easy as this:
```toml ```toml
[Some-App] [Some-App]
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app" apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
@@ -10,7 +11,7 @@ apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
## More about other options: ## More about other options:
There exists an example below with all defaults shown and all the keys explicitly set. There exists an example below with all defaults shown and all the keys explicitly set.
**All keys are optional** (except download urls) and are assigned to their default values if not set explicitly. **All keys are optional** (except download urls) and are assigned to their default values if not set explicitly.
```toml ```toml
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set $(nproc) is used parallel-jobs = 1 # amount of cores to use for parallel patching, if not set $(nproc) is used
@@ -20,6 +21,12 @@ remove-rv-integrations-checks = true # remove checks from the revanced integrati
patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches" patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli" cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
# options like cli-source can also set per app # options like cli-source can also set per app
#
# Supported sources:
# - ReVanced: patches-source = "revanced/revanced-patches", cli-source = "j-hc/revanced-cli"
# - ReVanced Extended: patches-source = "inotia00/revanced-patches", cli-source = "inotia00/revanced-cli"
# - Morphe: patches-source = "MorpheApp/morphe-patches", cli-source = "MorpheApp/morphe-cli"
#
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced" rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"
patches-version = "v2.160.0" # 'latest', 'dev', or a version number. default: "latest" patches-version = "v2.160.0" # 'latest', 'dev', or a version number. default: "latest"
+12 -8
View File
@@ -1,16 +1,17 @@
# ReVanced Magisk Module # ReVanced Magisk Module
[![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/rvc_magisk) [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/rvc_magisk)
[![CI](https://github.com/j-hc/revanced-magisk-module/actions/workflows/ci.yml/badge.svg?event=schedule)](https://github.com/j-hc/revanced-magisk-module/actions/workflows/ci.yml) [![CI](https://github.com/j-hc/revanced-magisk-module/actions/workflows/ci.yml/badge.svg?event=schedule)](https://github.com/j-hc/revanced-magisk-module/actions/workflows/ci.yml)
Extensive ReVanced builder Extensive ReVanced builder
Get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/releases). Get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/releases).
Use [**zygisk-detach**](https://github.com/j-hc/zygisk-detach) to detach YouTube and YT Music from Play Store if you are using magisk modules. Use [**zygisk-detach**](https://github.com/j-hc/zygisk-detach) to detach YouTube and YT Music from Play Store if you are using magisk modules.
<details><summary><big>Features</big></summary> <details><summary><big>Features</big></summary>
<ul> <ul>
<li>Support all present and future ReVanced and <a href="https://github.com/inotia00/revanced-patches">ReVanced Extended</a> apps</li> <li>Support all present and future ReVanced, <a href="https://github.com/inotia00/revanced-patches">ReVanced Extended</a>, and <a href="https://github.com/MorpheApp/morphe-patches">Morphe patches</a></li>
<li> Can build Magisk modules and non-root APKs</li> <li> Can build Magisk modules and non-root APKs</li>
<li> Updated daily with the latest versions of apps and patches</li> <li> Updated daily with the latest versions of apps and patches</li>
<li> Optimize APKs and modules for size</li> <li> Optimize APKs and modules for size</li>
@@ -28,21 +29,24 @@ Note that the <a href="../../actions/workflows/ci.yml">CI workflow</a> is schedu
## To include/exclude patches or patch other apps ## To include/exclude patches or patch other apps
* Star the repo :eyes: - Star the repo :eyes:
* Use the repo as a [template](https://github.com/new?template_name=revanced-magisk-module&template_owner=j-hc) - Use the repo as a [template](https://github.com/new?template_name=revanced-magisk-module&template_owner=j-hc)
* Customize [`config.toml`](./config.toml) using [rvmm-config-gen](https://j-hc.github.io/rvmm-config-gen/) - Customize [`config.toml`](./config.toml) using [rvmm-config-gen](https://j-hc.github.io/rvmm-config-gen/)
* Run the build [workflow](../../actions/workflows/build.yml) - Run the build [workflow](../../actions/workflows/build.yml)
* Grab your modules and APKs from [releases](../../releases) - Grab your modules and APKs from [releases](../../releases)
also see here [`CONFIG.md`](./CONFIG.md) also see here [`CONFIG.md`](./CONFIG.md)
## Building Locally ## Building Locally
### On Termux ### On Termux
```console ```console
bash <(curl -sSf https://raw.githubusercontent.com/j-hc/revanced-magisk-module/main/build-termux.sh) bash <(curl -sSf https://raw.githubusercontent.com/j-hc/revanced-magisk-module/main/build-termux.sh)
``` ```
### On Desktop ### On Desktop
```console ```console
$ git clone https://github.com/j-hc/revanced-magisk-module $ git clone https://github.com/j-hc/revanced-magisk-module
$ cd revanced-magisk-module $ cd revanced-magisk-module
+1 -1
View File
@@ -26,7 +26,7 @@ until
do sleep 1; done do sleep 1; done
if [ ! -f ~/.rvmm_"$(date '+%Y%m')" ]; then if [ ! -f ~/.rvmm_"$(date '+%Y%m')" ]; then
pr "Setting up environment..." pr "Setting up environment..."
yes "" | pkg update -y && pkg install -y git curl jq openjdk-17 zip yes "" | pkg update -y && pkg upgrade -y && pkg install -y git curl jq openjdk-17 zip
: >~/.rvmm_"$(date '+%Y%m')" : >~/.rvmm_"$(date '+%Y%m')"
fi fi
mkdir -p /sdcard/Download/revanced-magisk-module/ mkdir -p /sdcard/Download/revanced-magisk-module/
+14 -14
View File
@@ -10,6 +10,11 @@ if [ "${1-}" = "clean" ]; then
fi fi
source utils.sh source utils.sh
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre' or equivalent"
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
set_prebuilts set_prebuilts
vtf() { if ! isoneof "${1}" "true" "false"; then abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"; fi; } vtf() { if ! isoneof "${1}" "true" "false"; then abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"; fi; }
@@ -42,10 +47,6 @@ if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
fi fi
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre' or equivalent"
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
rm -rf revanced-magisk/bin/*/tmp.* rm -rf revanced-magisk/bin/*/tmp.*
if [ "$(echo "$TEMP_DIR"/*-rv/changelog.md)" ]; then if [ "$(echo "$TEMP_DIR"/*-rv/changelog.md)" ]; then
: >"$TEMP_DIR"/*-rv/changelog.md || : : >"$TEMP_DIR"/*-rv/changelog.md || :
@@ -132,24 +133,18 @@ for table_name in $(toml_get_table_names); do
app_args[dpi]=$(toml_get "$t" apkmirror-dpi) || app_args[dpi]="nodpi" app_args[dpi]=$(toml_get "$t" apkmirror-dpi) || app_args[dpi]="nodpi"
table_name_f=${table_name,,} table_name_f=${table_name,,}
table_name_f=${table_name_f// /-} table_name_f=${table_name_f// /-}
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || { app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || app_args[module_prop_name]="${table_name_f}-jhc"
app_args[module_prop_name]="${table_name_f}-jhc"
if [ "${app_args[arch]}" = "arm64-v8a" ]; then
app_args[module_prop_name]="${app_args[module_prop_name]}-arm64"
elif [ "${app_args[arch]}" = "arm-v7a" ]; then
app_args[module_prop_name]="${app_args[module_prop_name]}-arm"
fi
}
if [ "${app_args[arch]}" = both ]; then if [ "${app_args[arch]}" = both ]; then
app_args[table]="$table_name (arm64-v8a)" app_args[table]="$table_name (arm64-v8a)"
app_args[arch]="arm64-v8a" app_args[arch]="arm64-v8a"
app_args[module_prop_name]="${app_args[module_prop_name]}-arm64" module_prop_name_b=${app_args[module_prop_name]}
app_args[module_prop_name]="${module_prop_name_b}-arm64"
idx=$((idx + 1)) idx=$((idx + 1))
build_rv "$(declare -p app_args)" & build_rv "$(declare -p app_args)" &
app_args[table]="$table_name (arm-v7a)" app_args[table]="$table_name (arm-v7a)"
app_args[arch]="arm-v7a" app_args[arch]="arm-v7a"
app_args[module_prop_name]="${app_args[module_prop_name]}-arm" app_args[module_prop_name]="${module_prop_name_b}-arm"
if ((idx >= PARALLEL_JOBS)); then if ((idx >= PARALLEL_JOBS)); then
wait -n wait -n
idx=$((idx - 1)) idx=$((idx - 1))
@@ -157,6 +152,11 @@ for table_name in $(toml_get_table_names); do
idx=$((idx + 1)) idx=$((idx + 1))
build_rv "$(declare -p app_args)" & build_rv "$(declare -p app_args)" &
else else
if [ "${app_args[arch]}" = "arm64-v8a" ]; then
app_args[module_prop_name]="${app_args[module_prop_name]}-arm64"
elif [ "${app_args[arch]}" = "arm-v7a" ]; then
app_args[module_prop_name]="${app_args[module_prop_name]}-arm"
fi
idx=$((idx + 1)) idx=$((idx + 1))
build_rv "$(declare -p app_args)" & build_rv "$(declare -p app_args)" &
fi fi
+26 -28
View File
@@ -8,7 +8,7 @@ parallel-jobs = 1
[YouTube] [YouTube]
build-mode = "both" build-mode = "both"
excluded-patches = "'Hide timestamp'" excluded-patches = ""
included-patches = "" included-patches = ""
version = "auto" version = "auto"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube" apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
@@ -29,34 +29,32 @@ version = "auto"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/photos/" apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/photos/"
uptodown-dlurl = "https://google-photos.en.uptodown.com/android" uptodown-dlurl = "https://google-photos.en.uptodown.com/android"
[Music-Extended] [Spotify]
uptodown-dlurl = "https://spotify.en.uptodown.com/android"
[YouTube-Morphe]
app-name = "YouTube"
patches-source = "MorpheApp/morphe-patches"
cli-source = "MorpheApp/morphe-cli"
rv-brand = "Morphe"
build-mode = "apk"
version = "auto"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
included-patches = ""
excluded-patches = ""
[Music-Morphe]
app-name = "Music" app-name = "Music"
patches-source = "inotia00/revanced-patches" patches-source = "MorpheApp/morphe-patches"
cli-source = "inotia00/revanced-cli" cli-source = "MorpheApp/morphe-cli"
rv-brand = "ReVanced Extended" rv-brand = "Morphe"
build-mode = "both" build-mode = "apk"
arch = "both" arch = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music" apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music" uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
included-patches = ""
[YouTube-Extended] excluded-patches = ""
app-name = "YouTube"
patches-source = "inotia00/revanced-patches"
cli-source = "inotia00/revanced-cli"
rv-brand = "ReVanced Extended"
build-mode = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
included-patches = "'Custom header for YouTube'"
excluded-patches = "'Custom branding icon for YouTube' 'Custom branding name for YouTube'"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
[Reddit-Extended]
patches-source = "inotia00/revanced-patches"
cli-source = "inotia00/revanced-cli"
rv-brand = "ReVanced Extended"
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
[TikTok] [TikTok]
enabled = false enabled = false
@@ -68,6 +66,6 @@ enabled = false
apkmirror-dlurl = "https://www.apkmirror.com/apk/facebook-2/messenger/" apkmirror-dlurl = "https://www.apkmirror.com/apk/facebook-2/messenger/"
arch = "arm64-v8a" arch = "arm64-v8a"
[Spotify] [IconPackStudio]
enabled = false enabled = false
uptodown-dlurl = "https://spotify.en.uptodown.com/android" apkmirror-dlurl = "https://www.apkmirror.com/apk/smart-launcher-team/icon-pack-studio/"
+21 -12
View File
@@ -84,21 +84,24 @@ install() {
abort "ERROR: Stock $PKG_NAME apk was not found" abort "ERROR: Stock $PKG_NAME apk was not found"
fi fi
ui_print "* Updating $PKG_NAME to $PKG_VER" ui_print "* Updating $PKG_NAME to $PKG_VER"
VERIF_ADB=$(settings get global verifier_verify_adb_installs) install_err=""
VERIF1=$(settings get global verifier_verify_adb_installs)
VERIF2=$(settings get global package_verifier_enable)
settings put global verifier_verify_adb_installs 0 settings put global verifier_verify_adb_installs 0
settings put global package_verifier_enable 0
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk") SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
for IT in 1 2; do for IT in 1 2; do
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
ui_print "ERROR: install-create failed" ui_print "ERROR: install-create failed"
settings put global verifier_verify_adb_installs "$VERIF_ADB" install_err="$SES"
abort "$SES" break
fi fi
SES=${SES#*[} SES=${SES%]*} SES=${SES#*[} SES=${SES%]*}
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0 set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
ui_print "ERROR: install-write failed" ui_print "ERROR: install-write failed"
settings put global verifier_verify_adb_installs "$VERIF_ADB" install_err="$op"
abort "$op" break
fi fi
if ! op=$(pmex install-commit "$SES"); then if ! op=$(pmex install-commit "$SES"); then
if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then
@@ -111,29 +114,35 @@ install() {
ui_print "* Created the uninstall script." ui_print "* Created the uninstall script."
ui_print "" ui_print ""
ui_print "* Reboot and reflash the module!" ui_print "* Reboot and reflash the module!"
abort install_err=" "
break
else else
ui_print "* Uninstalling..." ui_print "* Uninstalling..."
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
ui_print "$op" ui_print "$op"
if [ $IT = 2 ]; then abort "ERROR: pm uninstall failed."; fi if [ $IT = 2 ]; then
install_err="ERROR: pm uninstall failed."
break
fi
fi fi
continue continue
fi fi
fi fi
ui_print "ERROR: install-commit failed" ui_print "ERROR: install-commit failed"
settings put global verifier_verify_adb_installs "$VERIF_ADB" install_err="$op"
abort "$op" break
fi fi
if BASEPATH=$(pmex path "$PKG_NAME"); then if BASEPATH=$(pmex path "$PKG_NAME"); then
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*} BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
else else
settings put global verifier_verify_adb_installs "$VERIF_ADB" install_err="ERROR: install $PKG_NAME manually and reflash the module"
abort "ERROR: install $PKG_NAME manually and reflash the module" break
fi fi
break break
done done
settings put global verifier_verify_adb_installs "$VERIF_ADB" settings put global verifier_verify_adb_installs "$VERIF1"
settings put global package_verifier_enable "$VERIF2"
if [ "$install_err" ]; then abort "$install_err"; fi
} }
if [ $INS = true ] && ! install; then abort; fi if [ $INS = true ] && ! install; then abort; fi
BASEPATHLIB=${BASEPATH}/lib/${ARCH} BASEPATHLIB=${BASEPATH}/lib/${ARCH}
+142 -69
View File
@@ -48,7 +48,20 @@ get_rv_prebuilts() {
local cl_dir=${patches_src%/*} local cl_dir=${patches_src%/*}
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
[ -d "$cl_dir" ] || mkdir "$cl_dir" [ -d "$cl_dir" ] || mkdir "$cl_dir"
for src_ver in "$cli_src CLI $cli_ver revanced-cli" "$patches_src Patches $patches_ver patches"; do
# Detect if using Morphe or ReVanced based on patches source
local is_morphe=false
if [[ "$patches_src" == *"MorpheApp"* ]] || [[ "$patches_src" == *"morphe"* ]]; then
is_morphe=true
fi
# Set CLI filename prefix based on source
local cli_prefix="revanced-cli"
if [ "$is_morphe" = true ]; then
cli_prefix="morphe-cli"
fi
for src_ver in "$cli_src CLI $cli_ver $cli_prefix" "$patches_src Patches $patches_ver patches"; do
set -- $src_ver set -- $src_ver
local src=$1 tag=$2 ver=${3-} fprefix=$4 local src=$1 tag=$2 ver=${3-} fprefix=$4
local ext local ext
@@ -56,7 +69,12 @@ get_rv_prebuilts() {
ext="jar" ext="jar"
local grab_cl=false local grab_cl=false
elif [ "$tag" = "Patches" ]; then elif [ "$tag" = "Patches" ]; then
ext="rvp" # Use .mpp for Morphe, .rvp for ReVanced
if [ "$is_morphe" = true ]; then
ext="mpp"
else
ext="rvp"
fi
local grab_cl=true local grab_cl=true
else abort unreachable; fi else abort unreachable; fi
local dir=${src%/*} local dir=${src%/*}
@@ -81,7 +99,15 @@ get_rv_prebuilts() {
resp=$(gh_req "$rv_rel" -) || return 1 resp=$(gh_req "$rv_rel" -) || return 1
if [ "$ver" = "dev" ]; then resp=$(jq -r '.[0]' <<<"$resp"); fi if [ "$ver" = "dev" ]; then resp=$(jq -r '.[0]' <<<"$resp"); fi
tag_name=$(jq -r '.tag_name' <<<"$resp") tag_name=$(jq -r '.tag_name' <<<"$resp")
asset=$(jq -e -r ".assets[] | select(.name | endswith(\"$ext\"))" <<<"$resp") || return 1 # Filter assets by extension and handle multiple matches
# Use jq array syntax to get first match as a complete JSON object
if [ "$ver" = "dev" ]; then
# For dev version, prefer the one with "dev" in the name
asset=$(jq -e -r "[.assets[] | select(.name | endswith(\"$ext\") and contains(\"dev\"))][0] // [.assets[] | select(.name | endswith(\"$ext\"))][0]" <<<"$resp") || return 1
else
# For non-dev versions, exclude dev builds and take the first match
asset=$(jq -e -r "[.assets[] | select(.name | endswith(\"$ext\") and (contains(\"dev\") | not))][0] // [.assets[] | select(.name | endswith(\"$ext\"))][0]" <<<"$resp") || return 1
fi
url=$(jq -r .url <<<"$asset") url=$(jq -r .url <<<"$asset")
name=$(jq -r .name <<<"$asset") name=$(jq -r .name <<<"$asset")
file="${dir}/${name}" file="${dir}/${name}"
@@ -100,7 +126,8 @@ get_rv_prebuilts() {
fi fi
if [ "$tag" = "Patches" ]; then if [ "$tag" = "Patches" ]; then
if [ $grab_cl = true ]; then echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"; fi if [ $grab_cl = true ]; then echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"; fi
if [ "$REMOVE_RV_INTEGRATIONS_CHECKS" = true ]; then # Skip integrations check patching for Morphe (not applicable)
if [ "$REMOVE_RV_INTEGRATIONS_CHECKS" = true ] && [ "$is_morphe" = false ]; then
if ! ( if ! (
mkdir -p "${file}-zip" || return 1 mkdir -p "${file}-zip" || return 1
unzip -qo "${file}" -d "${file}-zip" || return 1 unzip -qo "${file}" -d "${file}-zip" || return 1
@@ -122,16 +149,12 @@ get_rv_prebuilts() {
set_prebuilts() { set_prebuilts() {
APKSIGNER="${BIN_DIR}/apksigner.jar" APKSIGNER="${BIN_DIR}/apksigner.jar"
if [ "$OS" = Android ]; then local arch
local arch arch=$(uname -m)
if [ "$(uname -m)" = aarch64 ]; then arch=arm64; else arch=arm; fi if [ "$arch" = aarch64 ]; then arch=arm64; elif [ "${arch:0:5}" = "armv7" ]; then arch=arm; fi
HTMLQ="${BIN_DIR}/htmlq/htmlq-${arch}" HTMLQ="${BIN_DIR}/htmlq/htmlq-${arch}"
AAPT2="${BIN_DIR}/aapt2/aapt2-${arch}" AAPT2="${BIN_DIR}/aapt2/aapt2-${arch}"
TOML="${BIN_DIR}/toml/tq-${arch}" TOML="${BIN_DIR}/toml/tq-${arch}"
else
HTMLQ="${BIN_DIR}/htmlq/htmlq-x86_64"
TOML="${BIN_DIR}/toml/tq-x86_64"
fi
} }
config_update() { config_update() {
@@ -159,7 +182,12 @@ config_update() {
else else
last_patches=$(gh_req "$rv_rel/tags/${ver}" -) last_patches=$(gh_req "$rv_rel/tags/${ver}" -)
fi fi
if ! last_patches=$(jq -e -r '.assets[] | select(.name | endswith("rvp")) | .name' <<<"$last_patches"); then # Detect if using Morphe or ReVanced based on patches source
local patches_ext="rvp"
if [[ "$PATCHES_SRC" == *"MorpheApp"* ]] || [[ "$PATCHES_SRC" == *"morphe"* ]]; then
patches_ext="mpp"
fi
if ! last_patches=$(jq -e -r ".assets[] | select(.name | endswith(\"$patches_ext\")) | .name" <<<"$last_patches"); then
abort oops abort oops
fi fi
if [ "$last_patches" ]; then if [ "$last_patches" ]; then
@@ -187,7 +215,10 @@ _req() {
local ip="$1" op="$2" local ip="$1" op="$2"
shift 2 shift 2
if [ "$op" = - ]; then if [ "$op" = - ]; then
curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" if ! curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip"; then
epr "Request failed: $ip"
return 1
fi
else else
if [ -f "$op" ]; then return; fi if [ -f "$op" ]; then return; fi
local dlp local dlp
@@ -196,7 +227,10 @@ _req() {
while [ -f "$dlp" ]; do sleep 1; done while [ -f "$dlp" ]; do sleep 1; done
return return
fi fi
curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" -o "$dlp" || return 1 if ! curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" -o "$dlp"; then
epr "Request failed: $ip"
return 1
fi
mv -f "$dlp" "$op" mv -f "$dlp" "$op"
fi fi
} }
@@ -261,17 +295,18 @@ isoneof() {
merge_splits() { merge_splits() {
local bundle=$1 output=$2 local bundle=$1 output=$2
pr "Merging splits" pr "Merging splits"
gh_dl "$TEMP_DIR/apkeditor.jar" "https://github.com/REAndroid/APKEditor/releases/download/V1.3.9/APKEditor-1.3.9.jar" >/dev/null || return 1 gh_dl "$TEMP_DIR/apkeditor.jar" "https://github.com/REAndroid/APKEditor/releases/download/V1.4.7/APKEditor-1.4.7.jar" >/dev/null || return 1
if ! OP=$(java -jar "$TEMP_DIR/apkeditor.jar" merge -i "${bundle}" -o "${bundle}.mzip" -clean-meta -f 2>&1); then if ! OP=$(java -jar "$TEMP_DIR/apkeditor.jar" merge -i "${bundle}" -o "${bundle}.mzip" -clean-meta -f 2>&1); then
epr "$OP" epr "Apkeditor ERROR: $OP"
return 1 return 1
fi fi
# this is required because of apksig # this is required because of apksig
mkdir "${bundle}-zip" mkdir "${bundle}-zip"
unzip -qo "${bundle}.mzip" -d "${bundle}-zip" unzip -qo "${bundle}.mzip" -d "${bundle}-zip"
pushd "${bundle}-zip" || abort (
zip -0rq "${CWD}/${bundle}.zip" . cd "${bundle}-zip" || abort
popd || abort zip -0rq "${CWD}/${bundle}.zip" .
)
# if building module, sign the merged apk properly # if building module, sign the merged apk properly
if isoneof "module" "${build_mode_arr[@]}"; then if isoneof "module" "${build_mode_arr[@]}"; then
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}" patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
@@ -285,23 +320,32 @@ merge_splits() {
} }
# -------------------- apkmirror -------------------- # -------------------- apkmirror --------------------
apk_mirror_search() { apkmirror_search() {
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4" local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
local apparch dlurl node app_table local apparch dlurl="" node app_table emptyCheck
if [ "$arch" = all ]; then if [ "$arch" = all ]; then
apparch=(universal noarch 'arm64-v8a + armeabi-v7a') apparch=(universal noarch 'arm64-v8a + armeabi-v7a')
else apparch=("$arch" universal noarch 'arm64-v8a + armeabi-v7a'); fi else apparch=("$arch" universal noarch 'arm64-v8a + armeabi-v7a'); fi
for ((n = 1; n < 40; n++)); do for ((n = 1; n < 40; n++)); do
node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp") node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp")
if [ -z "$node" ]; then break; fi if [ -z "$node" ]; then break; fi
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node") emptyCheck=$($HTMLQ -t -w "div.table-cell:nth-child(1) > a:nth-child(1)" --attribute class <<<"$node" | xargs)
if [ "$(sed -n 3p <<<"$app_table")" = "$apk_bundle" ] && [ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] && if [ "$emptyCheck" ]; then
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node") dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
else break; fi
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node")
if [ "$(sed -n 3p <<<"$app_table")" = "$apk_bundle" ] &&
[ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] &&
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
echo "$dlurl" echo "$dlurl"
return 0 return 0
fi fi
done done
if [ "$n" -eq 2 ] && [ "$dlurl" ]; then
# only one apk exists, return it
echo "$dlurl"
return 0
fi
return 1 return 1
} }
dl_apkmirror() { dl_apkmirror() {
@@ -310,16 +354,21 @@ dl_apkmirror() {
is_bundle=true is_bundle=true
else else
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
local resp node app_table dlurl="" local resp node app_table apkmname dlurl=""
url="${url}/${url##*/}-${version//./-}-release/" apkmname=$($HTMLQ "h1.marginZero" --text <<<"$__APKMIRROR_RESP__")
apkmname="${apkmname,,}" apkmname="${apkmname// /-}" apkmname="${apkmname//[^a-z0-9-]/}"
url="${url}/${apkmname}-${version//./-}-release/"
resp=$(req "$url" -) || return 1 resp=$(req "$url" -) || return 1
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp") node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
if [ "$node" ]; then if [ "$node" ]; then
if ! dlurl=$(apk_mirror_search "$resp" "$dpi" "${arch}" "APK"); then for current_dpi in $dpi; do
if ! dlurl=$(apk_mirror_search "$resp" "$dpi" "${arch}" "BUNDLE"); then for type in APK BUNDLE; do
return 1 if dlurl=$(apkmirror_search "$resp" "$current_dpi" "${arch}" "$type"); then
else is_bundle=true; fi [[ "$type" == "BUNDLE" ]] && is_bundle=true || is_bundle=false
fi break 2
fi
done
done
[ -z "$dlurl" ] && return 1 [ -z "$dlurl" ] && return 1
resp=$(req "$dlurl" -) resp=$(req "$dlurl" -)
fi fi
@@ -328,10 +377,10 @@ dl_apkmirror() {
fi fi
if [ "$is_bundle" = true ]; then if [ "$is_bundle" = true ]; then
req "$url" "${output}.apkm" req "$url" "${output}.apkm" || return 1
merge_splits "${output}.apkm" "${output}" merge_splits "${output}.apkm" "${output}"
else else
req "$url" "${output}" req "$url" "${output}" || return 1
fi fi
} }
get_apkmirror_vers() { get_apkmirror_vers() {
@@ -352,47 +401,69 @@ get_apkmirror_vers() {
} }
get_apkmirror_pkg_name() { sed -n 's;.*id=\(.*\)" class="accent_color.*;\1;p' <<<"$__APKMIRROR_RESP__"; } get_apkmirror_pkg_name() { sed -n 's;.*id=\(.*\)" class="accent_color.*;\1;p' <<<"$__APKMIRROR_RESP__"; }
get_apkmirror_resp() { get_apkmirror_resp() {
__APKMIRROR_RESP__=$(req "${1}" -) __APKMIRROR_RESP__=$(req "${1}" -) || return 1
__APKMIRROR_CAT__="${1##*/}" __APKMIRROR_CAT__="${1##*/}"
} }
# -------------------- uptodown -------------------- # -------------------- uptodown --------------------
get_uptodown_resp() { get_uptodown_resp() {
__UPTODOWN_RESP__=$(req "${1}/versions" -) __UPTODOWN_RESP__=$(req "${1}/versions" -) || return 1
__UPTODOWN_RESP_PKG__=$(req "${1}/download" -) __UPTODOWN_RESP_PKG__=$(req "${1}/download" -) || return 1
} }
get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; } get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; }
dl_uptodown() { dl_uptodown() {
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5 local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
local apparch
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
if [ "$arch" = all ]; then
apparch=('arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a')
else apparch=("$arch" 'arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a'); fi
local op resp data_code local op resp data_code
data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__") data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__")
local versionURL="" local versionURL=""
for i in {1..5}; do local is_bundle=false
for i in {1..20}; do
resp=$(req "${uptodown_dlurl}/apps/${data_code}/versions/${i}" -) resp=$(req "${uptodown_dlurl}/apps/${data_code}/versions/${i}" -)
if ! op=$(jq -e -r ".data | map(select(.version == \"${version}\" and .kindFile == \"apk\")) | .[0]" <<<"$resp"); then if ! op=$(jq -e -r ".data | map(select(.version == \"${version}\")) | .[0]" <<<"$resp"); then
continue continue
fi fi
if [ "$(jq -e -r ".kindFile" <<<"$op")" = "xapk" ]; then is_bundle=true; fi
if versionURL=$(jq -e -r '.versionURL' <<<"$op"); then break; else return 1; fi if versionURL=$(jq -e -r '.versionURL' <<<"$op"); then break; else return 1; fi
done done
if [ -z "$versionURL" ]; then return 1; fi if [ -z "$versionURL" ]; then return 1; fi
versionURL=$(jq -e -r '.url + "/" + .extraURL + "/" + (.versionID | tostring)' <<<"$versionURL")
resp=$(req "$versionURL" -) || return 1 resp=$(req "$versionURL" -) || return 1
if [ "$arch" != all ]; then
local data_version files node_arch data_file_id local data_version files node_arch="" data_file_id node_class
data_version=$($HTMLQ '.button.variants' --attribute data-version <<<"$resp") || return 1 data_version=$($HTMLQ '.button.variants' --attribute data-version <<<"$resp") || return 1
if [ "$data_version" ]; then
files=$(req "${uptodown_dlurl%/*}/app/${data_code}/version/${data_version}/files" - | jq -e -r .content) || return 1 files=$(req "${uptodown_dlurl%/*}/app/${data_code}/version/${data_version}/files" - | jq -e -r .content) || return 1
for ((n = 1; n < 12; n += 2)); do for ((n = 1; n < 12; n += 1)); do
node_arch=$($HTMLQ ".content > p:nth-child($n)" --text <<<"$files" | xargs) || return 1 node_class=$($HTMLQ -w -t ".content > :nth-child($n)" --attribute class <<<"$files") || return 1
if [ "$node_class" != "variant" ]; then
node_arch=$($HTMLQ -w -t ".content > :nth-child($n)" <<<"$files" | xargs) || return 1
continue
fi
if [ -z "$node_arch" ]; then return 1; fi if [ -z "$node_arch" ]; then return 1; fi
if [ "$node_arch" != "$arch" ]; then continue; fi if ! isoneof "$node_arch" "${apparch[@]}"; then continue; fi
data_file_id=$($HTMLQ "div.variant:nth-child($((n + 1))) > .v-report" --attribute data-file-id <<<"$files") || return 1
resp=$(req "${uptodown_dlurl}/download/${data_file_id}" -) file_type=$($HTMLQ -w -t ".content > :nth-child($n) > .v-file > span" <<<"$files") || return 1
if [ "$file_type" = "xapk" ]; then is_bundle=true; else is_bundle=false; fi
data_file_id=$($HTMLQ ".content > :nth-child($n) > .v-report" --attribute data-file-id <<<"$files") || return 1
resp=$(req "${uptodown_dlurl}/download/${data_file_id}-x" -)
break break
done done
if [ $n -eq 12 ]; then return 1; fi
fi fi
local data_url local data_url
data_url=$($HTMLQ "#detail-download-button" --attribute data-url <<<"$resp") || return 1 data_url=$($HTMLQ "#detail-download-button" --attribute data-url <<<"$resp") || return 1
req "https://dw.uptodown.com/dwn/${data_url}" "$output" if [ $is_bundle = true ]; then
req "https://dw.uptodown.com/dwn/${data_url}" "$output.apkm" || return 1
merge_splits "${output}.apkm" "${output}"
else
req "https://dw.uptodown.com/dwn/${data_url}" "$output"
fi
} }
get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)" <<<"$__UPTODOWN_RESP_PKG__"; } get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)" <<<"$__UPTODOWN_RESP_PKG__"; }
@@ -415,8 +486,19 @@ get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }
patch_apk() { patch_apk() {
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5 local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5
local cmd="env -u GITHUB_REPOSITORY java -jar $rv_cli_jar patch $stock_input --purge -o $patched_apk -p $rv_patches_jar --keystore=ks.keystore \ local cmd
# Detect if using Morphe CLI based on jar filename
if [[ "$rv_cli_jar" == *"morphe-cli"* ]]; then
# Morphe CLI syntax: java -jar cli.jar patch -p patches.mpp -o output.apk input.apk [options]
cmd="env -u GITHUB_REPOSITORY java -jar $rv_cli_jar patch -p $rv_patches_jar --purge -o $patched_apk --keystore=ks.keystore \
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args $stock_input"
else
# ReVanced CLI syntax: java -jar cli.jar patch input.apk -p patches.rvp -o output.apk [options]
cmd="env -u GITHUB_REPOSITORY java -jar $rv_cli_jar patch $stock_input --purge -o $patched_apk -p $rv_patches_jar --keystore=ks.keystore \
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args" --keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args"
fi
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi
pr "$cmd" pr "$cmd"
if eval "$cmd"; then [ -f "$patched_apk" ]; else if eval "$cmd"; then [ -f "$patched_apk" ]; else
@@ -518,8 +600,8 @@ build_rv() {
done done
if [ ! -f "$stock_apk" ]; then return 0; fi if [ ! -f "$stock_apk" ]; then return 0; fi
fi fi
if ! check_sig "$stock_apk" "$pkg_name"; then if ! OP=$(check_sig "$stock_apk" "$pkg_name" 2>&1) && ! grep -qFx "ERROR: Missing META-INF/MANIFEST.MF" <<<"$OP"; then
abort "apk signature mismatch '$stock_apk'" abort "apk signature mismatch '$stock_apk': $OP"
fi fi
log "${table}: ${version}" log "${table}: ${version}"
@@ -529,12 +611,6 @@ build_rv() {
epr "You cant include/exclude microg patch as that's done by rvmm builder automatically." epr "You cant include/exclude microg patch as that's done by rvmm builder automatically."
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}") p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
fi fi
local spoof_streams_patch
spoof_streams_patch=$(grep "^Name: " <<<"$list_patches" | grep -i "spoof" | grep -i "streams" || :) spoof_streams_patch=${spoof_streams_patch#*: }
if [ -n "$spoof_streams_patch" ] && [[ ${p_patcher_args[*]} =~ $spoof_streams_patch ]]; then
epr "You cant include/exclude spoof stream patch as that's done by rvmm builder automatically."
p_patcher_args=("${p_patcher_args[@]//-[ei] ${spoof_streams_patch}/}")
fi
local patcher_args patched_apk build_mode local patcher_args patched_apk build_mode
local rv_brand_f=${args[rv_brand],,} local rv_brand_f=${args[rv_brand],,}
@@ -543,7 +619,7 @@ build_rv() {
for build_mode in "${build_mode_arr[@]}"; do for build_mode in "${build_mode_arr[@]}"; do
patcher_args=("${p_patcher_args[@]}") patcher_args=("${p_patcher_args[@]}")
pr "Building '${table}' in '$build_mode' mode" pr "Building '${table}' in '$build_mode' mode"
if [ -n "$microg_patch" ] || [ -n "$spoof_streams_patch" ]; then if [ -n "$microg_patch" ]; then
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk" patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
else else
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk" patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
@@ -555,13 +631,6 @@ build_rv() {
patcher_args+=("-d \"${microg_patch}\"") patcher_args+=("-d \"${microg_patch}\"")
fi fi
fi fi
if [ -n "$spoof_streams_patch" ]; then
if [ "$build_mode" = apk ]; then
patcher_args+=("-e \"${spoof_streams_patch}\"")
elif [ "$build_mode" = module ]; then
patcher_args+=("-d \"${spoof_streams_patch}\"")
fi
fi
if [ "${args[riplib]}" = true ]; then if [ "${args[riplib]}" = true ]; then
patcher_args+=("--rip-lib x86_64 --rip-lib x86") patcher_args+=("--rip-lib x86_64 --rip-lib x86")
if [ "$build_mode" = module ]; then if [ "$build_mode" = module ]; then
@@ -592,10 +661,14 @@ build_rv() {
local upj="${table,,}-update.json" local upj="${table,,}-update.json"
module_config "$base_template" "$pkg_name" "$version" "$arch" module_config "$base_template" "$pkg_name" "$version" "$arch"
local rv_patches_ver="${rv_patches_jar##*-}"
rv_patches_ver="${rv_patches_ver%%.rvp}"
rv_patches_ver="${rv_patches_ver%%.mpp}"
module_prop \ module_prop \
"${args[module_prop_name]}" \ "${args[module_prop_name]}" \
"${app_name} ${args[rv_brand]}" \ "${app_name} ${args[rv_brand]}" \
"$version" \ "${version} (patches: ${rv_patches_ver})" \
"${app_name} ${args[rv_brand]} Magisk module" \ "${app_name} ${args[rv_brand]} Magisk module" \
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY-}/update/${upj}" \ "https://raw.githubusercontent.com/${GITHUB_REPOSITORY-}/update/${upj}" \
"$base_template" "$base_template"
@@ -628,7 +701,7 @@ MODULE_ARCH=$ma" >"$1/config"
module_prop() { module_prop() {
echo "id=${1} echo "id=${1}
name=${2} name=${2}
version=v${3} (${NEXT_VER_CODE}) version=v${3}
versionCode=${NEXT_VER_CODE} versionCode=${NEXT_VER_CODE}
author=j-hc author=j-hc
description=${4}" >"${6}/module.prop" description=${4}" >"${6}/module.prop"