feat(core plugins): added NoTrack by default1

This commit is contained in:
cocobo1 2025-09-15 23:04:56 +03:00
parent 6b8b649f54
commit 01ed63f1d6
11 changed files with 149 additions and 9 deletions

View file

@ -74,7 +74,7 @@ const config = {
constModules: {
globals: {
"bunny-build-info": {
version: `"1.2.0"`
version: `"1.2.1"`
}
}
},

View file

@ -15,10 +15,15 @@ const useBadgesModule = findByName("useBadges", false);
export default defineCorePlugin({
manifest: {
id: "bunny.badges",
name: "Badges",
version: "1.0.0",
description: "Adds badges to user's profile",
authors: [{ name: "pylixonly" }]
type: "plugin",
spec: 3,
main: "",
display: {
name: "Badges",
description: "Adds badges to user's profile",
authors: [{ name: "pylixonly" }]
}
},
start() {
const propHolder = {} as Record<string, any>;

View file

@ -8,7 +8,8 @@ interface CorePlugin {
// Called from @lib/plugins
export const getCorePlugins = (): Record<string, CorePlugin> => ({
"bunny.quickinstall": require("./quickinstall"),
"bunny.badges": require("./badges")
"bunny.badges": require("./badges"),
"vendetta.notrack": require("./notrack")
});
/**

View file

@ -0,0 +1,39 @@
import network from "./lib/network";
import console from "./lib/console";
import miscellanous from "./lib/miscellanous";
import sentry from "./lib/sentry";
import { defineCorePlugin } from "..";
import { logger } from "@lib/utils/logger";
const patches = [
network(),
console(),
miscellanous(),
// Sentry causes issues
// sentry(),
];
export default defineCorePlugin({
manifest: {
id: "vendetta.notrack",
version: "1.0.0",
type: "plugin",
spec: 3,
main: "",
display: {
name: "NoTrack",
description: "Disables Discord's telemetry",
authors: [{ name: "maisymoe" }]
}
},
start() {
logger.log("gyat");
const patches = [
network(),
console(),
miscellanous(),
sentry(),
];
}
});

View file

@ -0,0 +1,16 @@
import { logger } from "@lib/utils/logger";
export default () => {
const sentrified = {};
try {
Object.keys(console).forEach((x) => {
sentrified[x] = console[x];
console[x] = console[x].__sentry_original__ ?? console[x];
});
} catch(e) {
logger.log("Failed to de-sentrify console functions!", e);
};
return () => Object.keys(console).forEach((x) => console[x] = sentrified[x]);
}

View file

@ -0,0 +1,33 @@
import { findByProps } from "@metro";
import { noop } from "./utils";
// Stuff in here is non-specific tracking scattered around the app
const AnalyticsUtils = findByProps("AnalyticsActionHandlers");
const SuperPropUtils = findByProps("encodeProperties", "track");
const VoiceStateUtils = findByProps("getVoiceStateMetadata");
const CrashReportUtils = findByProps("submitLiveCrashReport");
const MetricsUtils = findByProps("_metrics");
export default () => {
const patches = [
// Global analytics utilities
...(["handleTrack", "handleFingerprint"].map((i) => noop(i, AnalyticsUtils.AnalyticsActionHandlers))),
// TODO: This is a getter - look into patching it
// noop("analyticsTrackingStoreMaker", AnalyticsUtils),
// Super properties tracking
noop("track", SuperPropUtils),
// Voice state metadata tracking
noop("trackWithMetadata", VoiceStateUtils),
// Crash reporter
noop("submitLiveCrashReport", CrashReportUtils),
// Whatever "metrics" implies
noop("push", MetricsUtils._metrics),
];
return () => patches.forEach((p) => p());
}

View file

@ -0,0 +1,12 @@
import { instead } from "@lib/api/patcher";
export default () => {
// https://github.com/yellowsink/shelter-plugins/blob/3a62d1557b704f4617f72882edba826218eb8c6e/plugins/antitrack/index.js#L10-L25
const analyticsTest = /client-analytics\.braintreegateway\.com|discord\.com\/api\/v9\/(science|track)|app\.adjust\..*|.*\.ingest\.sentry\.io/;
return instead(
"send",
XMLHttpRequest.prototype,
function (args, orig) { if (!analyticsTest.test(this.__sentry_xhr__?.url)) return orig.apply(this, args) },
);
}

View file

@ -0,0 +1,26 @@
import { findByProps } from "@metro";
import { noop } from "./utils";
const Sentry = {
initializer: findByProps("initSentry"),
main: globalThis.__SENTRY__?.hub,
client: globalThis.__SENTRY__?.hub?.getClient(),
};
export default () => {
const patches = [
noop("initSentry", Sentry.initializer),
noop("addBreadcrumb", Sentry.main),
];
Sentry.client.getOptions().enabled = false;
Sentry.client.close();
Sentry.main.getStackTop().scope.clear();
Sentry.main.getScope().clear();
return () => {
patches.forEach((p) => p());
Sentry.client.getOptions().enabled = true;
Sentry.client.open();
};
}

View file

@ -0,0 +1,3 @@
import { instead } from "@lib/api/patcher";
export const noop = (prop: string, parent: any) => instead(prop, parent, () => {});

View file

@ -7,10 +7,15 @@ let patches = [] as (() => unknown)[];
export default defineCorePlugin({
manifest: {
id: "bunny.quickinstall",
name: "QuickInstall",
version: "1.0.0",
description: "Quickly install Vendetta plugins and themes",
authors: [{ name: "Vendetta Team" }]
type: "plugin",
spec: 3,
main: "",
display: {
name: "QuickInstall",
description: "Quickly install Vendetta plugins and themes",
authors: [{ name: "Vendetta Team" }]
}
},
start() {
patches = [patchForumPost(), patchUrl()];

View file

@ -1,6 +1,6 @@
import { StatusBar } from "react-native";
import { findByStoreNameLazy } from "@metro/wrappers";
import { _colorRef } from "./updater"; // <-- import your colorRef
import { _colorRef } from "./updater";
const ThemeStore = findByStoreNameLazy("ThemeStore");