Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libxposed に対応 #207

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 52 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ name: Build

on:
push:
paths:
- '.github/workflows/build.yml'
- 'app/**'
- 'gradle/**'
- '*.gradle'
- '*.properties'
paths-ignore:
- '*.md'
- '*.txt'
tags-ignore:
- '*'
pull_request:
workflow_dispatch:
inputs:
Expand All @@ -28,6 +27,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:

- name: Checkout
Expand All @@ -36,15 +36,15 @@ jobs:
- name: Set environments
run: |
{
echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "line_ver_code=$(grep HOOK_TARGET_VERSION app/build.gradle | awk '{print $4}' | tr -d \'\")"
echo "packageId=$(grep namespace app/build.gradle | awk '{print $2}' | tr -d \')"
echo "versionName=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "versionCode=$(grep versionCode app/build.gradle | awk '{print $2}')"
echo "LINE_versionName=$(echo '${{ env.line_ver_code }}' | awk '{print substr($0,1,2)"."substr($0,3,2)"."int(substr($0,5,1))}')"
echo "LINE_versionCode=$(grep HOOK_TARGET_VERSION app/build.gradle | awk '{print $4}' | tr -d \'\")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})"
} >> $GITHUB_ENV

- name: Set LINE Original Version Name
run: echo "line_ver=$(echo '${{ env.line_ver_code }}' | awk '{print substr($0,1,2)"."substr($0,3,2)"."int(substr($0,5,1))}')" >> $GITHUB_ENV

- name: Setup Java
uses: actions/setup-java@v4
with:
Expand All @@ -55,7 +55,7 @@ jobs:
uses: gradle/actions/setup-gradle@v4

- name: Get previous version name
uses: oprypin/find-latest-tag@v1.1.2
uses: oprypin/find-latest-tag@v1
if: github.event.inputs.release == 'true'
id: previous
with:
Expand All @@ -74,22 +74,22 @@ jobs:
echo ""
exit 1
fi
if [ "${{ steps.previous.outputs.tag }}" == "${{ env.version }}" ]; then
if [ "${{ steps.previous.outputs.tag }}" == "${{ env.versionName }}" ]; then
echo -e "\nERROR!\nThe same tag already exists!\n"
echo "Please change versionName in build.gradle"
echo ""
exit 1
fi

- name: Build with Gradle
- name: Build module
run: |
if [ "${{ inputs.release }}" == "true" ]; then
echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks
export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}"
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}"
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}"
./gradlew assembleRelease --no-daemon --stacktrace
cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.version }}.apk
cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.versionName }}.apk
else
./gradlew assembleDebug --no-daemon --stacktrace
fi
Expand All @@ -100,43 +100,67 @@ jobs:
cat << EOF > conf
https://github.com/JingMatrix/LSPatch/releases/latest/download/lspatch.jar
out=lspatch.jar
https://line-android-universal-download.line-scdn.net/line-${{ env.line_ver }}.apk
out=line-${{ env.line_ver }}.apk
https://line-android-universal-download.line-scdn.net/line-${{ env.LINE_versionName }}.apk
out=line-${{ env.LINE_versionName }}.apk
EOF
echo "Downloading APK..."
aria2c --no-conf -x16 -s16 -R -m0 -V --async-dns=false -iconf
echo "Patching LIME..."
java -jar lspatch.jar "line-${{ env.line_ver }}.apk" -m "app/build/outputs/apk/debug/app-debug.apk" -l 2 -v
java -jar lspatch.jar "line-${{ env.LINE_versionName }}.apk" -m "app/build/outputs/apk/debug/app-debug.apk" -l 2 -v

- name: Upload Module APK
- name: Upload module
uses: actions/upload-artifact@v4
if: github.event.inputs.release != 'true'
with:
name: ${{ env.repo }}-${{ env.version }}@${{ env.commit }}
name: ${{ env.repo }}-${{ env.versionName }}@${{ env.commit }}
path: app/build/outputs/apk/debug/app-debug.apk
if-no-files-found: error

- name: Upload Patched LINE APK
- name: Upload patched APK
uses: actions/upload-artifact@v4
if: github.event.inputs.lspatch == 'true'
with:
name: LINE-${{ env.line_ver }}@${{ env.commit }}
path: line-${{ env.line_ver }}-*-lspatched.apk
name: LINE-${{ env.LINE_versionName }}@${{ env.commit }}
path: line-${{ env.LINE_versionName }}-*-lspatched.apk
if-no-files-found: error

- name: Release
- name: Release original repository
uses: softprops/action-gh-release@v2
if: github.event.inputs.release == 'true'
with:
tag_name: ${{ env.version }}
tag_name: ${{ env.versionName }}
draft: false
prerelease: false
files: ${{ env.repo }}-${{ env.version }}.apk
make_latest: true
discussion_category_name: Announcements
generate_release_notes: true
files: ${{ env.repo }}-${{ env.versionName }}.apk
fail_on_unmatched_files: true
body: |
# 更新内容

## 対応するLINEのバージョン
${{ env.line_ver }}
${{ env.LINE_versionName }}

### 差分
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.version }}
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.versionName }}

- name: Release to Xposed repository
uses: softprops/action-gh-release@v2
if: github.event.inputs.release == 'true'
with:
repository: Xposed-Modules-Repo/${{ env.packageId }}
tag_name: ${{ env.versionCode }}-${{ env.versionName }}
draft: false
prerelease: false
make_latest: true
files: ${{ env.repo }}-${{ env.versionName }}.apk
body: |
## Details
https://github.com/${{ github.repository }}/releases/${{ env.versionName }}

## Supported LINE version
${{ env.LINE_versionName }}

### Diff
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.versionName }}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# IntelliJ
/.idea/
# Gradle Build
/app/build/
build/
# Android Studio Signing APK
/app/debug/
/app/release/
/app/release/
# VS Code
/.vscode/
4 changes: 3 additions & 1 deletion HOOK_SAMPLE.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
https://telegra.ph/%E9%80%9A%E4%BF%A1%E3%81%AE%E6%94%B9%E5%A4%89%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB-06-09
v1.9.2 のみ対応

<https://telegra.ph/%E9%80%9A%E4%BF%A1%E3%81%AE%E6%94%B9%E5%A4%89%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB-06-09>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img src="app/src/main/ic_launcher-playstore.png" width="60px"> LIME: Adkiller for LINE
# <img src="app/src/main/ic_launcher-playstore.png" width="60px"> LIME: Ad-killer for LINE

[![Latest Release](https://img.shields.io/github/v/release/Chipppppppppp/LIME?label=latest)](https://github.com/Chipppppppppp/LIME/releases/latest)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
Expand Down
8 changes: 7 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ android {
aaptOptions {
additionalParameters '--allow-reserved-package-id', '--package-id', '0x64'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}

dependencies {
compileOnly 'de.robv.android.xposed:api:82'
compileOnly files('libxposed/api-100.jar')
//noinspection GradleCompatible
implementation 'com.android.support:customtabs:23.0.0'
compileOnly 'de.robv.android.xposed:api:82'
implementation 'org.mozilla:rhino:1.7.15'
}

Expand Down
Binary file added app/libxposed/api-100.jar
Binary file not shown.
29 changes: 28 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
-keep class io.github.chipppppppppp.lime.Main
-ignorewarnings

# Xposed
-adaptresourcefilecontents META-INF/xposed/java_init.list
-keepattributes RuntimeVisibleAnnotations

-keep,allowobfuscation,allowoptimization public class * extends io.github.libxposed.api.XposedModule {
public <init>(...);
public void onPackageLoaded(...);
public void onSystemServerLoaded(...);
}
-keep,allowoptimization,allowobfuscation @io.github.libxposed.api.annotations.* class * {
@io.github.libxposed.api.annotations.BeforeInvocation <methods>;
@io.github.libxposed.api.annotations.AfterInvocation <methods>;
}
-keep,allowshrinking,allowoptimization,allowobfuscation class ** implements io.github.libxposed.api.XposedInterface$Hooker
-keepclassmembers,allowoptimization class ** implements io.github.libxposed.api.XposedInterface$Hooker {
public *** before(***);
public *** after(***);
public static *** before();
public static *** before(io.github.libxposed.api.XposedInterface$BeforeHookCallback);
public static void after();
public static void after(io.github.libxposed.api.XposedInterface$AfterHookCallback);
public static void after(io.github.libxposed.api.XposedInterface$AfterHookCallback, ***);
}

# Obfuscation
-repackageclasses
-allowaccessmodification
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
android:label="@string/app_name"
android:description="@string/xposed_desc">

<activity
android:name=".MainActivity"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/resources/META-INF/xposed/java_init.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.github.chipppppppppp.lime.Main
3 changes: 3 additions & 0 deletions app/src/main/resources/META-INF/xposed/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minApiVersion=100
targetApiVersion=100
staticScope=true
1 change: 1 addition & 0 deletions app/src/main/resources/META-INF/xposed/scope.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jp.naver.line.android
19 changes: 6 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.nonFinalResIds=false
android.enableR8.fullMode=true
android.experimental.enableNewResourceShrinker=true
android.experimental.enableNewResourceShrinker.preciseShrinking=true
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
7 changes: 6 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ pluginManagement {
mavenCentral()
}
plugins {
id 'com.android.application' version '8.6.1' apply false
id 'com.android.application' version '8.7.2' apply false
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = "https://api.xposed.info" }
mavenLocal {
content {
includeGroup("io.github.libxposed")
}
}
}
}

Expand Down