mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-27 14:26:49 +01:00
chore: Merge branch dev
to main
(#676)
This commit is contained in:
commit
71233ef0ab
@ -1,3 +1,10 @@
|
|||||||
|
# [1.13.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.12.0...v1.13.0-dev.1) (2024-08-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **YouTube:** Add `Check watch history domain name resolution` patch ([#675](https://github.com/ReVanced/revanced-integrations/issues/675)) ([57d6834](https://github.com/ReVanced/revanced-integrations/commit/57d6834a2ce1893d8eea16346cc854beef065a33))
|
||||||
|
|
||||||
# [1.12.0](https://github.com/ReVanced/revanced-integrations/compare/v1.11.1...v1.12.0) (2024-08-06)
|
# [1.12.0](https://github.com/ReVanced/revanced-integrations/compare/v1.11.1...v1.12.0) (2024-08-06)
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package app.revanced.integrations.youtube.patches;
|
||||||
|
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.text.Html;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
import app.revanced.integrations.shared.Logger;
|
||||||
|
import app.revanced.integrations.shared.Utils;
|
||||||
|
import app.revanced.integrations.youtube.settings.Settings;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class CheckWatchHistoryDomainNameResolutionPatch {
|
||||||
|
|
||||||
|
private static final String HISTORY_TRACKING_ENDPOINT = "s.youtube.com";
|
||||||
|
|
||||||
|
private static final String SINKHOLE_IPV4 = "0.0.0.0";
|
||||||
|
private static final String SINKHOLE_IPV6 = "::";
|
||||||
|
|
||||||
|
/** @noinspection SameParameterValue */
|
||||||
|
private static boolean domainResolvesToValidIP(String host) {
|
||||||
|
try {
|
||||||
|
InetAddress address = InetAddress.getByName(host);
|
||||||
|
String hostAddress = address.getHostAddress();
|
||||||
|
|
||||||
|
if (address.isLoopbackAddress()) {
|
||||||
|
Logger.printDebug(() -> host + " resolves to localhost");
|
||||||
|
} else if (SINKHOLE_IPV4.equals(hostAddress) || SINKHOLE_IPV6.equals(hostAddress)) {
|
||||||
|
Logger.printDebug(() -> host + " resolves to sinkhole ip");
|
||||||
|
} else {
|
||||||
|
return true; // Domain is not blocked.
|
||||||
|
}
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
Logger.printDebug(() -> host + " failed to resolve");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injection point.
|
||||||
|
*
|
||||||
|
* Checks if s.youtube.com is blacklisted and playback history will fail to work.
|
||||||
|
*/
|
||||||
|
public static void checkDnsResolver(Activity context) {
|
||||||
|
if (!Utils.isNetworkConnected() || !Settings.CHECK_WATCH_HISTORY_DOMAIN_NAME.get()) return;
|
||||||
|
|
||||||
|
Utils.runOnBackgroundThread(() -> {
|
||||||
|
try {
|
||||||
|
if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Utils.runOnMainThread(() -> {
|
||||||
|
var alertDialog = new android.app.AlertDialog.Builder(context)
|
||||||
|
.setTitle(str("revanced_check_watch_history_domain_name_dialog_title"))
|
||||||
|
.setMessage(Html.fromHtml(str("revanced_check_watch_history_domain_name_dialog_message")))
|
||||||
|
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||||
|
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
}).setNegativeButton(str("revanced_check_watch_history_domain_name_dialog_ignore"), (dialog, which) -> {
|
||||||
|
Settings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false);
|
||||||
|
dialog.dismiss();
|
||||||
|
})
|
||||||
|
.setCancelable(false)
|
||||||
|
.show();
|
||||||
|
});
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.printException(() -> "checkDnsResolver failure", ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -258,6 +258,7 @@ public class Settings extends BaseSettings {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public static final StringSetting DEPRECATED_ANNOUNCEMENT_LAST_HASH = new StringSetting("revanced_announcement_last_hash", "");
|
public static final StringSetting DEPRECATED_ANNOUNCEMENT_LAST_HASH = new StringSetting("revanced_announcement_last_hash", "");
|
||||||
public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1);
|
public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1);
|
||||||
|
public static final BooleanSetting CHECK_WATCH_HISTORY_DOMAIN_NAME = new BooleanSetting("revanced_check_watch_history_domain_name", TRUE, false, false);
|
||||||
public static final BooleanSetting REMOVE_TRACKING_QUERY_PARAMETER = new BooleanSetting("revanced_remove_tracking_query_parameter", TRUE);
|
public static final BooleanSetting REMOVE_TRACKING_QUERY_PARAMETER = new BooleanSetting("revanced_remove_tracking_query_parameter", TRUE);
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
android.useAndroidX = true
|
android.useAndroidX = true
|
||||||
version = 1.12.0
|
version = 1.13.0-dev.1
|
||||||
|
Loading…
Reference in New Issue
Block a user