Skip to content

Commit

Permalink
deploy: dbb0c6b
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowsink committed Jan 12, 2025
1 parent 42a7358 commit f6798e5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
36 changes: 31 additions & 5 deletions antitrack/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,38 @@
"use strict";

//#region plugins/antitrack/index.js
const { scoped } = shelter.plugin;
const { plugin: { scoped }, util: { log } } = shelter;
try {
window.__SENTRY__.hub.getClient().getOptions().enabled = false;
Object.keys(console).forEach((x) => console[x] = console[x].__sentry_original__ ?? console[x]);
} catch {}
scoped.http.intercept("POST", /^\/science|^\/error-reporting-proxy/, () => {});
if (DiscordSentry) DiscordSentry.close();
else Object.defineProperty(window, "DiscordSentry", {
set(v) {
delete window.DiscordSentry;
window.DiscordSentry = v;
setTimeout(v.close);
},
enumerable: false,
configurable: true
});
} catch (e) {
log(`[Antitrack] Error while disabling Sentry ${e}`);
}
try {
Object.keys(console).forEach((func) => {
const original = console[func]?.__sentry_original__;
if (!original) return;
console[func] = original;
});
} catch (e) {
log(`[Antitrack] Error while unpatching console functions ${e}`);
}
scoped.http.intercept("POST", /^\/science/, () => {});
const metricsRe = /^https?:\/\/([a-z0-9\-]+\.)?discord\.com\/api\/v\d+\/metrics/;
const getSentryProp = (obj) => obj[Object.keys(obj).find((k) => k.startsWith("__sentry_xhr"))];
scoped.patcher.instead("send", XMLHttpRequest.prototype, function(args, orig) {
const url = getSentryProp(this)?.url;
if (typeof url === "string" && metricsRe.test(url)) return;
return orig.apply(this, args);
});

//#endregion
})();
2 changes: 1 addition & 1 deletion antitrack/plugin.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"Antitrack","description":"The essential.","author":"Yellowsink","hash":"eb4c72e5ce13d670237f727b3bd2b0b9"}
{"name":"Antitrack","description":"The essential.","author":"Yellowsink","hash":"1c0b7ced93be17a775b05e83f703db47"}

0 comments on commit f6798e5

Please sign in to comment.