2022-10-18 22:04:55 +00:00
|
|
|
import patcher from "@lib/patcher";
|
|
|
|
import logger from "@lib/logger";
|
2022-10-28 17:50:40 +00:00
|
|
|
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";
|
2022-10-28 17:50:40 +00:00
|
|
|
import * as components from "@ui/components";
|
|
|
|
import * as toasts from "@ui/toasts";
|
2023-01-08 23:24:00 +00:00
|
|
|
import { patchAssets, all, find, getAssetByID, getAssetByName, getAssetIDByName } from "@ui/assets";
|
2022-10-20 06:58:17 +00:00
|
|
|
import initSettings from "@ui/settings";
|
2023-01-08 23:24:24 +00:00
|
|
|
import { fixTheme } from "@ui/fixTheme";
|
2022-10-28 17:50:40 +00:00
|
|
|
import { connectToDebugger, patchLogHook } from "@lib/debug";
|
2023-01-10 08:05:03 +00:00
|
|
|
import { plugins, fetchPlugin, evalPlugin, stopPlugin, removePlugin, getSettings } from "@lib/plugins";
|
2023-01-10 22:05:40 +00:00
|
|
|
import settings from "@lib/settings";
|
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-18 22:59:45 +00:00
|
|
|
|
2022-10-25 22:50:18 +00:00
|
|
|
try {
|
|
|
|
window.vendetta = {
|
|
|
|
patcher: patcher,
|
2022-10-28 17:50:40 +00:00
|
|
|
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: {
|
2022-10-28 17:50:40 +00:00
|
|
|
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
|
|
|
},
|
2023-01-08 23:24:00 +00:00
|
|
|
plugins: {
|
|
|
|
plugins: plugins,
|
|
|
|
fetchPlugin: fetchPlugin,
|
|
|
|
evalPlugin: evalPlugin,
|
|
|
|
stopPlugin: stopPlugin,
|
|
|
|
removePlugin: removePlugin,
|
|
|
|
getSettings: getSettings
|
|
|
|
},
|
2023-01-10 22:05:40 +00:00
|
|
|
settings: settings,
|
2022-10-28 17:50:40 +00:00
|
|
|
logger: logger,
|
2022-10-25 22:50:18 +00:00
|
|
|
};
|
2023-01-01 21:10:09 +00:00
|
|
|
|
|
|
|
initSettings();
|
|
|
|
patchAssets();
|
|
|
|
patchLogHook();
|
2023-01-08 23:24:24 +00:00
|
|
|
fixTheme();
|
2022-10-25 22:50:18 +00:00
|
|
|
} catch (e: Error | any) {
|
|
|
|
erroredOnLoad = true;
|
2023-01-07 03:13:16 +00:00
|
|
|
alert(`Vendetta failed to initialize... ${e.stack || e.toString()}`);
|
2022-10-25 22:50:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!erroredOnLoad) logger.log("Vendetta is ready!");
|
|
|
|
};
|
2022-10-19 06:58:32 +00:00
|
|
|
|
2022-10-25 22:50:18 +00:00
|
|
|
init();
|