@@ -76,7 +76,8 @@ public BlockResult check(final String string) {
7676}
7777
7878abstract class Filter {
79- final LithoBlockRegister register = new LithoBlockRegister ();
79+ final LithoBlockRegister pathRegister = new LithoBlockRegister ();
80+ final LithoBlockRegister identifierRegister = new LithoBlockRegister ();
8081
8182 abstract boolean filter (final String path , final String identifier );
8283}
@@ -140,15 +141,15 @@ public CommentsPatch() {
140141 "comments_entry_point_simplebox"
141142 );
142143
143- this .register .registerAll (
144+ this .pathRegister .registerAll (
144145 comments ,
145146 previewComment
146147 );
147148 }
148149
149150 @ Override
150151 boolean filter (String path , String _identifier ) {
151- if (!Extensions .any (register , path )) return false ;
152+ if (!Extensions .any (pathRegister , path )) return false ;
152153
153154 LogHelper .debug (CommentsPatch .class , "Blocked: " + path );
154155
@@ -173,7 +174,7 @@ public ButtonsPatch() {
173174
174175 actionBarRule = new BlockRule (null , "video_action_bar" );
175176
176- this .register .registerAll (
177+ this .pathRegister .registerAll (
177178 like ,
178179 dislikeRule ,
179180 download ,
@@ -201,7 +202,7 @@ public boolean filter(final String path, final String identifier) {
201202 } else return false ;
202203 }
203204
204- if ((currentIsActionButton && ActionButton .doNotBlockCounter <= 0 && actionButtonsRule .isEnabled ()) || Extensions .any (register , path )) {
205+ if ((currentIsActionButton && ActionButton .doNotBlockCounter <= 0 && actionButtonsRule .isEnabled ()) || Extensions .any (pathRegister , path )) {
205206 LogHelper .debug (ButtonsPatch .class , "Blocked: " + path );
206207 return true ;
207208 } else return false ;
@@ -213,8 +214,6 @@ static class ActionButton {
213214}
214215
215216final class GeneralBytecodeAdsPatch extends Filter {
216- private final BlockRule identifierBlock ;
217-
218217 public GeneralBytecodeAdsPatch () {
219218 var communityPosts = new BlockRule (SettingsEnum .ADREMOVER_COMMUNITY_POSTS_REMOVAL , "post_base_wrapper" );
220219 var communityGuidelines = new BlockRule (SettingsEnum .ADREMOVER_COMMUNITY_GUIDELINES_REMOVAL , "community_guidelines" );
@@ -223,7 +222,6 @@ public GeneralBytecodeAdsPatch() {
223222 var medicalPanel = new BlockRule (SettingsEnum .ADREMOVER_MEDICAL_PANEL_REMOVAL , "medical_panel" );
224223 var paidContent = new BlockRule (SettingsEnum .ADREMOVER_PAID_CONTENT_REMOVAL , "paid_content_overlay" );
225224 var merchandise = new BlockRule (SettingsEnum .ADREMOVER_MERCHANDISE_REMOVAL , "product_carousel" );
226- var shorts = new BlockRule (SettingsEnum .ADREMOVER_SHORTS_SHELF_REMOVAL , "shorts_shelf" );
227225 var infoPanel = new BlockRule (SettingsEnum .ADREMOVER_INFO_PANEL_REMOVAL , "publisher_transparency_panel" , "single_item_information_panel" );
228226 var suggestions = new BlockRule (SettingsEnum .ADREMOVER_SUGGESTIONS_REMOVAL , "horizontal_video_shelf" );
229227 var latestPosts = new BlockRule (SettingsEnum .ADREMOVER_HIDE_LATEST_POSTS , "post_shelf" );
@@ -241,7 +239,6 @@ public GeneralBytecodeAdsPatch() {
241239 "banner_text_icon" ,
242240 "cell_divider" ,
243241 "reels_player_overlay" ,
244- "shelf_header" ,
245242 "watch_metadata_app_promo" ,
246243 "video_display_full_layout"
247244 );
@@ -253,11 +250,10 @@ public GeneralBytecodeAdsPatch() {
253250 "movie_and_show_upsell_card"
254251 );
255252
256- this .register .registerAll (
253+ this .pathRegister .registerAll (
257254 generalAds ,
258255 communityPosts ,
259256 paidContent ,
260- shorts ,
261257 suggestions ,
262258 latestPosts ,
263259 movieAds ,
@@ -272,8 +268,13 @@ public GeneralBytecodeAdsPatch() {
272268 selfSponsor
273269 );
274270
275- // Block for the ComponentContext.identifier field
276- identifierBlock = new BlockRule (SettingsEnum .ADREMOVER_GENERAL_ADS_REMOVAL , "carousel_ad" );
271+ var carouselAd = new BlockRule (SettingsEnum .ADREMOVER_GENERAL_ADS_REMOVAL , "carousel_ad" );
272+ var shorts = new BlockRule (SettingsEnum .ADREMOVER_SHORTS_REMOVAL , "shorts_shelf" , "inline_shorts" );
273+
274+ this .identifierRegister .registerAll (
275+ shorts ,
276+ carouselAd
277+ );
277278 }
278279
279280 public boolean filter (final String path , final String identifier ) {
@@ -293,10 +294,10 @@ public boolean filter(final String path, final String identifier) {
293294 "playlist_add_to_option_wrapper" // do not block on "add to playlist" flyout menu
294295 )) return false ;
295296
296- if (!Extensions .any (register , path ) && ! identifierBlock . check ( identifier ). isBlocked ( ))
297+ if (!( Extensions .any (pathRegister , path ) || Extensions . any ( identifierRegister , identifier )))
297298 return false ;
298299
299- LogHelper .debug (GeneralBytecodeAdsPatch .class , "Blocked: " + path );
300+ LogHelper .debug (GeneralBytecodeAdsPatch .class , String . format ( "Blocked (ID: %s): %s" , identifier , path ) );
300301
301302 return true ;
302303 }
0 commit comments