mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Remove isElectron
This commit is contained in:
5 files changed
+4
-13
No files matched your search
Vendored
-6
@@ -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'
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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')
|
||||
|
||||
Reference in new issue
Block a user