-
Notifications
You must be signed in to change notification settings - Fork 44
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
291 changed files
with
3,914 additions
and
2,054 deletions.
There are no files selected for viewing
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
6 changes: 6 additions & 0 deletions
6
...otlin/app/revanced/patches/music/misc/alternativedomain/AlternativeDomainBytecodePatch.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,6 @@ | ||
package app.revanced.patches.music.misc.alternativedomain | ||
|
||
import app.revanced.patches.shared.alternativedomain.BaseAlternativeDomainPatch | ||
import app.revanced.patches.music.utils.integrations.Constants.MISC_PATH | ||
|
||
object AlternativeDomainBytecodePatch : BaseAlternativeDomainPatch("$MISC_PATH/AlternativeDomainPatch;") |
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/app/revanced/patches/music/misc/alternativedomain/AlternativeDomainPatch.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,35 @@ | ||
package app.revanced.patches.music.misc.alternativedomain | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE | ||
import app.revanced.patches.music.utils.settings.CategoryType | ||
import app.revanced.patches.music.utils.settings.SettingsPatch | ||
import app.revanced.util.patch.BaseBytecodePatch | ||
import java.io.Closeable | ||
|
||
@Suppress("unused") | ||
object AlternativeDomainPatch : BaseBytecodePatch( | ||
name = "Alternative domain", | ||
description = "Adds options to replace static images(avatars, playlist covers, etc.) domain.", | ||
dependencies = setOf( | ||
AlternativeDomainBytecodePatch::class, | ||
SettingsPatch::class | ||
), | ||
compatiblePackages = COMPATIBLE_PACKAGE | ||
), Closeable { | ||
override fun execute(context: BytecodeContext) { | ||
} | ||
// Use Closeable for lexicographic arrangement of settings. | ||
override fun close() { | ||
SettingsPatch.addSwitchPreference( | ||
CategoryType.MISC, | ||
"revanced_use_alternative_domain", | ||
"false" | ||
) | ||
SettingsPatch.addPreferenceWithIntent( | ||
CategoryType.MISC, | ||
"revanced_alternative_domain", | ||
"revanced_use_alternative_domain" | ||
) | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/app/revanced/patches/shared/alternativedomain/BaseAlternativeDomainPatch.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,30 @@ | ||
package app.revanced.patches.shared.alternativedomain | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patches.shared.alternativedomain.fingerprints.MessageDigestImageUrlFingerprint | ||
import app.revanced.patches.shared.alternativedomain.fingerprints.MessageDigestImageUrlParentFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
abstract class BaseAlternativeDomainPatch( | ||
private val classDescriptor: String | ||
) : BytecodePatch( | ||
setOf(MessageDigestImageUrlParentFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
|
||
MessageDigestImageUrlFingerprint.resolve( | ||
context, | ||
MessageDigestImageUrlParentFingerprint.resultOrThrow().classDef | ||
) | ||
|
||
MessageDigestImageUrlFingerprint.resultOrThrow().mutableMethod.addInstructions( | ||
0, """ | ||
invoke-static { p1 }, $classDescriptor->overrideImageURL(Ljava/lang/String;)Ljava/lang/String; | ||
move-result-object p1 | ||
""" | ||
) | ||
|
||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...rints/MessageDigestImageUrlFingerprint.kt → ...rints/MessageDigestImageUrlFingerprint.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
2 changes: 1 addition & 1 deletion
2
...MessageDigestImageUrlParentFingerprint.kt → ...MessageDigestImageUrlParentFingerprint.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
6 changes: 6 additions & 0 deletions
6
.../revanced/patches/youtube/alternativethumbnails/general/AlternativeDomainBytecodePatch.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,6 @@ | ||
package app.revanced.patches.youtube.alternativethumbnails.general | ||
|
||
import app.revanced.patches.shared.alternativedomain.BaseAlternativeDomainPatch | ||
import app.revanced.patches.youtube.utils.integrations.Constants.ALTERNATIVE_THUMBNAILS_CLASS_DESCRIPTOR | ||
|
||
object AlternativeDomainBytecodePatch : BaseAlternativeDomainPatch(ALTERNATIVE_THUMBNAILS_CLASS_DESCRIPTOR) |
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
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
Oops, something went wrong.