Skip to content

Commit

Permalink
feat: disable sentry (#663)
Browse files Browse the repository at this point in the history
* feat: disable sentry

* fix: block sentry asset file on other clients

---------

Co-authored-by: Federico Di Leo <[email protected]>
  • Loading branch information
yofukashino and FedeIlLeone authored Feb 2, 2025
1 parent 5ebd1fb commit 1ba4d93
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ async function loadReactDevTools(): Promise<void> {
electron.app.once("ready", () => {
electron.session.defaultSession.webRequest.onBeforeRequest(
{
urls: ["https://*/api/v*/science", "https://*/api/v*/metrics", "https://sentry.io/*"],
urls: [
"https://*/api/v*/science",
"https://*/api/v*/metrics",
"https://*/api/v*/metrics/*",
"https://sentry.io/*",
"https://discord.com/assets/sentry.*.js",
"https://*.discord.com/assets/sentry.*.js",
],
},
function (_details, callback) {
callback({ cancel: true });
Expand Down
17 changes: 17 additions & 0 deletions src/renderer/coremods/notrack/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Injector } from "../../modules/injector";
import { filters, getFunctionKeyBySource, waitForModule } from "../../modules/webpack";

const injector = new Injector();

export async function start(): Promise<void> {
const clientCheckerMod = await waitForModule<Record<string, () => boolean>>(
filters.bySource(".$||"),
);
const clientCheckerKey = getFunctionKeyBySource(clientCheckerMod, ".$||")!;

injector.instead(clientCheckerMod, clientCheckerKey, () => false);
}

export function stop(): void {
injector.uninjectAll();
}
2 changes: 2 additions & 0 deletions src/renderer/managers/coremods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export namespace coremods {
export let notices: Coremod;
export let contextMenu: Coremod;
export let language: Coremod;
export let notrack: Coremod;
export let rpc: Coremod;
export let watcher: Coremod;
export let commands: Coremod;
Expand All @@ -54,6 +55,7 @@ export async function startAll(): Promise<void> {
coremods.notices = await import("../coremods/notices");
coremods.contextMenu = await import("../coremods/contextMenu");
coremods.language = await import("../coremods/language");
coremods.notrack = await import("../coremods/notrack");
coremods.rpc = await import("../coremods/rpc");
coremods.watcher = await import("../coremods/watcher");
coremods.commands = await import("../coremods/commands");
Expand Down

0 comments on commit 1ba4d93

Please sign in to comment.