Vencord/src/plugins/noTrack.ts

32 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-08-29 20:05:22 +00:00
import definePlugin from "../utils/types";
2022-08-31 02:07:16 +00:00
import { findByProps } from "../webpack";
2022-08-29 20:05:22 +00:00
const DO_NOTHING = () => void 0;
export default definePlugin({
name: "NoTrack",
description: "Disable Discord's tracking and crash reporting",
author: "Vendicated",
2022-08-31 02:07:16 +00:00
required: true,
2022-08-29 20:05:22 +00:00
start() {
findByProps("getSuperPropertiesBase64", "track").track = DO_NOTHING;
findByProps("submitLiveCrashReport").submitLiveCrashReport = DO_NOTHING;
findByProps("AnalyticsActionHandlers").AnalyticsActionHandlers.handleTrack = DO_NOTHING;
const sentry = window.__SENTRY__;
sentry.logger.disable();
sentry.hub.addBreadcrumb = DO_NOTHING;
sentry.hub.getClient().close(0);
sentry.hub.getScope().clear();
const c = console;
for (const method in c) {
if (c[method].__sentry_original__)
c[method] = c[method].__sentry_original__;
if (c[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__?.__sentry_original__)
c[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__ = c[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__.__sentry_original__;
}
}
});