finish merge

This commit is contained in:
LisoUseInAIKyrios
2025-09-21 21:21:56 +04:00
parent c7a71f44df
commit 56876f336b
4 changed files with 31 additions and 116 deletions

View File

@@ -1600,10 +1600,6 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat
public static final fun is_20_37_or_greater ()Z
}
public final class app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatchKt {
public static final fun getRemoveTrackingQueryParameterPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/misc/privacy/SanitizeSharingLinksPatchKt {
public static final fun getSanitizeSharingLinksPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@@ -1,8 +1,12 @@
package app.revanced.patches.shared.misc.privacy
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.AccessFlags
import app.revanced.patcher.checkCast
import app.revanced.patcher.fieldAccess
import app.revanced.patcher.fingerprint
import app.revanced.patcher.methodCall
import app.revanced.patcher.opcode
import app.revanced.patcher.string
import com.android.tools.smali.dexlib2.Opcode
internal val youTubeCopyTextFingerprint by fingerprint {
returns("V")

View File

@@ -1,21 +1,20 @@
package app.revanced.patches.shared.misc.privacy
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.Match
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatchBuilder
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.util.addInstructionsAtControlFlowLabel
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/shared/patches/SanitizeSharingLinksPatch;"
@@ -56,34 +55,39 @@ internal fun sanitizeSharingLinksPatch(
}
)
fun Fingerprint.hook(
getInsertIndex: Match.PatternMatch.() -> Int,
getUrlRegister: MutableMethod.(insertIndex: Int) -> Int,
) {
val insertIndex = patternMatch!!.getInsertIndex()
val urlRegister = method.getUrlRegister(insertIndex)
fun Fingerprint.hookUrlString(matchIndex: Int) {
val index = instructionMatches[matchIndex].index
val urlRegister = method.getInstruction<OneRegisterInstruction>(index).registerA
method.addInstructions(
insertIndex,
index + 1,
"""
invoke-static {v$urlRegister}, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$urlRegister
"""
)
}
// YouTube share sheet.\
youTubeShareSheetFingerprint.hook(getInsertIndex = { startIndex + 1 }) { insertIndex ->
getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
fun Fingerprint.hookIntentPutExtra(matchIndex: Int) {
val index = instructionMatches[matchIndex].index
val urlRegister = method.getInstruction<FiveRegisterInstruction>(index).registerE
method.addInstructionsAtControlFlowLabel(
index,
"""
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$urlRegister
"""
)
}
// YouTube share sheet copy link.
youTubeCopyTextFingerprint.hookUrlString(0)
// YouTube share sheet other apps.
youTubeShareSheetFingerprint.hookIntentPutExtra(3)
// Native system share sheet.
youTubeSystemShareSheetFingerprint.hook(getInsertIndex = { endIndex }) { insertIndex ->
getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
}
youTubeCopyTextFingerprint.hook(getInsertIndex = { startIndex + 2 }) { insertIndex ->
getInstruction<TwoRegisterInstruction>(insertIndex - 2).registerA
}
youTubeSystemShareSheetFingerprint.hookIntentPutExtra(3)
}
}

View File

@@ -1,89 +0,0 @@
package app.revanced.patches.youtube.misc.privacy
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.Match
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/RemoveTrackingQueryParameterPatch;"
@Deprecated("Patch was renamed", ReplaceWith("sanitizeSharingLinksPatch"))
@Suppress("unused")
val removeTrackingQueryParameterPatch = bytecodePatch{
dependsOn(sanitizeSharingLinksPatch)
//// TODO: Rename this to "Sanitize sharing links" to be consistent with other apps.
// val removeTrackingQueryParameterPatch = bytecodePatch(
// name = "Remove tracking query parameter",
// description = "Adds an option to remove the tracking parameter from links you share.",
//) {
// dependsOn(
// sharedExtensionPatch,
// settingsPatch,
// addResourcesPatch,
// )
//
// compatibleWith(
// "com.google.android.youtube"(
// "19.34.42",
// "19.43.41",
// "20.07.39",
// "20.13.41",
// "20.14.43",
// )
// )
//
// execute {
// addResources("youtube", "misc.privacy.removeTrackingQueryParameterPatch")
//
// PreferenceScreen.MISC.addPreferences(
// SwitchPreference("revanced_remove_tracking_query_parameter"),
// )
//
// fun Fingerprint.hookUrlString(matchIndex: Int) {
// val index = instructionMatches[matchIndex].index
// val urlRegister = method.getInstruction<OneRegisterInstruction>(index).registerA
//
// method.addInstructions(
// index + 1,
// """
// invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
// move-result-object v$urlRegister
// """
// )
// }
//
// fun Fingerprint.hookIntentPutExtra(matchIndex: Int) {
// val index = instructionMatches[matchIndex].index
// val urlRegister = method.getInstruction<FiveRegisterInstruction>(index).registerE
//
// method.addInstructionsAtControlFlowLabel(
// index,
// """
// invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
// move-result-object v$urlRegister
// """
// )
// }
//
// // YouTube share sheet copy link.
// copyTextFingerprint.hookUrlString(0)
//
// // YouTube share sheet other apps.
// youtubeShareSheetFingerprint.hookIntentPutExtra(3)
//
// // Native system share sheet.
// systemShareSheetFingerprint.hookIntentPutExtra(3)
// }
//}