diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e583435..a3ae1adb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,12 +2,9 @@ name: Build on: push: - paths: - - '.github/workflows/build.yml' - - 'app/**' - - 'gradle/**' - - '*.gradle' - - '*.properties' + paths-ignore: + - '*.md' + - '*.txt' pull_request: workflow_dispatch: inputs: @@ -28,6 +25,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + discussions: write steps: - name: Checkout @@ -36,15 +34,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: @@ -55,7 +53,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: @@ -74,14 +72,14 @@ 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 @@ -89,7 +87,7 @@ jobs: 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 @@ -100,43 +98,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 }} diff --git a/.gitignore b/.gitignore index 50a90123..149bafb3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,9 @@ # IntelliJ /.idea/ # Gradle Build -/app/build/ +build/ # Android Studio Signing APK /app/debug/ -/app/release/ \ No newline at end of file +/app/release/ +# VS Code +/.vscode/ diff --git a/HOOK_SAMPLE.md b/HOOK_SAMPLE.md index 0769056e..01c1eab2 100644 --- a/HOOK_SAMPLE.md +++ b/HOOK_SAMPLE.md @@ -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 のみ対応 + + diff --git a/README.md b/README.md index 49305701..72ce3a66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# LIME: Adkiller for LINE +# 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) diff --git a/app/build.gradle b/app/build.gradle index ba759591..64e3a1ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' } diff --git a/app/libxposed/api-100.jar b/app/libxposed/api-100.jar new file mode 100644 index 00000000..ab391453 Binary files /dev/null and b/app/libxposed/api-100.jar differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index ab401ede..c25c22ac 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -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 (...); + public void onPackageLoaded(...); + public void onSystemServerLoaded(...); +} +-keep,allowoptimization,allowobfuscation @io.github.libxposed.api.annotations.* class * { + @io.github.libxposed.api.annotations.BeforeInvocation ; + @io.github.libxposed.api.annotations.AfterInvocation ; +} +-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 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cba57efe..0023ac21 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,19 +1,42 @@  - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/io/github/chipppppppppp/lime/hooks/RedirectWebView.java b/app/src/main/java/io/github/chipppppppppp/lime/hooks/RedirectWebView.java index 1e5974d2..463cede9 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/hooks/RedirectWebView.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/hooks/RedirectWebView.java @@ -30,10 +30,25 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { WebView webView = findWebView(rootView); if (webView != null) { + String currentUrl = webView.getUrl(); + + if (currentUrl != null && ( + currentUrl.startsWith("https://account-center.lylink.yahoo.co.jp") || + currentUrl.startsWith("https://access.line.me") || + currentUrl.startsWith("https://id.lylink.yahoo.co.jp/federation/ly/normal/callback/first") || + currentUrl.startsWith("https://liff.line.me") || + currentUrl.startsWith("https://lin.ee") || + currentUrl.startsWith("https://line.me/R/") || + currentUrl.startsWith("line://") + ) + ) { + return; + } + webView.setVisibility(View.GONE); webView.stopLoading(); - Uri uri = Uri.parse(webView.getUrl()); + Uri uri = Uri.parse(currentUrl); if (limeOptions.openInBrowser.checked) { Intent intent = new Intent(Intent.ACTION_VIEW); @@ -48,7 +63,6 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } activity.finish(); - } } } diff --git a/app/src/main/resources/META-INF/xposed/java_init.list b/app/src/main/resources/META-INF/xposed/java_init.list new file mode 100644 index 00000000..493c26d9 --- /dev/null +++ b/app/src/main/resources/META-INF/xposed/java_init.list @@ -0,0 +1 @@ +io.github.chipppppppppp.lime.Main diff --git a/app/src/main/resources/META-INF/xposed/module.prop b/app/src/main/resources/META-INF/xposed/module.prop new file mode 100644 index 00000000..8dc7ff35 --- /dev/null +++ b/app/src/main/resources/META-INF/xposed/module.prop @@ -0,0 +1,3 @@ +minApiVersion=100 +targetApiVersion=100 +staticScope=true diff --git a/app/src/main/resources/META-INF/xposed/scope.list b/app/src/main/resources/META-INF/xposed/scope.list new file mode 100644 index 00000000..44ee4cb2 --- /dev/null +++ b/app/src/main/resources/META-INF/xposed/scope.list @@ -0,0 +1 @@ +jp.naver.line.android diff --git a/gradle.properties b/gradle.properties index 31879242..6eb56fdb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 24302b7b..83518587 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,7 +4,7 @@ pluginManagement { mavenCentral() } plugins { - id 'com.android.application' version '8.6.1' apply false + id 'com.android.application' version '8.7.2' apply false } } dependencyResolutionManagement { @@ -12,6 +12,11 @@ dependencyResolutionManagement { google() mavenCentral() maven { url = "https://api.xposed.info" } + mavenLocal { + content { + includeGroup("io.github.libxposed") + } + } } }