Imrpove chat with gifs, videos, music player, redesigns and improved filesharing errors
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
app,
|
||||
desktopCapturer,
|
||||
dialog,
|
||||
ipcMain,
|
||||
shell
|
||||
} from 'electron';
|
||||
@@ -54,6 +55,24 @@ export function setupSystemHandlers(): void {
|
||||
return true;
|
||||
});
|
||||
|
||||
ipcMain.handle('save-file-as', async (_event, defaultFileName: string, base64Data: string) => {
|
||||
const result = await dialog.showSaveDialog({
|
||||
defaultPath: defaultFileName
|
||||
});
|
||||
|
||||
if (result.canceled || !result.filePath) {
|
||||
return { saved: false,
|
||||
cancelled: true };
|
||||
}
|
||||
|
||||
const buffer = Buffer.from(base64Data, 'base64');
|
||||
|
||||
await fsp.writeFile(result.filePath, buffer);
|
||||
|
||||
return { saved: true,
|
||||
cancelled: false };
|
||||
});
|
||||
|
||||
ipcMain.handle('ensure-dir', async (_event, dirPath: string) => {
|
||||
await fsp.mkdir(dirPath, { recursive: true });
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user