mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Give up on CapacitorFS, just use IndexedDB
This commit is contained in:
3 files changed
+3
-698
No files matched your search
+3
-26
@@ -6,7 +6,6 @@ import { createHead, UnheadProvider } from '@unhead/react/client';
|
||||
import { InferSeoMetaPlugin } from '@unhead/addons';
|
||||
import { Suspense, useEffect } from 'react';
|
||||
import LightningFS from '@isomorphic-git/lightning-fs';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import NostrProvider from '@/components/NostrProvider';
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
@@ -20,8 +19,6 @@ import { FSProvider } from '@/components/FSProvider';
|
||||
import { ConsoleErrorProvider } from '@/components/ConsoleErrorProvider';
|
||||
import { LightningFSAdapter } from '@/lib/LightningFSAdapter';
|
||||
import { cleanupTmpDirectory } from '@/lib/tmpCleanup';
|
||||
import { CapacitorFSAdapter } from '@/lib/CapacitorFSAdapter';
|
||||
import type { JSRuntimeFS } from '@/lib/JSRuntime';
|
||||
|
||||
import AppRouter from './AppRouter';
|
||||
|
||||
@@ -54,29 +51,9 @@ const presetRelays = [
|
||||
{ url: 'wss://relay.primal.net', name: 'Primal' },
|
||||
];
|
||||
|
||||
/**
|
||||
* Initialize filesystem based on platform
|
||||
*/
|
||||
function initializeFilesystem(): JSRuntimeFS {
|
||||
const isNative = Capacitor.isNativePlatform();
|
||||
const platform = Capacitor.getPlatform();
|
||||
|
||||
console.log(`Initializing filesystem for platform: ${platform} (native: ${isNative})`);
|
||||
|
||||
if (isNative) {
|
||||
// Use native filesystem on Android/iOS
|
||||
console.log('Using Capacitor native filesystem');
|
||||
return new CapacitorFSAdapter();
|
||||
} else {
|
||||
// Use IndexedDB-based filesystem on web
|
||||
console.log('Using LightningFS (IndexedDB)');
|
||||
const lightningFS = new LightningFS('shakespeare-fs');
|
||||
return new LightningFSAdapter(lightningFS.promises);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the appropriate filesystem
|
||||
const fs = initializeFilesystem();
|
||||
// Initialize the filesystem
|
||||
const lightningFS = new LightningFS('shakespeare-fs');
|
||||
const fs = new LightningFSAdapter(lightningFS.promises);
|
||||
|
||||
// Component to handle filesystem cleanup on startup
|
||||
// Automatically removes files older than 1 hour from /tmp directory
|
||||
|
||||
Reference in new issue
Block a user