noTrack: switch to patches (#6)
This commit is contained in:
parent
5488f5cecb
commit
71072cf3a3
@ -1,32 +1,24 @@
|
|||||||
import definePlugin from "../utils/types";
|
import definePlugin from "../utils/types";
|
||||||
import { findByProps } from "../webpack";
|
|
||||||
|
|
||||||
const DO_NOTHING = () => void 0;
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "NoTrack",
|
name: "NoTrack",
|
||||||
description: "Disable Discord's tracking and crash reporting",
|
description: "Disable Discord's tracking and crash reporting",
|
||||||
author: "Vendicated",
|
author: "Vendicated",
|
||||||
required: true,
|
required: true,
|
||||||
start() {
|
patches: [
|
||||||
findByProps("getSuperPropertiesBase64", "track").track = DO_NOTHING;
|
{
|
||||||
findByProps("submitLiveCrashReport").submitLiveCrashReport = DO_NOTHING;
|
find: "TRACKING_URL:",
|
||||||
findByProps("AnalyticsActionHandlers").AnalyticsActionHandlers.handleTrack = DO_NOTHING;
|
replacement: {
|
||||||
|
match: /=\(0,.\.analyticsTrackingStoreMaker\)/,
|
||||||
const sentry = window.__SENTRY__;
|
replace: "=(function(){})",
|
||||||
sentry.logger.disable();
|
},
|
||||||
|
},
|
||||||
sentry.hub.addBreadcrumb = DO_NOTHING;
|
{
|
||||||
sentry.hub.getClient().close(0);
|
find: "window.DiscordSentry=",
|
||||||
sentry.hub.getScope().clear();
|
replacement: {
|
||||||
|
match: /window\.DiscordSentry=\(0,.\.initSentry\)\(\)/,
|
||||||
const c = console;
|
replace: "",
|
||||||
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__;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user