Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

fix: page load crashes on iOS (and older phones)

Maya8e7b8ef35bd9
diff --git a/src/lib/store/index.svelte.ts b/src/lib/store/index.svelte.ts
index 5e1d0dd..eb996a0 100644
--- a/src/lib/store/index.svelte.ts
+++ b/src/lib/store/index.svelte.ts
@@ -600,6 +600,14 @@ function findFirstPositive(
export const getMaxArrayBufferSize = (): number => {
if (typeof window === "undefined") return 2 * GB; // default for SSR
+ // lmao uh mobile devices definitely have a much lower limit and using binary search here
+ // was causing crashes especially on iOS, so just return 2GB to be safe :p
+ if (isMobile) {
+ log(["converters"], `mobile device detected, using 2GB fallback for max ArrayBuffer size`);
+ localStorage.setItem("maxArrayBufferSize", (2 * GB).toString());
+ return 2 * GB;
+ }
+
// check cache first
const cached = localStorage.getItem("maxArrayBufferSize");
if (cached) {