2024-03-06 01:57:59 +08:00
|
|
|
import initFixes from "@core/fixes";
|
|
|
|
|
import { initCorePlugins } from "@core/plugins";
|
|
|
|
|
import initSettings from "@core/ui/settings";
|
2024-03-07 22:14:17 +08:00
|
|
|
import { _patchAssets } from "@lib/api/assets";
|
|
|
|
|
import { _patchCommands } from "@lib/api/commands";
|
|
|
|
|
import { _injectFluxInterceptor } from "@lib/api/flux";
|
2024-03-06 01:57:59 +08:00
|
|
|
import { isThemeSupported } from "@lib/api/native/loader";
|
2024-03-07 22:14:17 +08:00
|
|
|
import { _patchLogHook } from "@lib/debug";
|
|
|
|
|
import { _initPlugins } from "@lib/managers/plugins";
|
|
|
|
|
import { _initThemes, _patchChatBackground } from "@lib/managers/themes";
|
2024-03-07 12:35:07 +08:00
|
|
|
import { logger } from "@lib/utils/logger";
|
2024-02-23 13:29:06 +08:00
|
|
|
import initWindowObject from "@lib/windowObject";
|
2024-03-06 01:57:59 +08:00
|
|
|
import initSafeMode from "@ui/safeMode";
|
2022-10-18 23:04:55 +01:00
|
|
|
|
2023-03-16 00:36:12 +08:00
|
|
|
export default async () => {
|
2024-02-29 20:07:55 +08:00
|
|
|
// Themes
|
|
|
|
|
if (isThemeSupported()) {
|
|
|
|
|
try {
|
2024-03-07 22:14:17 +08:00
|
|
|
_initThemes();
|
2024-02-29 20:07:55 +08:00
|
|
|
} catch (e) {
|
2024-03-01 14:25:43 +08:00
|
|
|
console.error("[Bunny] Failed to initialize themes...", e);
|
2024-02-29 20:07:55 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-16 00:36:12 +08:00
|
|
|
// Load everything in parallel
|
|
|
|
|
const unloads = await Promise.all([
|
2024-03-07 22:14:17 +08:00
|
|
|
_injectFluxInterceptor(),
|
|
|
|
|
_patchLogHook(),
|
|
|
|
|
_patchAssets(),
|
|
|
|
|
_patchCommands(),
|
|
|
|
|
_patchChatBackground(),
|
2023-03-16 00:36:12 +08:00
|
|
|
initFixes(),
|
2023-04-13 18:42:14 +00:00
|
|
|
initSafeMode(),
|
2023-03-16 00:36:12 +08:00
|
|
|
initSettings(),
|
2024-02-28 17:59:47 +08:00
|
|
|
initCorePlugins(),
|
2023-03-16 00:36:12 +08:00
|
|
|
]);
|
2022-10-18 23:04:55 +01:00
|
|
|
|
2023-03-16 00:36:12 +08:00
|
|
|
// Assign window object
|
2024-02-23 13:29:06 +08:00
|
|
|
initWindowObject(unloads);
|
2023-01-01 21:10:09 +00:00
|
|
|
|
2023-03-16 00:36:12 +08:00
|
|
|
// Once done, load plugins
|
2024-03-07 22:14:17 +08:00
|
|
|
unloads.push(await _initPlugins());
|
2023-02-04 02:30:46 +00:00
|
|
|
|
2023-03-16 00:36:12 +08:00
|
|
|
// We good :)
|
2024-03-01 14:25:43 +08:00
|
|
|
logger.log("Bunny is ready!");
|
2024-03-06 01:57:59 +08:00
|
|
|
};
|