summaryrefslogtreecommitdiff
path: root/src/preload/index.ts
diff options
context:
space:
mode:
authorhaoyuren <13851610112@163.com>2026-03-13 16:48:56 -0500
committerhaoyuren <13851610112@163.com>2026-03-13 16:48:56 -0500
commitc309944494eb2de63bf9b35ea722d50b52e688a3 (patch)
tree043d7a4cbacfa6416a5f6215146ab83f64157ae9 /src/preload/index.ts
parenteb0c0f1a9fc06d05ea0ecaa9361e0beb49eee68e (diff)
Add drag-and-drop file upload, fix project creation modal and API endpoints
- Add file upload to Overleaf projects via multipart POST with correct "name" text field (server reads filename from req.body.name, not from Content-Disposition filename) - Add drag-and-drop support in file tree panel with visual feedback - Replace window.prompt() with custom modal for new project creation (prompt() returns null in Electron) - Fix API endpoints: /api/project/new → /project/new Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/preload/index.ts')
-rw-r--r--src/preload/index.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/preload/index.ts b/src/preload/index.ts
index d36c9e7..1bf97b3 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -1,7 +1,7 @@
// Copyright (c) 2026 Yuren Hao
// Licensed under AGPL-3.0 - see LICENSE file
-import { contextBridge, ipcRenderer } from 'electron'
+import { contextBridge, ipcRenderer, webUtils } from 'electron'
import { createHash } from 'crypto'
const api = {
@@ -136,6 +136,9 @@ const api = {
ipcRenderer.invoke('overleaf:createDoc', projectId, parentFolderId, name) as Promise<{ success: boolean; data?: unknown; message?: string }>,
overleafCreateFolder: (projectId: string, parentFolderId: string, name: string) =>
ipcRenderer.invoke('overleaf:createFolder', projectId, parentFolderId, name) as Promise<{ success: boolean; data?: unknown; message?: string }>,
+ uploadFileToProject: (projectId: string, folderId: string, filePath: string, fileName: string) =>
+ ipcRenderer.invoke('project:uploadFile', projectId, folderId, filePath, fileName) as Promise<{ success: boolean; message?: string }>,
+ getPathForFile: (file: File) => webUtils.getPathForFile(file),
sha1: (text: string): string => createHash('sha1').update(text).digest('hex'),
// File sync bridge