[general] Disable Sentry and analytics

This commit is contained in:
amsyarasyiq 2024-04-30 20:41:04 +08:00
parent ca703ad0fe
commit 273f36594f
2 changed files with 12 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import { instead } from "spitroast";
// @ts-ignore - shut up fr
globalThis.window = globalThis;
const init = (async () => {
const init = () => {
try {
// This logs in the native logging implementation, e.g. logcat
console.log("Hello from Bunny! Pyon!");
@ -12,7 +12,7 @@ const init = (async () => {
// Make 'freeze' and 'seal' do nothing
Object.freeze = Object.seal = Object;
await import(".").then(m => m.default());
require(".").default();
} catch (e) {
const { ClientInfoManager } = require("@lib/api/native/modules");
const stack = e instanceof Error ? e.stack : undefined;
@ -25,7 +25,7 @@ const init = (async () => {
stack || e?.toString?.(),
].join("\n"));
}
});
};
// @ts-ignore
if (typeof globalThis.__r !== "undefined") {

View file

@ -46,8 +46,8 @@ for (const id in window.modules) {
return importAll.default = exp, importAll;
};
orig(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
if (moduleObject.exports) onModuleRequire(moduleObject.exports, id);
orig(...args);
if (moduleObject.exports) onModuleRequire(moduleObject.exports);
});
}
}
@ -64,7 +64,13 @@ for (const id in window.modules) {
let patchedInspectSource = false;
function onModuleRequire(exports: any, id: string) {
function onModuleRequire(exports: any) {
// Temporary
exports.initSentry &&= () => { };
if (exports.default?.track && exports.default.trackMaker) {
exports.default.track = () => Promise.resolve();
}
// There are modules registering the same native component
if (exports?.default?.name === "requireNativeComponent") {
instead("default", exports, (args, orig) => {