mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-17 16:23:56 +00:00
Compare commits
4 Commits
v5.42.0-de
...
v5.42.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe16433f20 | ||
|
|
2154d89242 | ||
|
|
277a8b6b47 | ||
|
|
20c413120b |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
||||
# [5.42.0-dev.15](https://github.com/ReVanced/revanced-patches/compare/v5.42.0-dev.14...v5.42.0-dev.15) (2025-10-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Instagram:** Add `Enable developer menu` patch ([#6043](https://github.com/ReVanced/revanced-patches/issues/6043)) ([2154d89](https://github.com/ReVanced/revanced-patches/commit/2154d89242fd8d7f7460145d5d35a4f1986944a3))
|
||||
|
||||
# [5.42.0-dev.14](https://github.com/ReVanced/revanced-patches/compare/v5.42.0-dev.13...v5.42.0-dev.14) (2025-10-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Instagram:** Add `Custom share domain` patch ([#5998](https://github.com/ReVanced/revanced-patches/issues/5998)) ([20c4131](https://github.com/ReVanced/revanced-patches/commit/20c413120bad97af6121718e76b22a1b5540aa44))
|
||||
|
||||
# [5.42.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v5.42.0-dev.12...v5.42.0-dev.13) (2025-10-07)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package app.revanced.extension.instagram.misc.share.domain;
|
||||
|
||||
import android.net.Uri;
|
||||
import app.revanced.extension.shared.Logger;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class ChangeLinkSharingDomainPatch {
|
||||
|
||||
private static String getCustomShareDomain() {
|
||||
// Method is modified during patching.
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static String setCustomShareDomain(String url) {
|
||||
try {
|
||||
Uri uri = Uri.parse(url);
|
||||
Uri.Builder builder = uri
|
||||
.buildUpon()
|
||||
.authority(getCustomShareDomain())
|
||||
.clearQuery();
|
||||
|
||||
String patchedUrl = builder.build().toString();
|
||||
Logger.printInfo(() -> "Domain change from : " + url + " to: " + patchedUrl);
|
||||
return patchedUrl;
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "setCustomShareDomain failure with " + url, ex);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.revanced.extension.instagram.misc.share.privacy;
|
||||
|
||||
import app.revanced.extension.shared.privacy.LinkSanitizer;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class SanitizeSharingLinksPatch {
|
||||
private static final LinkSanitizer sanitizer = new LinkSanitizer("igsh");
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static String sanitizeSharingLink(String url) {
|
||||
return sanitizer.sanitizeUrlString(url);
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
|
||||
org.gradle.parallel = true
|
||||
android.useAndroidX = true
|
||||
kotlin.code.style = official
|
||||
version = 5.42.0-dev.13
|
||||
version = 5.42.0-dev.15
|
||||
|
||||
@@ -280,6 +280,10 @@ public final class app/revanced/patches/instagram/hide/stories/HideStoriesKt {
|
||||
public static final fun getHideStoriesPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatchKt {
|
||||
public static final fun getEnableDeveloperMenuPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/misc/extension/SharedExtensionPatchKt {
|
||||
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
@@ -292,6 +296,14 @@ public final class app/revanced/patches/instagram/misc/privacy/SanitizeSharingLi
|
||||
public static final fun getSanitizeSharingLinksPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatchKt {
|
||||
public static final fun getChangeLinkSharingDomainPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/misc/share/privacy/SanitizeSharingLinksPatchKt {
|
||||
public static final fun getSanitizeSharingLinksPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/misc/signature/SignatureCheckPatchKt {
|
||||
public static final fun getSignatureCheckPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package app.revanced.patches.instagram.misc.devmenu
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.util.Utils.trimIndentMultiline
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
import app.revanced.util.returnEarly
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Suppress("unused")
|
||||
val enableDeveloperMenuPatch = bytecodePatch(
|
||||
name = "Enable developer menu",
|
||||
description = """
|
||||
Enables the developer menu, which can be found at the bottom of settings menu with name 'Internal Settings'.
|
||||
|
||||
It is recommended to use this patch with an alpha/beta Instagram release. Patching a stable release works, but the developer menu shows the developer flags as numbers and does not show a human readable description.
|
||||
""".trimIndentMultiline(),
|
||||
use = false
|
||||
) {
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
execute {
|
||||
with(clearNotificationReceiverFingerprint.method) {
|
||||
indexOfFirstInstructionReversedOrThrow(clearNotificationReceiverFingerprint.stringMatches!!.first().index) {
|
||||
val reference = getReference<MethodReference>()
|
||||
Opcode.INVOKE_STATIC == opcode &&
|
||||
reference?.parameterTypes?.size == 1 &&
|
||||
reference.parameterTypes.first() == "Lcom/instagram/common/session/UserSession;" &&
|
||||
reference.returnType == "Z"
|
||||
}.let { index ->
|
||||
navigate(this).to(index).stop().returnEarly(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
package app.revanced.patches.instagram.misc.devmenu
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal val clearNotificationReceiverFingerprint = fingerprint {
|
||||
custom { method, classDef ->
|
||||
method.name == "onReceive" &&
|
||||
classDef.type == "Lcom/instagram/notifications/push/ClearNotificationReceiver;"
|
||||
}
|
||||
strings("NOTIFICATION_DISMISSED")
|
||||
}
|
||||
@@ -1,50 +1,12 @@
|
||||
package app.revanced.patches.instagram.misc.privacy
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/instagram/misc/privacy/SanitizeSharingLinksPatch;"
|
||||
|
||||
@Deprecated(
|
||||
"Patch was moved to a different package",
|
||||
ReplaceWith("app.revanced.patches.instagram.misc.share.privacy.sanitizeSharingLinksPatch")
|
||||
)
|
||||
@Suppress("unused")
|
||||
val sanitizeSharingLinksPatch = bytecodePatch(
|
||||
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||
) {
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
execute {
|
||||
arrayOf(
|
||||
permalinkResponseJsonParserFingerprint,
|
||||
storyUrlResponseJsonParserFingerprint,
|
||||
profileUrlResponseJsonParserFingerprint,
|
||||
liveUrlResponseJsonParserFingerprint
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.method.apply {
|
||||
val putSharingUrlIndex = indexOfFirstInstructionOrThrow(
|
||||
fingerprint.stringMatches!!.first().index,
|
||||
Opcode.IPUT_OBJECT
|
||||
)
|
||||
|
||||
val sharingUrlRegister = getInstruction<TwoRegisterInstruction>(putSharingUrlIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
putSharingUrlIndex,
|
||||
"""
|
||||
invoke-static { v$sharingUrlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitizeSharingLink(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$sharingUrlRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
val sanitizeSharingLinksPatch = bytecodePatch {
|
||||
dependsOn(app.revanced.patches.instagram.misc.share.privacy.sanitizeSharingLinksPatch)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package app.revanced.patches.instagram.misc.share
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
context(BytecodePatchContext)
|
||||
internal fun editShareLinksPatch(block: MutableMethod.(index: Int, register: Int) -> Unit) {
|
||||
val fingerprintsToPatch = arrayOf(
|
||||
permalinkResponseJsonParserFingerprint,
|
||||
storyUrlResponseJsonParserFingerprint,
|
||||
profileUrlResponseJsonParserFingerprint,
|
||||
liveUrlResponseJsonParserFingerprint
|
||||
)
|
||||
|
||||
for (fingerprint in fingerprintsToPatch) {
|
||||
fingerprint.method.apply {
|
||||
val putSharingUrlIndex = indexOfFirstInstruction(
|
||||
permalinkResponseJsonParserFingerprint.stringMatches!!.first().index,
|
||||
Opcode.IPUT_OBJECT
|
||||
)
|
||||
|
||||
val sharingUrlRegister = getInstruction<TwoRegisterInstruction>(putSharingUrlIndex).registerA
|
||||
|
||||
block(putSharingUrlIndex, sharingUrlRegister)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.instagram.misc.privacy
|
||||
package app.revanced.patches.instagram.misc.share
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package app.revanced.patches.instagram.misc.share.domain
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.stringOption
|
||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.instagram.misc.share.editShareLinksPatch
|
||||
import app.revanced.patches.shared.PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN
|
||||
import app.revanced.patches.shared.PATCH_NAME_CHANGE_LINK_SHARING_DOMAIN
|
||||
import app.revanced.util.returnEarly
|
||||
|
||||
@Suppress("unused")
|
||||
val changeLinkSharingDomainPatch = bytecodePatch(
|
||||
name = PATCH_NAME_CHANGE_LINK_SHARING_DOMAIN,
|
||||
description = PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN,
|
||||
use = false
|
||||
) {
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
execute {
|
||||
val customDomainHost by stringOption(
|
||||
key = "domainName",
|
||||
default = "imginn.com",
|
||||
title = "Domain name",
|
||||
description = "The domain name to use when sharing links."
|
||||
)
|
||||
|
||||
getCustomShareDomainFingerprint.method.returnEarly(customDomainHost!!)
|
||||
|
||||
editShareLinksPatch { index, register ->
|
||||
addInstructions(
|
||||
index,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->setCustomShareDomain(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.instagram.misc.share.domain
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/instagram/misc/share/domain/ChangeLinkSharingDomainPatch;"
|
||||
|
||||
internal val getCustomShareDomainFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
|
||||
returns("Ljava/lang/String;")
|
||||
parameters()
|
||||
custom { method, classDef ->
|
||||
method.name == "getCustomShareDomain" && classDef.type == EXTENSION_CLASS_DESCRIPTOR
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package app.revanced.patches.instagram.misc.share.privacy
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.instagram.misc.share.editShareLinksPatch
|
||||
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/instagram/misc/share/privacy/SanitizeSharingLinksPatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val sanitizeSharingLinksPatch = bytecodePatch(
|
||||
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||
) {
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
execute {
|
||||
editShareLinksPatch { index, register ->
|
||||
addInstructions(
|
||||
index,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->sanitizeSharingLink(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,3 +9,6 @@ internal const val PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION = "Removes the check
|
||||
|
||||
internal const val PATCH_NAME_SANITIZE_SHARING_LINKS = "Sanitize sharing links"
|
||||
internal const val PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS = "Removes the tracking query parameters from shared links."
|
||||
|
||||
internal const val PATCH_NAME_CHANGE_LINK_SHARING_DOMAIN = "Change link sharing domain"
|
||||
internal const val PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN = "Replaces the domain name of shared links."
|
||||
|
||||
@@ -6,6 +6,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
import app.revanced.patcher.patch.stringOption
|
||||
import app.revanced.patches.shared.PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN
|
||||
import app.revanced.patches.shared.PATCH_NAME_CHANGE_LINK_SHARING_DOMAIN
|
||||
import app.revanced.patches.shared.misc.mapping.get
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
||||
@@ -29,8 +31,8 @@ private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/twitter/patches/li
|
||||
|
||||
@Suppress("unused")
|
||||
val changeLinkSharingDomainPatch = bytecodePatch(
|
||||
name = "Change link sharing domain",
|
||||
description = "Replaces the domain name of Twitter links when sharing them.",
|
||||
name = PATCH_NAME_CHANGE_LINK_SHARING_DOMAIN,
|
||||
description = PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN
|
||||
) {
|
||||
dependsOn(
|
||||
changeLinkSharingDomainResourcePatch,
|
||||
|
||||
Reference in New Issue
Block a user