Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# [2.1.0-dev.3](https://github.com/brosssh/morphe-patches/compare/v2.1.0-dev.2...v2.1.0-dev.3) (2026-03-18)


### Features

* More Instagram patches ported from ReVanced ([790149f](https://github.com/brosssh/morphe-patches/commit/790149f2b280bf968c490a285e117bf3bef3989c))

# [2.1.0-dev.2](https://github.com/brosssh/morphe-patches/compare/v2.1.0-dev.1...v2.1.0-dev.2) (2026-03-17)


### Features

* More Instagram patches ported from ReVanced ([08ef7b4](https://github.com/brosssh/morphe-patches/commit/08ef7b4344f52fb468a94da547bd8bbf9982bd37))

# [2.1.0-dev.1](https://github.com/brosssh/morphe-patches/compare/v2.0.0...v2.1.0-dev.1) (2026-03-17)


### Features

* Some Instagram patches ported from ReVanced ([a121b18](https://github.com/brosssh/morphe-patches/commit/a121b189bbc6f94d9909601e729fa667c6b5578d))

# [2.0.0](https://github.com/brosssh/morphe-patches/compare/v1.9.2...v2.0.0) (2026-03-15)


Expand Down
9 changes: 9 additions & 0 deletions extensions/instagram/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies {
compileOnly(project(":extensions:shared:library"))
}

android {
defaultConfig {
minSdk = 26
}
}
1 change: 1 addition & 0 deletions extensions/instagram/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package app.morphe.extension.instagram.feed;

import java.util.HashMap;
import java.util.Map;

@SuppressWarnings("unused")
public class LimitFeedToFollowedProfiles {

/**
* Injection point.
*/
public static Map<String, String> setFollowingHeader(Map<String, String> requestHeaderMap) {
String paginationHeaderName = "pagination_source";

// Patch the header only if it's trying to fetch the default feed
String currentHeader = requestHeaderMap.get(paginationHeaderName);
if (currentHeader != null && !currentHeader.equals("feed_recs")) {
return requestHeaderMap;
}

// Create new map as original is unmodifiable.
Map<String, String> patchedRequestHeaderMap = new HashMap<>(requestHeaderMap);
patchedRequestHeaderMap.put(paginationHeaderName, "following");
return patchedRequestHeaderMap;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package app.morphe.extension.instagram.hide.navigation;

import java.lang.reflect.Field;
import java.util.List;

@SuppressWarnings("unused")
public class HideNavigationButtonsPatch {

/**
* Injection point.
* @param navigationButtonsList the list of navigation buttons, as an (obfuscated) Enum type
* @param buttonNameToRemove the name of the button we want to remove
* @param enumNameField the field in the nav button enum class which contains the name of the button
* @return the patched list of navigation buttons
*/
public static List<Object> removeNavigationButtonByName(
List<Object> navigationButtonsList,
String buttonNameToRemove,
String enumNameField
)
throws IllegalAccessException, NoSuchFieldException {
for (Object button : navigationButtonsList) {
Field f = button.getClass().getDeclaredField(enumNameField);
String currentButtonEnumName = (String) f.get(button);

if (buttonNameToRemove.equals(currentButtonEnumName)) {
navigationButtonsList.remove(button);
break;
}
}
return navigationButtonsList;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package app.morphe.extension.instagram.misc.share.privacy;

import app.morphe.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);
}
}
17 changes: 17 additions & 0 deletions extensions/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-dontobfuscate
-dontoptimize
-keepattributes *
-keep class app.morphe.** {
*;
}
-keep class com.google.** {
*;
}
-keep class com.eclipsesource.v8.** {
*;
}
# Proguard can strip away kotlin intrinsics methods that are used by extension Kotlin code. Unclear why.
-keep class kotlin.jvm.internal.Intrinsics {
public static *;
}
-dontwarn javax.lang.model.element.Modifier
3 changes: 3 additions & 0 deletions extensions/shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies {
implementation(project(":extensions:shared:library"))
}
21 changes: 21 additions & 0 deletions extensions/shared/library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
alias(libs.plugins.android.library)
}

android {
namespace = "app.morphe.extension"
compileSdk = 35

defaultConfig {
minSdk = 23
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

dependencies {
compileOnly(libs.annotation)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package app.morphe.extension.shared;

import java.nio.charset.StandardCharsets;

public final class ByteTrieSearch extends TrieSearch<byte[]> {

private static final class ByteTrieNode extends TrieNode<byte[]> {
ByteTrieNode() {
super();
}
ByteTrieNode(char nodeCharacterValue) {
super(nodeCharacterValue);
}
@Override
TrieNode<byte[]> createNode(char nodeCharacterValue) {
return new ByteTrieNode(nodeCharacterValue);
}
@Override
char getCharValue(byte[] text, int index) {
return (char) text[index];
}
@Override
int getTextLength(byte[] text) {
return text.length;
}
}

/**
* Helper method for the common usage of converting Strings to raw UTF-8 bytes.
*/
public static byte[][] convertStringsToBytes(String... strings) {
final int length = strings.length;
byte[][] replacement = new byte[length][];
for (int i = 0; i < length; i++) {
replacement[i] = strings[i].getBytes(StandardCharsets.UTF_8);
}
return replacement;
}

public ByteTrieSearch(byte[]... patterns) {
super(new ByteTrieNode(), patterns);
}
}
Loading