1
mirror of https://github.com/revanced/revanced-integrations synced 2025-11-21 18:35:37 +01:00

Compare commits

...

24 Commits

Author SHA1 Message Date
semantic-release-bot
c266fdbf44 chore(release): 0.51.1 [skip ci]
## [0.51.1](https://github.com/revanced/revanced-integrations/compare/v0.51.0...v0.51.1) (2022-10-11)
2022-10-11 13:51:42 +00:00
Patryk Miś
07acc4dc1f build: update Kotlin and SDKs (#173) 2022-10-11 15:47:14 +02:00
semantic-release-bot
34a6829aaf chore(release): 0.51.0 [skip ci]
# [0.51.0](https://github.com/revanced/revanced-integrations/compare/v0.50.0...v0.51.0) (2022-10-06)

### Features

* **youtube/return-youtube-dislike:** decrease request timeout ([#171](https://github.com/revanced/revanced-integrations/issues/171)) ([c372e0e](c372e0e9bd))
2022-10-06 17:42:32 +00:00
oSumAtrIX
c372e0e9bd feat(youtube/return-youtube-dislike): decrease request timeout (#171) 2022-10-06 19:39:12 +02:00
semantic-release-bot
f5a4e6f3bf chore(release): 0.50.0 [skip ci]
# [0.50.0](https://github.com/revanced/revanced-integrations/compare/v0.49.1...v0.50.0) (2022-10-06)

### Features

* **youtube/general-ads:** do not hide community posts by default ([576991a](576991a7df))
2022-10-06 08:13:25 +00:00
oSumAtrIX
576991a7df feat(youtube/general-ads): do not hide community posts by default 2022-10-06 10:09:53 +02:00
semantic-release-bot
ab88a1f3d7 chore(release): 0.49.1 [skip ci]
## [0.49.1](https://github.com/revanced/revanced-integrations/compare/v0.49.0...v0.49.1) (2022-10-04)

### Bug Fixes

* **youtube/sponsorblock:** parse the error response on code 400 ([#169](https://github.com/revanced/revanced-integrations/issues/169)) ([5ab26a4](5ab26a427b))
2022-10-04 18:46:59 +00:00
caneleex
5ab26a427b fix(youtube/sponsorblock): parse the error response on code 400 (#169) 2022-10-04 20:43:29 +02:00
semantic-release-bot
9255fa30fa chore(release): 0.49.0 [skip ci]
# [0.49.0](https://github.com/revanced/revanced-integrations/compare/v0.48.0...v0.49.0) (2022-10-04)

### Features

* **youtube/remember-video-quality:** remember current quality option ([90f7392](90f7392e1a))
2022-10-04 05:54:55 +00:00
oSumAtrIX
90f7392e1a feat(youtube/remember-video-quality): remember current quality option 2022-10-04 07:51:45 +02:00
semantic-release-bot
fbaa361c00 chore(release): 0.48.0 [skip ci]
# [0.48.0](https://github.com/revanced/revanced-integrations/compare/v0.47.1...v0.48.0) (2022-10-03)

### Bug Fixes

* **youtube/general-ads:** do not block ads on `download_` ([e78a801](e78a8014bc))

### Features

* `hide-video-buttons` patch ([bf82e02](bf82e0219f))
2022-10-03 11:43:42 +00:00
oSumAtrIX
bf82e0219f feat: hide-video-buttons patch 2022-10-03 13:40:18 +02:00
oSumAtrIX
e78a8014bc fix(youtube/general-ads): do not block ads on download_ 2022-10-03 13:40:17 +02:00
oSumAtrIX
72c7604160 refactor(youtube/general-ads): abstract integrations code 2022-10-03 13:40:17 +02:00
semantic-release-bot
199259cb95 chore(release): 0.47.1 [skip ci]
## [0.47.1](https://github.com/revanced/revanced-integrations/compare/v0.47.0...v0.47.1) (2022-10-03)

### Bug Fixes

* **general-ads:** null check for identifier ([d10c546](d10c5462f4))
2022-10-03 01:53:04 +00:00
oSumAtrIX
d10c5462f4 fix(general-ads): null check for identifier 2022-10-03 03:49:57 +02:00
semantic-release-bot
b98e6fa169 chore(release): 0.47.0 [skip ci]
# [0.47.0](https://github.com/revanced/revanced-integrations/compare/v0.46.3...v0.47.0) (2022-10-02)

### Features

* **general-ads:** block carousel ad ([26c208e](26c208e9ed))
2022-10-02 23:28:29 +00:00
oSumAtrIX
26c208e9ed feat(general-ads): block carousel ad 2022-10-03 01:25:04 +02:00
semantic-release-bot
c548f1651a chore(release): 0.46.3 [skip ci]
## [0.46.3](https://github.com/revanced/revanced-integrations/compare/v0.46.2...v0.46.3) (2022-10-02)

### Bug Fixes

* **general-ads:** block remaining ads ([18a749f](18a749f87d))

### Performance Improvements

* **general-ads:** initialize blocks once ([5add970](5add970f61))
2022-10-02 23:21:31 +00:00
oSumAtrIX
5add970f61 perf(general-ads): initialize blocks once 2022-10-03 01:18:09 +02:00
oSumAtrIX
18a749f87d fix(general-ads): block remaining ads 2022-10-03 01:18:09 +02:00
semantic-release-bot
c3e302d224 chore(release): 0.46.2 [skip ci]
## [0.46.2](https://github.com/revanced/revanced-integrations/compare/v0.46.1...v0.46.2) (2022-10-01)

### Performance Improvements

* **general-ads:** hook pathBuilder ([c7756e1](c7756e1299))
2022-10-01 02:05:18 +00:00
oSumAtrIX
1010eedbb2 refactor(general-ads): remove unused method 2022-10-01 04:02:02 +02:00
oSumAtrIX
c7756e1299 perf(general-ads): hook pathBuilder
This removes the hook for the bytebuffer
2022-10-01 03:59:11 +02:00
11 changed files with 388 additions and 178 deletions

View File

@@ -1,3 +1,78 @@
## [0.51.1](https://github.com/revanced/revanced-integrations/compare/v0.51.0...v0.51.1) (2022-10-11)
# [0.51.0](https://github.com/revanced/revanced-integrations/compare/v0.50.0...v0.51.0) (2022-10-06)
### Features
* **youtube/return-youtube-dislike:** decrease request timeout ([#171](https://github.com/revanced/revanced-integrations/issues/171)) ([c372e0e](https://github.com/revanced/revanced-integrations/commit/c372e0e9bdf21ec35b7edbae5e841236f27bd850))
# [0.50.0](https://github.com/revanced/revanced-integrations/compare/v0.49.1...v0.50.0) (2022-10-06)
### Features
* **youtube/general-ads:** do not hide community posts by default ([576991a](https://github.com/revanced/revanced-integrations/commit/576991a7dffa7b5ce92b60932cb6b89daf64c5db))
## [0.49.1](https://github.com/revanced/revanced-integrations/compare/v0.49.0...v0.49.1) (2022-10-04)
### Bug Fixes
* **youtube/sponsorblock:** parse the error response on code 400 ([#169](https://github.com/revanced/revanced-integrations/issues/169)) ([5ab26a4](https://github.com/revanced/revanced-integrations/commit/5ab26a427b06c2b073be9f572e7fa9ad0f7b2270))
# [0.49.0](https://github.com/revanced/revanced-integrations/compare/v0.48.0...v0.49.0) (2022-10-04)
### Features
* **youtube/remember-video-quality:** remember current quality option ([90f7392](https://github.com/revanced/revanced-integrations/commit/90f7392e1a7e331c84cd95ccb11c13d19c92832e))
# [0.48.0](https://github.com/revanced/revanced-integrations/compare/v0.47.1...v0.48.0) (2022-10-03)
### Bug Fixes
* **youtube/general-ads:** do not block ads on `download_` ([e78a801](https://github.com/revanced/revanced-integrations/commit/e78a8014bc8db5177648af16146078227addd1b7))
### Features
* `hide-video-buttons` patch ([bf82e02](https://github.com/revanced/revanced-integrations/commit/bf82e0219fff0eb8512adf270f43d129a62a31ac))
## [0.47.1](https://github.com/revanced/revanced-integrations/compare/v0.47.0...v0.47.1) (2022-10-03)
### Bug Fixes
* **general-ads:** null check for identifier ([d10c546](https://github.com/revanced/revanced-integrations/commit/d10c5462f4a1ec20715686d07fb1219f3e4a1f78))
# [0.47.0](https://github.com/revanced/revanced-integrations/compare/v0.46.3...v0.47.0) (2022-10-02)
### Features
* **general-ads:** block carousel ad ([26c208e](https://github.com/revanced/revanced-integrations/commit/26c208e9ed37ebc686f88756e3203f886cadba10))
## [0.46.3](https://github.com/revanced/revanced-integrations/compare/v0.46.2...v0.46.3) (2022-10-02)
### Bug Fixes
* **general-ads:** block remaining ads ([18a749f](https://github.com/revanced/revanced-integrations/commit/18a749f87def79642205d685fef0af2bea21c087))
### Performance Improvements
* **general-ads:** initialize blocks once ([5add970](https://github.com/revanced/revanced-integrations/commit/5add970f610c567f4b49f2a2ec8574ab393b5b5c))
## [0.46.2](https://github.com/revanced/revanced-integrations/compare/v0.46.1...v0.46.2) (2022-10-01)
### Performance Improvements
* **general-ads:** hook pathBuilder ([c7756e1](https://github.com/revanced/revanced-integrations/commit/c7756e1299bdc2e241525ad89561ea67bc372e3a))
## [0.46.1](https://github.com/revanced/revanced-integrations/compare/v0.46.0...v0.46.1) (2022-09-30)

View File

@@ -7,14 +7,14 @@ plugins {
}
android {
compileSdk = 32
buildToolsVersion = "32.0.0"
compileSdk = 33
buildToolsVersion = "33.0.0"
namespace = "app.revanced.integrations"
defaultConfig {
applicationId = "app.revanced.integrations"
minSdk = 23
targetSdk = 32
targetSdk = 33
versionCode = 1
versionName = "1.0"
multiDexEnabled = false

View File

@@ -1,161 +0,0 @@
package app.revanced.integrations.patches;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
public class GeneralBytecodeAdsPatch {
//Used by app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
public static boolean containsAd(String value, ByteBuffer buffer) {
return containsLithoAd(value, buffer);
}
private static boolean containsLithoAd(String value, ByteBuffer buffer) {
boolean enabled = false;
for (SettingsEnum setting : SettingsEnum.getAdRemovalSettings()) {
if (setting.getBoolean()) {
enabled = true;
break;
}
}
try {
if (value == null || value.isEmpty() || !enabled) return false;
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Searching for AD: " + value);
List<String> blockList = new ArrayList<>();
List<String> bufferBlockList = new ArrayList<>();
if (SettingsEnum.ADREMOVER_AD_REMOVAL.getBoolean()) {
blockList.add("_ad");
blockList.add("ad_badge");
blockList.add("ads_video_with_context");
blockList.add("cell_divider");
blockList.add("reels_player_overlay");
blockList.add("shelf_header");
blockList.add("text_display_ad_with_themed_cta_banner_image");
blockList.add("text_search_ad_with_description_first");
blockList.add("watch_metadata_app_promo");
blockList.add("video_display_full_layout");
bufferBlockList.add("ad_cpn");
}
if (SettingsEnum.ADREMOVER_SUGGESTED_FOR_YOU_REMOVAL.getBoolean()) {
bufferBlockList.add("watch-vrecH");
}
if (SettingsEnum.ADREMOVER_MOVIE_REMOVAL.getBoolean()) {
blockList.add("browsy_bar");
blockList.add("compact_movie");
blockList.add("horizontal_movie_shelf");
blockList.add("movie_and_show_upsell_card");
bufferBlockList.add("YouTube Movies");
}
if (containsAny(value, "home_video_with_context", "related_video_with_context") &&
anyMatch(bufferBlockList, new String(buffer.array(), StandardCharsets.UTF_8)::contains)
) return true;
if (SettingsEnum.ADREMOVER_COMMENTS_REMOVAL.getBoolean()) {
blockList.add("comments_");
}
if (SettingsEnum.ADREMOVER_COMMUNITY_GUIDELINES.getBoolean()) {
blockList.add("community_guidelines");
}
if (SettingsEnum.ADREMOVER_COMPACT_BANNER_REMOVAL.getBoolean()) {
blockList.add("compact_banner");
}
if (SettingsEnum.ADREMOVER_EMERGENCY_BOX_REMOVAL.getBoolean()) {
blockList.add("emergency_onebox");
}
if (SettingsEnum.ADREMOVER_FEED_SURVEY_REMOVAL.getBoolean()) {
blockList.add("in_feed_survey");
}
if (SettingsEnum.ADREMOVER_MEDICAL_PANEL_REMOVAL.getBoolean()) {
blockList.add("medical_panel");
}
if (SettingsEnum.ADREMOVER_PAID_CONTECT_REMOVAL.getBoolean()) {
blockList.add("paid_content_overlay");
}
if (SettingsEnum.ADREMOVER_COMMUNITY_POSTS_REMOVAL.getBoolean()) {
blockList.add("post_base_wrapper");
}
if (SettingsEnum.ADREMOVER_MERCHANDISE_REMOVAL.getBoolean()) {
blockList.add("product_carousel");
}
if (SettingsEnum.ADREMOVER_SHORTS_SHELF.getBoolean()) {
blockList.add("shorts_shelf");
}
if (SettingsEnum.ADREMOVER_INFO_PANEL_REMOVAL.getBoolean()) {
blockList.add("publisher_transparency_panel");
blockList.add("single_item_information_panel");
}
if (SettingsEnum.ADREMOVER_HIDE_SUGGESTIONS.getBoolean()) {
blockList.add("horizontal_video_shelf");
}
if (SettingsEnum.ADREMOVER_HIDE_LATEST_POSTS.getBoolean()) {
blockList.add("post_shelf");
}
if (SettingsEnum.ADREMOVER_HIDE_CHANNEL_GUIDELINES.getBoolean()) {
blockList.add("channel_guidelines_entry_banner");
}
if (containsAny(value,
"home_video_with_context",
"related_video_with_context",
"search_video_with_context",
"menu",
"root",
"-count",
"-space",
"-button"
)) return false;
if (anyMatch(blockList, value::contains)) {
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocking ad: " + value);
return true;
}
if (SettingsEnum.DEBUG.getBoolean()) {
if (value.contains("related_video_with_context")) {
LogHelper.debug(GeneralBytecodeAdsPatch.class, value + " | " + bytesToHex(buffer.array()));
return false;
}
LogHelper.debug(GeneralBytecodeAdsPatch.class, value + " returns false.");
}
return false;
} catch (Exception ex) {
LogHelper.printException(GeneralBytecodeAdsPatch.class, ex.getMessage(), ex);
return false;
}
}
private static boolean containsAny(String value, String... targets) {
for (String string : targets)
if (value.contains(string)) return true;
return false;
}
private static String bytesToHex(byte[] bytes) {
StringBuilder builder = new StringBuilder(bytes.length * 2);
for (byte b : bytes)
builder.append(String.format("%02x", b));
return builder.toString();
}
private static <T> boolean anyMatch(List<T> value, APredicate<? super T> predicate) {
for (T t : value) {
if (predicate.test(t)) return true;
}
return false;
}
@FunctionalInterface
public interface APredicate<T> {
boolean test(T t);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.SharedPrefHelper;
@@ -131,6 +132,9 @@ public class VideoQualityPatch {
}
public static void userChangedQuality(int selectedQuality) {
// Do not remember a **new** quality if REMEMBER_VIDEO_QUALITY is true
if (SettingsEnum.REMEMBER_VIDEO_QUALITY.getBoolean()) return;
selectedQuality1 = selectedQuality;
userChangedQuality = true;
}

View File

@@ -26,7 +26,7 @@ public class ReturnYouTubeDislikeApi {
try {
LogHelper.debug(ReturnYouTubeDislikeApi.class, "Fetching dislikes for " + videoId);
HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.GET_DISLIKES, videoId);
connection.setConnectTimeout(5 * 1000);
connection.setConnectTimeout(1000);
if (connection.getResponseCode() == 200) {
JSONObject json = getJSONObject(connection);
dislikeCount = json.getInt("dislikes");
@@ -181,4 +181,4 @@ public class ReturnYouTubeDislikeApi {
private static JSONObject getJSONObject(HttpURLConnection connection) throws Exception {
return Requester.getJSONObject(connection);
}
}
}

View File

@@ -20,31 +20,39 @@ public enum SettingsEnum {
//Video Settings
OLD_STYLE_QUALITY_SETTINGS("revanced_use_old_style_quality_settings", true, ReturnType.BOOLEAN),
PREFERRED_VIDEO_SPEED("revanced_pref_video_speed", -2.0f, ReturnType.FLOAT),
REMEMBER_VIDEO_QUALITY("revanced_remember_video_quality_selection", true, ReturnType.BOOLEAN),
//Whitelist Settings
//ToDo: Not used atm, Patch missing
ENABLE_WHITELIST("revanced_whitelist_ads_enabled", false, ReturnType.BOOLEAN),
//Ad settings
ADREMOVER_CUSTOM("revanced_adremover_custom_removal", "", ReturnType.STRING, false),
HOME_ADS_REMOVAL("revanced_home_ads_removal", true, ReturnType.BOOLEAN, true),
VIDEO_ADS_REMOVAL("revanced_video_ads_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_AD_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_GENERAL_ADS_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", false, ReturnType.BOOLEAN, true),
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMENTS_REMOVAL("revanced_adremover_comments_removal", false, ReturnType.BOOLEAN, true),
ADREMOVER_MOVIE_REMOVAL("revanced_adremover_movie", true, ReturnType.BOOLEAN, true),
ADREMOVER_FEED_SURVEY_REMOVAL("revanced_adremover_feed_survey", true, ReturnType.BOOLEAN, true),
ADREMOVER_SHORTS_SHELF("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMUNITY_GUIDELINES("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN, true),
ADREMOVER_SHORTS_SHELF_REMOVAL("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMUNITY_GUIDELINES_REMOVAL("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN, true),
ADREMOVER_EMERGENCY_BOX_REMOVAL("revanced_adremover_emergency_box_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN, true),
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN, true),
ADREMOVER_PAID_CONTECT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN, true),
ADREMOVER_SUGGESTED_FOR_YOU_REMOVAL("revanced_adremover_suggested", true, ReturnType.BOOLEAN, true),
ADREMOVER_HIDE_SUGGESTIONS("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN, true),
ADREMOVER_SUGGESTIONS_REMOVAL("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN, true),
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN, true),
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN, true),
// Buttons
HIDE_LIKE_BUTTON("revanced_like_button", false, ReturnType.BOOLEAN, false),
HIDE_DISLIKE_BUTTON("revanced_dislike_button", false, ReturnType.BOOLEAN, false),
HIDE_DOWNLOAD_BUTTON("revanced_download_button", false, ReturnType.BOOLEAN, false),
HIDE_PLAYLIST_BUTTON("revanced_playlist_button", false, ReturnType.BOOLEAN, false),
HIDE_ACTION_BUTTON("revanced_action_button", false, ReturnType.BOOLEAN, false),
HIDE_SHARE_BUTTON("revanced_share_button", false, ReturnType.BOOLEAN, false),
//Layout settings
REEL_BUTTON_SHOWN("revanced_reel_button_enabled", false, ReturnType.BOOLEAN, true),

View File

@@ -102,7 +102,7 @@ public class SBRequester {
SponsorBlockUtils.messageToToast = str("submit_failed_rate_limit");
break;
case 400:
SponsorBlockUtils.messageToToast = str("submit_failed_invalid", connection.getErrorStream());
SponsorBlockUtils.messageToToast = str("submit_failed_invalid", Requester.parseErrorJson(connection));
break;
default:
SponsorBlockUtils.messageToToast = str("submit_failed_unknown_error", responseCode, connection.getResponseMessage());
@@ -222,4 +222,4 @@ public class SBRequester {
private static JSONObject getJSONObject(Route route, String... params) throws Exception {
return Requester.getJSONObject(getConnectionFromRoute(route, params));
}
}
}

View File

@@ -70,7 +70,7 @@ class ClassicSwipeController(
return false
}
override fun onDoubleTapEvent(motionEvent: MotionEvent?): Boolean {
override fun onDoubleTapEvent(motionEvent: MotionEvent): Boolean {
MotionEvent.obtain(motionEvent).let {
controller.dispatchDownstreamTouchEvent(it)
it.recycle()
@@ -79,7 +79,7 @@ class ClassicSwipeController(
return super.onDoubleTapEvent(motionEvent)
}
override fun onLongPress(motionEvent: MotionEvent?) {
override fun onLongPress(motionEvent: MotionEvent) {
MotionEvent.obtain(motionEvent).let {
controller.dispatchDownstreamTouchEvent(it)
it.recycle()

View File

@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -1,3 +1,3 @@
org.gradle.jvmargs = -Xmx2048m
android.useAndroidX = true
version = 0.46.1
version = 0.51.1