forked from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tiktok):
tiktok-web-login
patch (ReVanced#593)
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...app/revanced/patches/tiktok/misc/loginfallback/annotations/TikTokWebLoginCompatibility.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.misc.loginfallback.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[ | ||
Package("com.ss.android.ugc.trill"), | ||
Package("com.zhiliaoapp.musically") | ||
] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class TikTokWebLoginCompatibility |
20 changes: 20 additions & 0 deletions
20
...revanced/patches/tiktok/misc/loginfallback/fingerprints/GoogleAuthAvailableFingerprint.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,20 @@ | ||
package app.revanced.patches.tiktok.misc.loginfallback.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.impl.MethodFingerprint | ||
import app.revanced.patches.tiktok.misc.loginfallback.annotations.TikTokWebLoginCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("google-one-tap-auth-available-fingerprint") | ||
@TikTokWebLoginCompatibility | ||
@Version("0.0.1") | ||
object GoogleAuthAvailableFingerprint : MethodFingerprint( | ||
returnType = "Z", | ||
access = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = listOf(), | ||
customFingerprint = { methodDef -> | ||
methodDef.definingClass == "Lcom/bytedance/lobby/google/GoogleAuth;" | ||
} | ||
) |
20 changes: 20 additions & 0 deletions
20
...ed/patches/tiktok/misc/loginfallback/fingerprints/GoogleOneTapAuthAvailableFingerprint.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,20 @@ | ||
package app.revanced.patches.tiktok.misc.loginfallback.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.impl.MethodFingerprint | ||
import app.revanced.patches.tiktok.misc.loginfallback.annotations.TikTokWebLoginCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("google-one-tap-auth-available-fingerprint") | ||
@TikTokWebLoginCompatibility | ||
@Version("0.0.1") | ||
object GoogleOneTapAuthAvailableFingerprint : MethodFingerprint( | ||
returnType = "Z", | ||
access = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = listOf(), | ||
customFingerprint = { methodDef -> | ||
methodDef.definingClass == "Lcom/bytedance/lobby/google/GoogleOneTapAuth;" | ||
} | ||
) |
44 changes: 44 additions & 0 deletions
44
...n/kotlin/app/revanced/patches/tiktok/misc/loginfallback/patch/TikTokLoginFallbackPatch.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,44 @@ | ||
package app.revanced.patches.tiktok.misc.loginfallback.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patches.tiktok.misc.loginfallback.annotations.TikTokWebLoginCompatibility | ||
import app.revanced.patches.tiktok.misc.loginfallback.fingerprints.GoogleAuthAvailableFingerprint | ||
import app.revanced.patches.tiktok.misc.loginfallback.fingerprints.GoogleOneTapAuthAvailableFingerprint | ||
|
||
@Patch | ||
@Name("tiktok-web-login") | ||
@Description("Allows logging in with a Google account.") | ||
@TikTokWebLoginCompatibility | ||
@Version("0.0.1") | ||
class TikTokLoginFallbackPatch : BytecodePatch( | ||
listOf( | ||
GoogleOneTapAuthAvailableFingerprint, | ||
GoogleAuthAvailableFingerprint | ||
) | ||
) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
listOf( | ||
GoogleOneTapAuthAvailableFingerprint, | ||
GoogleAuthAvailableFingerprint | ||
).forEach { | ||
with(it.result!!.mutableMethod) { | ||
addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x0 | ||
return v0 | ||
""" | ||
) | ||
} | ||
} | ||
return PatchResultSuccess() | ||
} | ||
} |