Revenge/src/index.ts

59 lines
1.8 KiB
TypeScript
Raw Normal View History

2022-10-18 22:04:55 +00:00
import patcher from "@lib/patcher";
import logger from "@lib/logger";
import copyText from "@utils/copyText";
import findInReactTree from "@utils/findInReactTree";
import findInTree from "@utils/findInTree";
import * as constants from "@lib/constants";
2022-10-18 22:04:55 +00:00
import * as metro from "@metro/filters";
import * as common from "@metro/common";
import * as components from "@ui/components";
import * as toasts from "@ui/toasts";
2022-10-22 22:26:06 +00:00
import { all, find, getAssetByID, getAssetByName, getAssetIDByName } from "@ui/assets";
import patchAssets from "@ui/assets";
import initSettings from "@ui/settings";
import { connectToDebugger, patchLogHook } from "@lib/debug";
2022-10-18 22:04:55 +00:00
console.log("Hello from Vendetta!");
2022-10-25 22:50:18 +00:00
async function init() {
let erroredOnLoad = false;
2022-10-25 22:50:18 +00:00
try {
initSettings();
patchAssets();
patchLogHook();
window.vendetta = {
patcher: patcher,
metro: { ...metro, common: { ...common } },
constants: { ...constants },
utils: {
copyText: copyText,
findInReactTree: findInReactTree,
findInTree: findInTree,
},
debug: {
connectToDebugger: connectToDebugger,
},
2022-10-25 22:50:18 +00:00
ui: {
components: { ...components },
toasts: { ...toasts },
2022-10-25 22:50:18 +00:00
assets: {
all: all,
find: find,
getAssetByID: getAssetByID,
getAssetByName: getAssetByName,
getAssetIDByName: getAssetIDByName,
},
2022-10-22 22:26:06 +00:00
},
logger: logger,
2022-10-25 22:50:18 +00:00
};
} catch (e: Error | any) {
erroredOnLoad = true;
alert(`Vendetta failed to initialize...\n${e.stack || e.toString()}`);
}
if (!erroredOnLoad) logger.log("Vendetta is ready!");
};
2022-10-19 06:58:32 +00:00
2022-10-25 22:50:18 +00:00
init();