generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...n/app/revanced/patches/tiktok/interaction/downloads/annotations/DownloadsCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package app.revanced.patches.tiktok.interaction.downloads.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[ | ||
Package("com.ss.android.ugc.trill", arrayOf()), | ||
Package("com.zhiliaoapp.musically", arrayOf()) | ||
] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class DownloadsCompatibility |
25 changes: 25 additions & 0 deletions
25
...p/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package app.revanced.patches.tiktok.interaction.downloads.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("acl-common-share-get-code") | ||
@MatchingMethod("ACLCommonShare", "getCode") | ||
@DownloadsCompatibility | ||
@Version("0.0.1") | ||
object ACLCommonShareFingerprint : MethodFingerprint( | ||
"I", | ||
AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
null, | ||
null, | ||
null, | ||
{ methodDef -> | ||
methodDef.definingClass.endsWith("/ACLCommonShare;") && | ||
methodDef.name == "getCode" | ||
} | ||
) |
25 changes: 25 additions & 0 deletions
25
.../revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package app.revanced.patches.tiktok.interaction.downloads.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("acl-common-share-get-show-type") | ||
@MatchingMethod("ACLCommonShare", "getShowType") | ||
@DownloadsCompatibility | ||
@Version("0.0.1") | ||
object ACLCommonShareFingerprint2 : MethodFingerprint( | ||
"I", | ||
AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
null, | ||
null, | ||
null, | ||
{ methodDef -> | ||
methodDef.definingClass.endsWith("/ACLCommonShare;") && | ||
methodDef.name == "getShowType" | ||
} | ||
) |
25 changes: 25 additions & 0 deletions
25
.../revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint3.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package app.revanced.patches.tiktok.interaction.downloads.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("acl-common-share-get-transcode") | ||
@MatchingMethod("ACLCommonShare", "getTranscode") | ||
@DownloadsCompatibility | ||
@Version("0.0.1") | ||
object ACLCommonShareFingerprint3 : MethodFingerprint( | ||
"I", | ||
AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
null, | ||
null, | ||
null, | ||
{ methodDef -> | ||
methodDef.definingClass.endsWith("/ACLCommonShare;") && | ||
methodDef.name == "getTranscode" | ||
} | ||
) |
56 changes: 56 additions & 0 deletions
56
src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/patch/DownloadsPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package app.revanced.patches.tiktok.interaction.downloads.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.impl.BytecodeData | ||
import app.revanced.patcher.extensions.replaceInstructions | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.impl.BytecodePatch | ||
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility | ||
import app.revanced.patches.tiktok.interaction.downloads.fingerprints.* | ||
|
||
@Patch | ||
@Name("tiktok-download") | ||
@Description("Remove restrictions on downloads video.") | ||
@DownloadsCompatibility | ||
@Version("0.0.1") | ||
class DownloadsPatch : BytecodePatch( | ||
listOf( | ||
ACLCommonShareFingerprint, | ||
ACLCommonShareFingerprint2, | ||
ACLCommonShareFingerprint3 | ||
) | ||
) { | ||
override fun execute(data: BytecodeData): PatchResult { | ||
val method1 = ACLCommonShareFingerprint.result!!.mutableMethod | ||
method1.replaceInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x0 | ||
return v0 | ||
""" | ||
) | ||
val method2 = ACLCommonShareFingerprint2.result!!.mutableMethod | ||
method2.replaceInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x2 | ||
return v0 | ||
""" | ||
) | ||
//Download videos without watermark. | ||
val method3 = ACLCommonShareFingerprint3.result!!.mutableMethod | ||
method3.replaceInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x1 | ||
return v0 | ||
""" | ||
) | ||
return PatchResultSuccess() | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...otlin/app/revanced/patches/tiktok/interaction/seekbar/annotations/SeekbarCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package app.revanced.patches.tiktok.interaction.seekbar.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[ | ||
Package("com.ss.android.ugc.trill", arrayOf()), | ||
Package("com.zhiliaoapp.musically", arrayOf()) | ||
] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class SeekbarCompatibility |
23 changes: 23 additions & 0 deletions
23
...vanced/patches/tiktok/interaction/seekbar/fingerprints/AwemeGetVideoControlFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app.revanced.patches.tiktok.interaction.seekbar.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("aweme-get-video-control") | ||
@MatchingMethod("Aweme", "getVideoControl") | ||
@SeekbarCompatibility | ||
@Version("0.0.1") | ||
object AwemeGetVideoControlFingerprint : MethodFingerprint( | ||
"L", | ||
AccessFlags.PUBLIC.value, | ||
null, | ||
null, | ||
null, | ||
{ methodDef -> | ||
methodDef.definingClass.endsWith("/Aweme;") && methodDef.name == "getVideoControl" | ||
} | ||
) |
47 changes: 47 additions & 0 deletions
47
src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/patch/TiktokSeekbarPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package app.revanced.patches.tiktok.interaction.seekbar.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.impl.BytecodeData | ||
import app.revanced.patcher.extensions.addInstructions | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultError | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.impl.BytecodePatch | ||
import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility | ||
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.* | ||
import org.jf.dexlib2.Opcode | ||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n | ||
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c | ||
|
||
@Patch | ||
@Name("tiktok-seekbar") | ||
@Description("Show progress bar for all video.") | ||
@SeekbarCompatibility | ||
@Version("0.0.1") | ||
class TiktokSeekbarPatch : BytecodePatch( | ||
listOf( | ||
AwemeGetVideoControlFingerprint | ||
) | ||
) { | ||
override fun execute(data: BytecodeData): PatchResult { | ||
//Get VideoControl FieldReference | ||
val videoControl = data.findClass { it.type.endsWith("/VideoControl;") } | ||
?: return PatchResultError("Can not find target class") | ||
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name } | ||
|
||
val method = AwemeGetVideoControlFingerprint.result!!.mutableMethod | ||
val implementation = method.implementation!! | ||
implementation.addInstructions( | ||
1, listOf( | ||
BuilderInstruction11n(Opcode.CONST_4, 1, 1), | ||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!), | ||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!) | ||
) | ||
) | ||
return PatchResultSuccess() | ||
} | ||
|
||
} |