From 994c5d197db1ef4ade8e60b0ce95601acdacdb5b Mon Sep 17 00:00:00 2001 From: inotia00 Date: Tue, 5 Sep 2023 01:37:09 +0900 Subject: [PATCH] build: bump patcher to 14.2.2 --- build.gradle.kts | 17 ++--- .../app/revanced/extensions/Extensions.kt | 27 ++++++-- .../kotlin/app/revanced/meta/JsonGenerator.kt | 3 - .../app/revanced/meta/PatchesFileGenerator.kt | 19 +++-- .../app/revanced/meta/ReadmeGenerator.kt | 69 ------------------- .../music/ads/music/patch/MusicAdsPatch.kt | 7 +- .../music/layout/amoled/patch/AmoledPatch.kt | 7 +- .../patch/DisableAutoCaptionsPatch.kt | 11 +-- .../patch/BlackNavigationBarPatch.kt | 11 +-- .../icon/patch/CustomBrandingIconMMTPatch.kt | 7 +- .../CustomBrandingIconRevancifyBluePatch.kt | 7 +- .../CustomBrandingIconRevancifyRedPatch.kt | 7 +- .../name/patch/CustomBrandingNamePatch.kt | 13 ++-- .../name/patch/RemoveElementsPatch.kt | 5 +- .../buttonshelf/patch/HideButtonShelfPatch.kt | 7 +- .../patch/HideCarouselShelfPatch.kt | 7 +- .../castbutton/patch/HideCastButtonPatch.kt | 13 ++-- .../categorybar/patch/CategoryBarPatch.kt | 11 +-- .../patch/HideChannelGuidelinesPatch.kt | 7 +- .../patch/ColorMatchPlayerPatch.kt | 13 ++-- .../compactdialog/patch/CompactDialogPatch.kt | 12 +--- .../customfilter/patch/CustomFilterPatch.kt | 7 +- .../patch/NewPlaylistButtonPatch.kt | 13 ++-- .../landscapemode/patch/LandScapeModePatch.kt | 11 +-- .../patch/MinimizedPlayerPatch.kt | 11 +-- .../patch/NavigationLabelPatch.kt | 15 ++-- .../layout/newlayout/patch/NewLayoutPatch.kt | 11 +-- .../patch/OldStyleMiniPlayerPatch.kt | 15 ++-- .../patch/HidePlaylistCardPatch.kt | 7 +- .../sleeptimer/patch/SleepTimerPatch.kt | 11 +-- .../layout/zenmode/patch/ZenModePatch.kt | 13 ++-- .../patch/BackgroundPlayPatch.kt | 12 +--- .../bitrate/patch/BitrateDefaultValuePatch.kt | 7 +- .../misc/codecs/patch/CodecsUnlockPatch.kt | 7 +- .../misc/debugging/patch/DebuggingPatch.kt | 7 +- .../patch/ExclusiveAudioPatch.kt | 11 +-- .../patch/MinimizedPlaybackPatch.kt | 11 +-- .../patch/OptimizeResourcePatch.kt | 7 +- .../misc/premium/patch/HideGetPremiumPatch.kt | 14 ++-- .../misc/quality/patch/VideoQualityPatch.kt | 15 ++-- .../patch/ShareButtonHookPatch.kt | 17 ++--- .../misc/shuffle/patch/EnforceShufflePatch.kt | 17 ++--- .../tastebuilder/patch/TasteBuilderPatch.kt | 11 +-- .../translations/patch/TranslationsPatch.kt | 7 +- .../upgradebutton/patch/UpgradeButtonPatch.kt | 13 ++-- .../patch/SpoofAppVersionPatch.kt | 7 +- .../patch/AndroidAutoCertificatePatch.kt | 11 +-- .../patch/ClientSpoofMusicPatch.kt | 9 +-- .../utils/fix/decoding/patch/DecodingPatch.kt | 5 +- .../utils/litho/patch/LithoFilterPatch.kt | 11 +-- .../microg/bytecode/patch/MicroGPatch.kt | 15 ++-- .../resource/patch/MicroGResourcePatch.kt | 11 ++- .../resourceid/patch/SharedResourceIdPatch.kt | 9 +-- .../bytecode/patch/SettingsBytecodePatch.kt | 11 ++- .../settings/resource/patch/SettingsPatch.kt | 7 +- .../music/utils/videoid/patch/VideoIdPatch.kt | 9 +-- .../reddit/ad/banner/patch/HideBannerPatch.kt | 5 +- .../ad/comments/patch/HideCommentAdsPatch.kt | 10 +-- .../reddit/ad/general/patch/HideAdsPatch.kt | 19 ++--- .../patch/NavigationButtonsPatch.kt | 11 +-- .../layout/place/patch/PlaceButtonPatch.kt | 11 +-- .../premiumicon/patch/PremiumIconPatch.kt | 11 +-- .../patch/ScreenshotPopupPatch.kt | 11 +-- .../openlink/patch/OpenLinksDirectlyPatch.kt | 11 +-- .../patch/OpenLinksExternallyPatch.kt | 11 +-- .../url/patch/SanitizeUrlQueryPatch.kt | 11 +-- .../utils/fix/decoding/patch/DecodingPatch.kt | 5 +- .../resourceid/patch/SharedResourceIdPatch.kt | 9 +-- .../bytecode/patch/SettingsBytecodePatch.kt | 13 ++-- .../settings/resource/patch/SettingsPatch.kt | 11 +-- .../shared/patch/ads/AbstractAdsPatch.kt | 10 +-- .../integrations/AbstractIntegrationsPatch.kt | 32 +++------ .../patch/litho/ComponentParserPatch.kt | 15 ++-- .../patch/mapping/ResourceMappingPatch.kt | 5 +- .../patch/opus/AbstractOpusCodecsPatch.kt | 15 ++-- .../patch/packagename/PackageNamePatch.kt | 7 +- .../settings/AbstractSettingsResourcePatch.kt | 5 +- .../versionspoof/AbstractVersionSpoofPatch.kt | 13 ++-- .../bytecode/patch/GeneralAdsBytecodePatch.kt | 5 +- .../general/resource/patch/GeneralAdsPatch.kt | 7 +- .../getpremium/patch/HideGetPremiumPatch.kt | 9 +-- .../youtube/ads/video/patch/VideoAdsPatch.kt | 7 +- .../patch/ButtonContainerPatch.kt | 7 +- .../comment/patch/CommentComponentPatch.kt | 7 +- .../feed/patch/FeedFlyoutPanelPatch.kt | 15 ++-- .../patch/OldQualityLayoutPatch.kt | 13 ++-- .../patch/OldSpeedLayoutPatch.kt | 15 ++-- .../player/patch/PlayerFlyoutPanelPatch.kt | 7 +- .../patch/HideAutoplayPreviewPatch.kt | 11 +-- .../patch/CompactControlsOverlayPatch.kt | 12 +--- .../patch/HideEndScreenOverlayPatch.kt | 11 +-- .../patch/HideFullscreenPanelsPatch.kt | 13 ++-- .../landscapemode/patch/LandScapeModePatch.kt | 13 ++-- .../quickactions/patch/QuickActionsPatch.kt | 7 +- .../accountmenu/patch/AccountMenuPatch.kt | 13 ++-- .../autocaptions/patch/AutoCaptionsPatch.kt | 13 ++-- .../patch/PlayerPopupPanelsPatch.kt | 11 +-- .../categorybar/patch/CategoryBarPatch.kt | 11 +-- .../patch/ChannelListSubMenuPatch.kt | 11 +-- .../patch/CrowdfundingBoxPatch.kt | 11 +-- .../patch/DescriptionComponentsPatch.kt | 7 +- .../patch/FloatingMicrophonePatch.kt | 11 +-- .../headerswitch/patch/HeaderSwitchPatch.kt | 7 +- .../patch/LatestVideosButtonPatch.kt | 11 +-- .../layout/patch/LayoutComponentsPatch.kt | 7 +- .../patch/LoadMoreButtonPatch.kt | 11 +-- .../mixplaylists/patch/MixPlaylistsPatch.kt | 13 ++-- .../patch/HideEmailAddressPatch.kt | 11 +-- .../snackbar/patch/HideSnackBarPatch.kt | 11 +-- .../patch/SuggestionsShelfPatch.kt | 13 ++-- .../patch/TabletMiniPlayerPatch.kt | 18 ++--- .../patch/TrendingSearchesPatch.kt | 11 +-- .../widesearchbar/patch/WideSearchBarPatch.kt | 12 +--- .../icon/patch/CustomBrandingIconMMTPatch.kt | 7 +- .../CustomBrandingIconRevancifyBluePatch.kt | 7 +- .../CustomBrandingIconRevancifyRedPatch.kt | 7 +- .../name/patch/CustomBrandingNamePatch.kt | 11 +-- .../name/patch/RemoveElementsPatch.kt | 5 +- .../patch/DoubleTapOverlayBackgroundPatch.kt | 7 +- .../patch/DoubleTapLengthPatch.kt | 11 +-- .../patch/PlayerButtonBackgroundPatch.kt | 7 +- .../forceheader/patch/PremiumHeadingPatch.kt | 14 ++-- .../materialyou/patch/MaterialYouPatch.kt | 7 +- .../optimize/patch/OptimizeResourcePatch.kt | 7 +- .../optimize/patch/RedundantResourcePatch.kt | 5 +- .../patch/PiPNotificationPatch.kt | 11 +-- .../patch/AddSplashAnimationPatch.kt | 7 +- .../layout/theme/patch/GeneralThemePatch.kt | 5 +- .../youtube/layout/theme/patch/ThemePatch.kt | 11 +-- .../tooltip/patch/TooltipContentViewPatch.kt | 11 +-- .../ambientmode/patch/PowerSaveModePatch.kt | 15 ++-- .../misc/debugging/patch/DebuggingPatch.kt | 7 +- .../patch/ExternalBrowserPatch.kt | 11 +-- .../forceopus/patch/ForceOpusCodecPatch.kt | 7 +- .../misc/forcevp9/patch/ForceVP9CodecPatch.kt | 21 +++--- .../language/patch/LanguageSelectorPatch.kt | 11 +-- .../layoutswitch/patch/LayoutSwitchPatch.kt | 16 ++--- .../patch/MinimizedPlaybackPatch.kt | 12 +--- .../patch/OpenLinksDirectlyPatch.kt | 11 +-- .../misc/quic/patch/QUICProtocolPatch.kt | 11 +-- .../patch/NewSplashAnimationPatch.kt | 11 +-- .../patch/SpoofAppVersionPatch.kt | 7 +- .../translations/patch/TranslationsPatch.kt | 7 +- .../homepage/patch/ChangeHomePagePatch.kt | 13 ++-- .../label/patch/NavigationLabelPatch.kt | 13 ++-- .../patch/NavigationButtonsPatch.kt | 15 ++-- .../patch/TabletNavigationBarPatch.kt | 11 +-- .../alwaysrepeat/patch/AlwaysRepeatPatch.kt | 14 ++-- .../patch/DownloadButtonHookPatch.kt | 9 +-- .../general/patch/OverlayButtonsPatch.kt | 7 +- .../patch/HideAutoplayButtonPatch.kt | 11 +-- .../patch/HideCaptionsButtonPatch.kt | 11 +-- .../castbutton/patch/HideCastButtonPatch.kt | 11 +-- .../patch/HideCollapseButtonPatch.kt | 7 +- .../patch/HideEndScreenCardsPatch.kt | 11 +-- .../patch/HideFilmstripOverlayPatch.kt | 15 ++-- .../patch/HapticFeedBackPatch.kt | 11 +-- .../infocards/patch/HideInfoCardsPatch.kt | 11 +-- .../musicbutton/patch/HideMusicButtonPatch.kt | 11 +-- .../patch/HidePlayerButtonBackgroundPatch.kt | 11 +-- .../patch/PlayerOverlayFilterPatch.kt | 15 ++-- .../patch/HidePreviousNextButtonPatch.kt | 7 +- .../seekmessage/patch/SeekMessagePatch.kt | 11 +-- .../patch/HideSpeedOverlayPatch.kt | 11 +-- .../patch/SuggestedActionsPatch.kt | 11 +-- .../patch/SuggestedVideoOverlayPatch.kt | 19 ++--- .../patch/HideChannelWatermarkPatch.kt | 13 ++-- .../seekbar/seekbar/patch/HideSeekbarPatch.kt | 13 ++-- .../seekbarcolor/patch/SeekbarColorPatch.kt | 20 ++---- .../seekbar/speed/patch/AppendSpeedPatch.kt | 15 ++-- .../tapping/patch/SeekbarTappingPatch.kt | 13 ++-- .../patch/NewThumbnailPreviewPatch.kt | 11 +-- .../timestamps/patch/HideTimeStampPatch.kt | 11 +-- .../patch/NewCommentPopupPanelsPatch.kt | 11 +-- .../patch/ShortsCommentButtonPatch.kt | 9 +-- .../patch/ShortsComponentPatch.kt | 7 +- .../patch/ShortsDislikeButtonPatch.kt | 9 +-- .../patch/ShortsInfoPanelPatch.kt | 9 +-- .../patch/ShortsLikeButtonPatch.kt | 9 +-- .../patch/ShortsPaidPromotionBannerPatch.kt | 9 +-- .../patch/ShortsRemixButtonPatch.kt | 9 +-- .../patch/ShortsShareButtonPatch.kt | 9 +-- .../patch/ShortsSubscriptionsButtonPatch.kt | 16 ++--- .../patch/ShortsToolBarPatch.kt | 14 ++-- .../patch/ShortsNavigationBarPatch.kt | 16 ++--- .../patch/DisableShortsOnStartupPatch.kt | 11 +-- .../hdrbrightness/patch/HDRBrightnessPatch.kt | 9 +-- .../patch/SwipeControlsBytecodePatch.kt | 13 ++-- .../resource/patch/SwipeControlsPatch.kt | 7 +- .../fix/clientspoof/patch/ClientSpoofPatch.kt | 9 +-- .../patch/DoubleBackToClosePatch.kt | 16 ++--- .../patch/SpoofPlayerParameterPatch.kt | 18 ++--- .../swiperefresh/patch/SwipeRefreshPatch.kt | 9 +-- .../utils/litho/patch/LithoFilterPatch.kt | 16 ++--- .../utils/litho/patch/LithoThemePatch.kt | 9 +-- .../bytecode/patch/MicroGBytecodePatch.kt | 11 ++- .../microg/resource/patch/MicroGPatch.kt | 13 ++-- .../navbarindex/patch/NavBarIndexHookPatch.kt | 13 ++-- .../patch/OverrideSpeedHookPatch.kt | 16 ++--- .../patch/PlayerButtonHookPatch.kt | 9 +-- .../patch/PlayerControlsPatch.kt | 29 ++++---- .../playertype/patch/PlayerTypeHookPatch.kt | 13 ++-- .../patch/QuickActionsHookPatch.kt | 9 +-- .../resourceid/patch/SharedResourceIdPatch.kt | 9 +-- .../patch/ReturnYouTubeDislikePatch.kt | 19 ++--- .../ReturnYouTubeDislikeOldLayoutPatch.kt | 9 +-- .../patch/ReturnYouTubeDislikeShortsPatch.kt | 9 +-- .../bytecode/patch/SettingsBytecodePatch.kt | 9 +-- .../settings/resource/patch/SettingsPatch.kt | 7 +- .../patch/SponsorBlockBytecodePatch.kt | 21 +++--- .../patch/SponsorBlockResourcePatch.kt | 7 +- .../utils/videocpn/patch/VideoCpnPatch.kt | 9 +-- .../videoid/general/patch/VideoIdPatch.kt | 20 +++--- .../patch/VideoIdWithoutShortsPatch.kt | 9 +-- .../patch/CustomPlaybackSpeedPatch.kt | 13 ++-- .../video/hdr/patch/DisableHdrVideoPatch.kt | 12 +--- .../video/quality/patch/VideoQualityPatch.kt | 21 +++--- .../video/speed/patch/PlaybackSpeedPatch.kt | 13 ++-- .../util/microg/MicroGBytecodeHelper.kt | 6 +- .../revanced/util/resources/ResourceUtils.kt | 13 ++-- 220 files changed, 727 insertions(+), 1763 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/meta/ReadmeGenerator.kt diff --git a/build.gradle.kts b/build.gradle.kts index 7375b76ec..ca2ca1399 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,30 +2,31 @@ plugins { kotlin("jvm") version "1.9.0" } -group = "io.github.inotia00" +group = "app.revanced" + +val githubUsername: String = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR") +val githubPassword: String = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN") repositories { google() mavenCentral() mavenLocal() - maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") } maven { - url = uri("https://repo.sleeping.town") - content { - includeGroup("com.unascribed") + url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") + credentials { + username = githubUsername + password = githubPassword } } } dependencies { - implementation("io.github.inotia00:revanced-patcher:11.0.6-SNAPSHOT") + implementation("app.revanced:revanced-patcher:14.2.2") implementation("com.android.tools.smali:smali:3.0.3") implementation("com.android.tools.smali:smali-dexlib2:3.0.3") // Required for meta implementation("com.google.code.gson:gson:2.10.1") - // Required for FlexVer-Java - implementation("com.unascribed:flexver-java:1.1.0") } tasks { diff --git a/src/main/kotlin/app/revanced/extensions/Extensions.kt b/src/main/kotlin/app/revanced/extensions/Extensions.kt index fa3cf899e..47881ca3b 100644 --- a/src/main/kotlin/app/revanced/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/extensions/Extensions.kt @@ -1,8 +1,9 @@ package app.revanced.extensions +import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.MethodFingerprintExtensions.name import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patcher.patch.PatchResultError +import app.revanced.patcher.patch.PatchException import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableField import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod @@ -25,13 +26,13 @@ internal fun MutableMethodImplementation.injectHideCall( ) } -// TODO: populate this to all patches /** - * Convert a [MethodFingerprint] to a [PatchResultError]. + * Return [PatchException] from a [MethodFingerprint]. * - * @return A [PatchResultError] for the [MethodFingerprint]. + * @return The [PatchException] for the [MethodFingerprint]. */ -fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $name") +val MethodFingerprint.exception + get() = PatchException("Failed to resolve $name") /** * Find the [MutableMethod] from a given [Method] in a [MutableClass]. @@ -65,6 +66,22 @@ fun MutableClass.transformFields(transform: MutableField.() -> MutableField) { fields.addAll(transformedFields) } +/** + * traverse the class hierarchy starting from the given root class + * + * @param targetClass the class to start traversing the class hierarchy from + * @param callback function that is called for every class in the hierarchy + */ +fun BytecodeContext.traverseClassHierarchy( + targetClass: MutableClass, + callback: MutableClass.() -> Unit +) { + callback(targetClass) + this.findClass(targetClass.superclass ?: return)?.mutableClass?.let { + traverseClassHierarchy(it, callback) + } +} + internal fun Node.doRecursively(action: (Node) -> Unit) { action(this) for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action) diff --git a/src/main/kotlin/app/revanced/meta/JsonGenerator.kt b/src/main/kotlin/app/revanced/meta/JsonGenerator.kt index cebf57d91..3be7793f8 100644 --- a/src/main/kotlin/app/revanced/meta/JsonGenerator.kt +++ b/src/main/kotlin/app/revanced/meta/JsonGenerator.kt @@ -6,7 +6,6 @@ import app.revanced.patcher.extensions.PatchExtensions.description import app.revanced.patcher.extensions.PatchExtensions.include import app.revanced.patcher.extensions.PatchExtensions.options import app.revanced.patcher.extensions.PatchExtensions.patchName -import app.revanced.patcher.extensions.PatchExtensions.version import app.revanced.patcher.patch.PatchOption import com.google.gson.GsonBuilder import java.io.File @@ -17,7 +16,6 @@ internal class JsonGenerator : PatchesFileGenerator { JsonPatch( it.patchName, it.description ?: "This patch has no description.", - it.version ?: "0.0.0", !it.include, it.options?.map { option -> JsonPatch.Option( @@ -48,7 +46,6 @@ internal class JsonGenerator : PatchesFileGenerator { private class JsonPatch( val name: String, val description: String, - val version: String, val excluded: Boolean, val options: Array