feat: Merge KettuXposed
- Merge KettuXposed Github - Make better Recovery Menu - Fix 307204+ issues
This commit is contained in:
parent
056d6d81d9
commit
2f2db32e8c
6 changed files with 985 additions and 537 deletions
106
.github/workflows/build.yml
vendored
106
.github/workflows/build.yml
vendored
|
|
@ -1,65 +1,79 @@
|
|||
name: Build APK
|
||||
on: [push]
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
JAVA_VERSION: 17
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and push
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "17"
|
||||
distribution: temurin
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
cache: gradle
|
||||
|
||||
- name: "Grant execution permission"
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v2
|
||||
|
||||
- name: Make Gradle executable
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: "Build APKs"
|
||||
- name: Optional Keystore (if provided)
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.KEYSTORE }}
|
||||
run: |
|
||||
# Retry the Gradle build up to 3 times to mitigate transient cache/service errors
|
||||
ATTEMPT=0
|
||||
until [ $ATTEMPT -ge 3 ]
|
||||
do
|
||||
./gradlew build --no-daemon --stacktrace && break
|
||||
ATTEMPT=$((ATTEMPT+1))
|
||||
echo "Gradle build failed, retrying ($ATTEMPT/3)..."
|
||||
sleep 5
|
||||
done
|
||||
if [ $ATTEMPT -ge 3 ]; then
|
||||
echo "Gradle build failed after 3 attempts"
|
||||
exit 1
|
||||
if [ -n "$KEYSTORE" ]; then
|
||||
echo "$KEYSTORE" | base64 -d > signing-key.jks
|
||||
ls -l signing-key.jks
|
||||
else
|
||||
echo "No keystore provided, skipping..."
|
||||
fi
|
||||
|
||||
- name: "Setup directories"
|
||||
- name: Assemble Debug and Release
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
GRADLE_OPTS: -Dorg.gradle.daemon=false
|
||||
run: |
|
||||
mkdir -p /tmp/ShiggyXposedbuild/apks
|
||||
mkdir -p /tmp/ShiggyXposedbuild/tools
|
||||
if [ -f signing-key.jks ]; then
|
||||
./gradlew assembleDebug assembleRelease \
|
||||
-Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/signing-key.jks \
|
||||
-Pandroid.injected.signing.store.password="$KEYSTORE_PASSWORD" \
|
||||
-Pandroid.injected.signing.key.alias="$KEY_ALIAS" \
|
||||
-Pandroid.injected.signing.key.password="$KEY_PASSWORD"
|
||||
else
|
||||
./gradlew assembleDebug assembleRelease
|
||||
fi
|
||||
|
||||
- name: "Move debug APK"
|
||||
run: mv ./app/build/outputs/apk/debug/app-debug.apk /tmp/ShiggyXposedbuild/apks
|
||||
- name: Collect APKs
|
||||
run: |
|
||||
mkdir -p dist
|
||||
cp app/build/outputs/apk/debug/*.apk dist/ || true
|
||||
# Prefer signed release if produced
|
||||
if ls app/build/outputs/apk/release/*-signed.apk >/dev/null 2>&1; then
|
||||
cp app/build/outputs/apk/release/*-signed.apk dist/
|
||||
else
|
||||
cp app/build/outputs/apk/release/*.apk dist/
|
||||
fi
|
||||
ls -1 dist
|
||||
|
||||
- name: "Download uber-apk-signer"
|
||||
run: wget -nv "https://github.com/patrickfav/uber-apk-signer/releases/download/v1.2.1/uber-apk-signer-1.2.1.jar" -O /tmp/ShiggyXposedbuild/tools/uber-apk-signer.jar
|
||||
|
||||
- name: "Sign release APK"
|
||||
run: java -jar /tmp/ShiggyXposedbuild/tools/uber-apk-signer.jar --apks ./app/build/outputs/apk/release/app-release-unsigned.apk --out /tmp/ShiggyXposedbuild/apks/
|
||||
|
||||
- name: "Rename release APK"
|
||||
run: mv /tmp/ShiggyXposedbuild/apks/app-release-aligned-debugSigned.apk /tmp/ShiggyXposedbuild/apks/app-release.apk
|
||||
|
||||
- name: "Upload debug APK"
|
||||
- name: Upload All APKs
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: app-debug
|
||||
path: /tmp/ShiggyXposedbuild/apks/app-debug.apk
|
||||
|
||||
- name: "Upload release APK"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: app-release
|
||||
path: /tmp/ShiggyXposedbuild/apks/app-release.apk
|
||||
name: apks
|
||||
path: dist/*.apk
|
||||
if-no-files-found: error
|
||||
|
|
|
|||
149
.github/workflows/release.yml
vendored
149
.github/workflows/release.yml
vendored
|
|
@ -1,19 +1,23 @@
|
|||
name: Build Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
versionName:
|
||||
required: true
|
||||
description: This releases version name
|
||||
description: This release's version name
|
||||
default: "1.0.0"
|
||||
versionCode:
|
||||
required: true
|
||||
description: This releases version code
|
||||
description: This release's version code
|
||||
default: "1000"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
JAVA_VERSION: 17
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -23,106 +27,79 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: temurin
|
||||
cache: gradle
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v2.0.10
|
||||
uses: android-actions/setup-android@v2
|
||||
|
||||
- name: Set Version
|
||||
uses: chkfung/android-version-actions@v1.1
|
||||
with:
|
||||
gradlePath: app/build.gradle.kts
|
||||
versionCode: ${{github.event.inputs.versionCode}}
|
||||
versionName: ${{github.event.inputs.versionName}}
|
||||
versionCode: ${{ github.event.inputs.versionCode }}
|
||||
versionName: ${{ github.event.inputs.versionName }}
|
||||
|
||||
- name: Bump Version
|
||||
continue-on-error: true
|
||||
- name: Commit Version Bump (if changed)
|
||||
run: |
|
||||
git config --local user.email "actions@github.com"
|
||||
git config --local user.name "GitHub Actions"
|
||||
git config user.email "actions@github.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git add app/build.gradle.kts
|
||||
if ! git diff --quiet app/build.gradle.kts; then
|
||||
git commit -m "chore: Bump version to ${{github.event.inputs.versionName}} (${{github.event.inputs.versionCode}})"
|
||||
git push
|
||||
if git diff --cached --quiet; then
|
||||
echo "No version change."
|
||||
else
|
||||
echo "No changes to version file, skipping commit"
|
||||
git commit -m "chore: bump version to ${{ github.event.inputs.versionName }} (${{ github.event.inputs.versionCode }})"
|
||||
git push
|
||||
fi
|
||||
|
||||
- name: Build Signed APK
|
||||
- name: Prepare Keystore
|
||||
run: |
|
||||
# Ensure keystore secret is present
|
||||
if [ -z "${{ secrets.keystore }}" ]; then
|
||||
echo "Keystore secret missing, aborting"
|
||||
exit 1
|
||||
fi
|
||||
echo "${{ secrets.KEYSTORE }}" | base64 -d > signing-key.jks
|
||||
ls -l signing-key.jks
|
||||
|
||||
echo "${{ secrets.keystore }}" | base64 -d > $GITHUB_WORKSPACE/signing-key.jks
|
||||
chmod +x ./gradlew
|
||||
|
||||
# Retry gradle up to 3 times to mitigate transient network/cache service issues
|
||||
ATTEMPT=0
|
||||
until [ $ATTEMPT -ge 3 ]
|
||||
do
|
||||
./gradlew packageReleaseUniversalApk \
|
||||
-Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/signing-key.jks \
|
||||
-Pandroid.injected.signing.store.password=${{ secrets.keystore_password }} \
|
||||
-Pandroid.injected.signing.key.alias=${{ secrets.key_alias }} \
|
||||
-Pandroid.injected.signing.key.password=${{ secrets.key_password }} --no-daemon --stacktrace && break
|
||||
|
||||
ATTEMPT=$((ATTEMPT+1))
|
||||
echo "Gradle build failed, retrying ($ATTEMPT/3)..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
if [ $ATTEMPT -ge 3 ]; then
|
||||
echo "Gradle build failed after 3 attempts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Release
|
||||
- name: Build Universal APKs
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
GRADLE_OPTS: -Dorg.gradle.daemon=false
|
||||
run: |
|
||||
set -e
|
||||
echo "Locating built APK(s) under app/build/outputs..."
|
||||
# Find APK files produced by the build in common output locations
|
||||
apk_paths=$(find app/build/outputs -type f -name "*.apk" 2>/dev/null || true)
|
||||
if [ -z "$apk_paths" ]; then
|
||||
echo "ERROR: No APK files found under app/build/outputs"
|
||||
echo "Diagnostics: top-level listing of app/build/outputs:"
|
||||
ls -la app/build/outputs || true
|
||||
echo "Diagnostics: recursive listing (files only):"
|
||||
find app/build/outputs -type f -maxdepth 6 -print || true
|
||||
echo "Failing the job so you can inspect the build logs and diagnostics above."
|
||||
exit 1
|
||||
fi
|
||||
# Prepare a directory to collect APKs for the release
|
||||
mkdir -p release-apks
|
||||
echo "Copying found APK(s) to release-apks/ for upload:"
|
||||
for apk in $apk_paths; do
|
||||
echo " - $apk"
|
||||
cp "$apk" "release-apks/$(basename "$apk")"
|
||||
done
|
||||
# Keep backward compatibility: if exactly one APK found, copy it to the root as app-release.apk
|
||||
apk_count=$(echo "$apk_paths" | wc -w)
|
||||
if [ "$apk_count" -eq 1 ]; then
|
||||
single_apk=$(echo "$apk_paths")
|
||||
cp "$single_apk" ./app-release.apk
|
||||
echo "Single APK copied to ./app-release.apk"
|
||||
else
|
||||
echo "Multiple APKs found ($apk_count). All copied to release-apks/"
|
||||
fi
|
||||
git config --local user.email "actions@github.com"
|
||||
git config --local user.name "GitHub Actions"
|
||||
tag="${{ github.event.inputs.versionCode }}"
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
# Create the GitHub release including all APK(s) we collected (debug + release)
|
||||
gh release create "$tag" \
|
||||
--title "${{ github.event.inputs.versionName }}" \
|
||||
--generate-notes \
|
||||
release-apks/*
|
||||
./gradlew packageDebugUniversalApk packageReleaseUniversalApk \
|
||||
-Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/signing-key.jks \
|
||||
-Pandroid.injected.signing.store.password="$KEYSTORE_PASSWORD" \
|
||||
-Pandroid.injected.signing.key.alias="$KEY_ALIAS" \
|
||||
-Pandroid.injected.signing.key.password="$KEY_PASSWORD"
|
||||
|
||||
- name: Collect APKs
|
||||
run: |
|
||||
mkdir dist
|
||||
mv app/build/outputs/apk_from_bundle/debug/app-debug-universal.apk dist/app-debug.apk
|
||||
mv app/build/outputs/apk_from_bundle/release/app-release-universal.apk dist/app-release.apk
|
||||
ls -l dist
|
||||
|
||||
- name: Upload APK Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-apks
|
||||
path: dist/*.apk
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Create Tag and Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
tag=${{ github.event.inputs.versionCode }}
|
||||
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
|
||||
echo "Tag $tag already exists, skipping creation."
|
||||
else
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
fi
|
||||
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" \
|
||||
--title "${{ github.event.inputs.versionName }}" \
|
||||
--generate-notes \
|
||||
dist/app-debug.apk dist/app-release.apk
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ object HookStateHolder {
|
|||
|
||||
class Main : Module(), IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
private var hooked = false
|
||||
private val modules = mutableListOf<Module>(
|
||||
private val modules = mutableListOf(
|
||||
HookScriptLoaderModule,
|
||||
BridgeModule,
|
||||
AdditionalBridgeMethodsModule,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -142,6 +142,9 @@ object UpdaterModule : Module() {
|
|||
|
||||
fun showErrorDialog(e: Throwable) {
|
||||
val activity = lastActivity?.get() ?: return
|
||||
|
||||
activity.runOnUiThread {
|
||||
}
|
||||
}
|
||||
|
||||
fun resetLoaderConfig(context: Context) {
|
||||
|
|
|
|||
|
|
@ -13,16 +13,8 @@ object BlockCrashReportingModule : Module() {
|
|||
override fun onLoad(packageParam: XC_LoadPackage.LoadPackageParam) = with(packageParam) {
|
||||
val crashReportingClass = classLoader.safeLoadClass("com.discord.crash_reporting.CrashReporting")
|
||||
crashReportingClass?.apply {
|
||||
// Hooking this will result in a crash after a few seconds, since Discord expects initialization to complete when setting a Sentry tag.
|
||||
// So we also hook isDisabled to make sure those calls are no-ops.
|
||||
hookMethod(
|
||||
"init", Context::class.java, String::class.java
|
||||
) {
|
||||
before {
|
||||
Log.i("Blocked CrashReporting initialization")
|
||||
result = null
|
||||
}
|
||||
}
|
||||
|
||||
// This only exists on 30720x and above
|
||||
runCatching {
|
||||
hookMethod("isDisabled") {
|
||||
before {
|
||||
|
|
@ -30,17 +22,29 @@ object BlockCrashReportingModule : Module() {
|
|||
result = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val sentryInitProviderClass = classLoader.safeLoadClass("io.sentry.android.core.SentryInitProvider")
|
||||
sentryInitProviderClass?.hookMethod("onCreate") {
|
||||
before {
|
||||
Log.i("Blocked SentryInitProvider initialization")
|
||||
result = true
|
||||
}.onFailure {
|
||||
// In older versions, this hook works fine.
|
||||
// Hooking this on 30720x will result in a crash after a few seconds,
|
||||
// since Discord asserts initialization when setting a Sentry tag.
|
||||
hookMethod(
|
||||
"init", Context::class.java, String::class.java
|
||||
) {
|
||||
before {
|
||||
Log.i("Blocked CrashReporting initialization")
|
||||
result = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return@with
|
||||
}
|
||||
|
||||
val sentryInitProviderClass = classLoader.safeLoadClass("io.sentry.android.core.SentryInitProvider")
|
||||
sentryInitProviderClass?.hookMethod("onCreate") {
|
||||
before {
|
||||
Log.i("Blocked SentryInitProvider initialization")
|
||||
result = true
|
||||
}
|
||||
}
|
||||
|
||||
return@with
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue