From 2d268365bc1f9f9b550812a8aa406b7abc005497 Mon Sep 17 00:00:00 2001 From: haoyuren <13851610112@163.com> Date: Fri, 13 Mar 2026 16:56:13 -0500 Subject: Add bidirectional sync for binary files (PDF, images, etc.) FileSyncBridge now handles binary fileRefs in addition to text docs: - Downloads all binary files to temp dir on project connect - Watches for binary file changes on disk and uploads via REST API - Listens for Overleaf socket events (reciveNewFile, reciveNewDoc, removeEntity, reciveEntityRename) to sync remote changes to disk - Tracks binary files by SHA1 hash to avoid redundant uploads Co-Authored-By: Claude Opus 4.6 --- src/main/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/main/index.ts') diff --git a/src/main/index.ts b/src/main/index.ts index 7d70238..0d93b17 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -4,7 +4,6 @@ import { app, BrowserWindow, ipcMain, dialog, shell, net } from 'electron' import { join, basename } from 'path' import { readFile, writeFile } from 'fs/promises' -import { createReadStream } from 'fs' import { spawn } from 'child_process' import * as pty from 'node-pty' import { OverleafSocket, type RootFolder, type SubFolder, type JoinDocResult } from './overleafSocket' @@ -650,7 +649,7 @@ ipcMain.handle('ot:connect', async (_e, projectId: string) => { // Set up file sync bridge for bidirectional sync const tmpDir = compilationManager.dir - fileSyncBridge = new FileSyncBridge(overleafSock, tmpDir, docPathMap, pathDocMap, mainWindow!) + fileSyncBridge = new FileSyncBridge(overleafSock, tmpDir, docPathMap, pathDocMap, fileRefs, mainWindow!, projectId, overleafSessionCookie, overleafCsrfToken) fileSyncBridge.start().catch((e) => { console.log('[ot:connect] fileSyncBridge start error:', e) }) -- cgit v1.2.3