this repo has no description
1import { join } from "node:path";
2import { Module } from "node:module";
3import { BrowserWindow } from "electron";
4
5const logger = moonlightHost.getLogger("disableSentry");
6
7try {
8 const hostSentryPath = require.resolve(
9 join(moonlightHost.asarPath, "node_modules", "@sentry", "electron")
10 );
11 require.cache[hostSentryPath] = new Module(
12 hostSentryPath,
13 require.cache[require.resolve(moonlightHost.asarPath)]
14 );
15 require.cache[hostSentryPath]!.exports = {
16 init: () => {},
17 captureException: () => {},
18 setTag: () => {},
19 setUser: () => {}
20 };
21 logger.debug("Stubbed Sentry host side!");
22} catch (err) {
23 logger.error("Failed to stub Sentry host side:", err);
24}
25
26moonlightHost.events.on("window-created", (window: BrowserWindow) => {
27 window.webContents.session.webRequest.onBeforeRequest(
28 {
29 urls: [
30 "https://*.sentry.io/*",
31 "https://*.discord.com/error-reporting-proxy/*"
32 ]
33 },
34 function (details, callback) {
35 callback({ cancel: true });
36 }
37 );
38});