Switch to aliuhook

This commit is contained in:
zt64 2022-03-25 22:34:06 -04:00
parent 9e21504b21
commit 24be649079
21 changed files with 20 additions and 165 deletions

View file

@ -0,0 +1,3 @@
**/liblsplant.so Copyright 2022 LSPosed <https://lsposed.org>, LGPL3.0, see https://www.gnu.org/licenses/lgpl-3.0.en.html
See https://github.com/Aliucord/hook

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,46 +0,0 @@
Copyright (c) canyie
"Anti 996" License Version 1.0 (Draft)
Permission is hereby granted to any individual or legal entity
obtaining a copy of this licensed work (including the source code,
documentation and/or related items, hereinafter collectively referred
to as the "licensed work"), free of charge, to deal with the licensed
work for any purpose, including without limitation, the rights to use,
reproduce, modify, prepare derivative works of, distribute, publish
and sublicense the licensed work, subject to the following conditions:
1. The individual or the legal entity must conspicuously display,
without modification, this License and the notice on each redistributed
or derivative copy of the Licensed Work.
2. The individual or the legal entity must strictly comply with all
applicable laws, regulations, rules and standards of the jurisdiction
relating to labor and employment where the individual is physically
located or where the individual was born or naturalized; or where the
legal entity is registered or is operating (whichever is stricter). In
case that the jurisdiction has no such laws, regulations, rules and
standards or its laws, regulations, rules and standards are
unenforceable, the individual or the legal entity are required to
comply with Core International Labor Standards.
3. The individual or the legal entity shall not induce, suggest or force
its employee(s), whether full-time or part-time, or its independent
contractor(s), in any methods, to agree in oral or written form, to
directly or indirectly restrict, weaken or relinquish his or her
rights or remedies under such laws, regulations, rules and standards
relating to labor and employment as mentioned above, no matter whether
such written or oral agreements are enforceable under the laws of the
said jurisdiction, nor shall such individual or the legal entity
limit, in any methods, the rights of its employee(s) or independent
contractor(s) from reporting or complaining to the copyright holder or
relevant authorities monitoring the compliance of the license about
its violation(s) of the said license.
THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE
LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.

View file

@ -1,8 +0,0 @@
# Pine
https://github.com/canyie/pine
classes.dex is pine-core 0.2.5 and pine-xposed 0.0.8 merged
### Building from source
Use [the script](make_artifacts.sh) or read it and do the steps manually

Binary file not shown.

View file

@ -1,100 +0,0 @@
#!/bin/sh
# Simple script to compile all the required files for pine
# - Prompts you for Aliucord & pine dir
# - Compiles pine core and xposed
# - Merges core and xposed classes into one jar
# - Compiles the jar to DEX bytecode via d8
# - Copies classes.jar to Aliucord/.assets
# - Copies libpine.so builds and the compiled classes.dex to the Aliucord/installer/.../assets
set -e
RED="\033[0;31m"
YELLOW="\033[0;33m"
RESET="\033[0m"
# Usage: message...
die() {
printf "$RED%s$RESET\n" "$*"
exit 1
} >&2
# Usage: message...
log() {
echo
printf "$YELLOW%s$RESET" "$*"
echo
sleep .3
}
# Usage: OutVariableName FolderName expectedChildren...
prompt_folder() {
varname="$1"
shift
log "Please specify the $1 directory. You may use a relative path or even . "
printf "> "
read -r response
case "$response" in
~*) response="$HOME/$(printf "%s" "$response" | cut -c 2-)" ;;
esac
dir="$(realpath "$response")"
shift
for file in "$@"; do
[ -e "$dir/$file" ] || die "$dir/$file doesn't exist. Are you sure you specified the correct directory?"
done
eval "$varname=$dir"
}
ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}"
[ -d "$ANDROID_HOME" ] || die "Android SDK not found. Please set ANDROID_HOME and try again."
BUILD_TOOLS="$(find "$ANDROID_HOME/build-tools" -maxdepth 1 | sort | tail -n 1)"
[ -x "$BUILD_TOOLS/d8" ] || die "Couldn't find your buildtools. Make sure ANDROID_HOME is correct"
for dep in zip unzip; do
command -v "$dep" >/dev/null || die "$dep not found. Please install it then try again"
done
prompt_folder PINE Pine core xposed gradlew
echo
prompt_folder ALIUCORD Aliucord installer .assets
(
cd "$PINE"
chmod +x gradlew
log "Assembling Pine Core"
./gradlew core:assemble
log "Assembling Pine Xposed"
./gradlew xposed:assemble
CORE="$(mktemp -d)"
XPOSED="$(mktemp -d)"
CLASSES="$(mktemp -d)"
log "Extracting Pine Core & Xposed builds"
unzip core/build/outputs/aar/core-release.aar -d "$CORE"
unzip xposed/build/outputs/aar/xposed-release.aar -d "$XPOSED"
log "Merging Pine Core & Xposed classes"
cd "$CLASSES"
unzip "$CORE/classes.jar"
unzip "$XPOSED/classes.jar"
zip -r classes.jar -- *
log "Compiling to DEX bytecode"
"$BUILD_TOOLS/d8" classes.jar
log "Copying files to Aliucord assets dir"
PINE_ASSETS="$ALIUCORD/installer/android/app/src/main/assets/pine"
cp classes.dex "$PINE_ASSETS"
cp classes.jar "$ALIUCORD/.assets/pine.jar"
for dir in "$CORE/jni/"*; do
outdir="$PINE_ASSETS/$(basename "$dir")"
mkdir -p "$outdir"
cp "$dir/libpine.so" "$outdir"
done
log "Done! Successfully built and copied all pine artifacts to the installer assets."
)

View file

@ -91,8 +91,8 @@ fun InstallerScreen(navigator: DestinationsNavigator, apk: File?) {
val cacheDir = context.cacheDir.absolutePath
if (!patched) (1..3).forEach { i ->
openEntry("classes" + (if (i == 1) "" else i) + ".dex")
extractEntry(cacheDir + "/classes" + (i + 1) + ".dex")
openEntry("classes${if (i == 1) "" else i}.dex")
extractEntry("$cacheDir/classes${i + 1}.dex")
closeEntry()
}
@ -106,18 +106,21 @@ fun InstallerScreen(navigator: DestinationsNavigator, apk: File?) {
val assetManager = context.assets
with(Zip(outputApk.absolutePath, 6, 'a')) {
if (!patched) {
(1..3).forEach { i -> deleteEntry("classes${if (i == 1) "" else i}.dex") }
} else {
if (patched) {
deleteEntry("classes.dex")
deleteEntry("classes5.dex")
deleteEntry("classes6.dex")
} else {
(1..3).forEach { i -> deleteEntry("classes${if (i == 1) "" else i}.dex") }
}
deleteEntry("AndroidManifest.xml")
deleteEntry("lib/arm64-v8a/libpine.so")
deleteEntry("lib/armeabi-v7a/libpine.so")
listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64").forEach { arch ->
listOf("/libaliuhook.so", "/liblsplant.so", "/libc++_shared.so").forEach { file ->
deleteEntry("lib/$arch$file")
}
}
if (!patched) for (i in 2..4) {
val name = "classes$i.dex"
@ -133,10 +136,13 @@ fun InstallerScreen(navigator: DestinationsNavigator, apk: File?) {
compressFile(injector.absolutePath)
closeEntry()
writeEntry("classes5.dex", assetManager.open("pine/classes.dex"))
writeEntry("classes5.dex", assetManager.open("aliuhook/classes.dex"))
writeEntry("lib/arm64-v8a/libpine.so", assetManager.open("pine/arm64-v8a/libpine.so"))
writeEntry("lib/armeabi-v7a/libpine.so", assetManager.open("pine/armeabi-v7a/libpine.so"))
listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64").forEach { arch ->
listOf("/libaliuhook.so", "/liblsplant.so", "/libc++_shared.so").forEach { file ->
writeEntry("lib/$arch$file", assetManager.open("aliuhook/$arch$file"))
}
}
writeEntry("classes6.dex", assetManager.open("kotlin/classes.dex"))