mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
chore: remove ~13,000 lines of dead Electron code
All business logic has been migrated to the REST API server. This removes obsolete Electron IPC handlers and services that are no longer used: - Deleted electron/services/ directory (18 files) - Deleted electron/agent-service.js - Deleted electron/auto-mode-service.js - Renamed main-simplified.js → main.js - Renamed preload-simplified.js → preload.js - Removed unused dependencies from package.json The Electron layer now only handles native OS features (10 IPC handlers): - File dialogs, shell operations, and app info 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,37 @@
|
||||
const { contextBridge } = require("electron");
|
||||
/**
|
||||
* Simplified Electron preload script
|
||||
*
|
||||
* Only exposes native features (dialogs, shell) and server URL.
|
||||
* All other operations go through HTTP API.
|
||||
*/
|
||||
|
||||
// Only expose a flag to detect Electron environment
|
||||
// All API calls go through HTTP to the backend server
|
||||
contextBridge.exposeInMainWorld("isElectron", true);
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
// Expose platform info for UI purposes
|
||||
contextBridge.exposeInMainWorld("electronPlatform", process.platform);
|
||||
// Expose minimal API for native features
|
||||
contextBridge.exposeInMainWorld("electronAPI", {
|
||||
// Platform info
|
||||
platform: process.platform,
|
||||
isElectron: true,
|
||||
|
||||
console.log("[Preload] Electron flag exposed (HTTP-only mode)");
|
||||
// Connection check
|
||||
ping: () => ipcRenderer.invoke("ping"),
|
||||
|
||||
// Get server URL for HTTP client
|
||||
getServerUrl: () => ipcRenderer.invoke("server:getUrl"),
|
||||
|
||||
// Native dialogs - better UX than prompt()
|
||||
openDirectory: () => ipcRenderer.invoke("dialog:openDirectory"),
|
||||
openFile: (options) => ipcRenderer.invoke("dialog:openFile", options),
|
||||
saveFile: (options) => ipcRenderer.invoke("dialog:saveFile", options),
|
||||
|
||||
// Shell operations
|
||||
openExternalLink: (url) => ipcRenderer.invoke("shell:openExternal", url),
|
||||
openPath: (filePath) => ipcRenderer.invoke("shell:openPath", filePath),
|
||||
|
||||
// App info
|
||||
getPath: (name) => ipcRenderer.invoke("app:getPath", name),
|
||||
getVersion: () => ipcRenderer.invoke("app:getVersion"),
|
||||
isPackaged: () => ipcRenderer.invoke("app:isPackaged"),
|
||||
});
|
||||
|
||||
console.log("[Preload] Electron API exposed (simplified mode)");
|
||||
|
||||
Reference in New Issue
Block a user