Remove isElectron

This commit is contained in:
Alex Gleason committed 2025-10-25 01:28:19 -05:00
1 parent 4bd48a65bb
commit 130cb7055a
5 files changed
+4 -13

No files matched your search

-6
View File
@@ -60,12 +60,6 @@ interface ElectronShellAPI {
}
interface ElectronAPI {
/**
* Flag indicating the app is running in Electron.
* Always `true` when running in Electron.
*/
isElectron: boolean;
/**
* Get the current platform.
* @returns 'darwin' | 'win32' | 'linux'
-3
View File
@@ -9,9 +9,6 @@ contextBridge.exposeInMainWorld('electron', {
// App version
version: () => ipcRenderer.invoke('get-app-version'),
// Flag to indicate we're running in Electron
isElectron: true,
// Filesystem API - paths support tilde (~) expansion for home directory
fs: {
readFile: (path, encoding) => ipcRenderer.invoke('fs:readFile', path, encoding),
+2 -2
View File
@@ -44,7 +44,7 @@ const queryClient = new QueryClient({
// Get OS-specific default paths for Electron
function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: string; fsPathTmp: string } {
if (!window.electron?.isElectron) {
if (!globalThis.electron) {
// Browser defaults - use virtual filesystem paths
return {
fsPathProjects: "/projects",
@@ -109,7 +109,7 @@ const presetRelays = [
// Initialize filesystem adapter based on environment
// In Electron, use Electron filesystem at ~/shakespeare
// In browser, use LightningFS (IndexedDB-backed virtual filesystem)
const fs = window.electron?.isElectron
const fs = globalThis.electron
? new ElectronFSAdapter()
: new LightningFSAdapter(new LightningFS('shakespeare-fs').promises);
+1 -1
View File
@@ -25,7 +25,7 @@ import { SettingsLayout } from "./components/SettingsLayout";
export function AppRouter() {
// Use HashRouter in Electron, BrowserRouter in web
const Router = window.electron?.isElectron ? HashRouter : BrowserRouter;
const Router = globalThis.electron ? HashRouter : BrowserRouter;
return (
<Router>
+1 -1
View File
@@ -18,7 +18,7 @@ import 'prismjs/themes/prism.css';
createRoot(document.getElementById("root")!).render(<App />);
// Register service worker (skip in Electron - doesn't work with file:// protocol)
if ('serviceWorker' in navigator && !window.electron?.isElectron) {
if ('serviceWorker' in navigator && !globalThis.electron) {
window.addEventListener('load', () => {
navigator.serviceWorker
.register('/sw.js')