From c309944494eb2de63bf9b35ea722d50b52e688a3 Mon Sep 17 00:00:00 2001 From: haoyuren <13851610112@163.com> Date: Fri, 13 Mar 2026 16:48:56 -0500 Subject: Add drag-and-drop file upload, fix project creation modal and API endpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/preload/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/preload') 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 -- cgit v1.2.3