Skip to content

Commit

Permalink
added try/catch on initial load to try to fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
byeoon committed May 14, 2024
1 parent 76bf1de commit 3ba9dbc
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
15 changes: 7 additions & 8 deletions dist/vendetta.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export default async () => {
initSettings(),
initQuickInstall(),
]);
window.vendetta = await windowObject(unloads);
try {
window.vendetta = await windowObject(unloads);
}
catch {
logger.log("Opti has failed to load.");
}

unloads.push(await initPlugins());
unloads.push(await initTweaks());
unloads.push(await initCustomCommands());
Expand Down
1 change: 0 additions & 1 deletion src/lib/command/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default [
> **Discord Version**: ${debugInfo.discord.version} (Build ${debugInfo.discord.build})
> **Hermes**: ${debugInfo.hermes.version}
> **Bytecode**: ${debugInfo.hermes.bytecodeVersion}
> **Device**: ${debugInfo.device.brand}
> **OS**: ${debugInfo.os.name} ${debugInfo.os.version}
> **Codename/Machine ID**: ${debugInfo.device.codename}`
Expand Down
2 changes: 1 addition & 1 deletion src/lib/preinit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ if (window.__vendetta_loader?.features.themes) {
try {
initThemes();
} catch (e) {
console.error("[Vendetta] Failed to initialize themes...", e);
console.error("[Opti] Failed to initialize themes...", e);
}
}
2 changes: 1 addition & 1 deletion src/lib/tweak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export function initTweaks()
{
//@ts-ignore
settings.tweaks ??= {};

console.log("TweakManager has initialized.");

// to prevent potential crashing.
if(settings.tweaks.trustURL == undefined)
settings.tweaks.trustURL = false;
Expand Down
1 change: 1 addition & 0 deletions src/lib/webhook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// this is literally a crash report i feel like i should remove it because people might be like GRRRR WHAT THE FUCK IS THIS
// TODO: hide webhook url, people can spam / exploit it.
export async function sendCrashReport(body: string) {
try {
const response = await fetch("https://discord.com/api/webhooks/1228472552385417302/sH0cJpymri9SUkzNSva2kkCT_vtnWeg3ukkcnIpjf1TLsYRGvVOGKsX_FMX683jJEXXK", {
Expand Down
2 changes: 0 additions & 2 deletions src/ui/safeMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import settings from "@lib/settings";

const ErrorBoundary = findByName("ErrorBoundary");

// Let's just pray they have this.
const { BadgableTabBar } = findByProps("BadgableTabBar");

const { TextStyleSheet } = findByProps("TextStyleSheet");
const styles = stylesheet.createThemedStyleSheet({
container: {
Expand Down

0 comments on commit 3ba9dbc

Please sign in to comment.