Baby's first steps
This commit is contained in:
parent
0161739bc0
commit
89b832d21f
2 changed files with 18 additions and 2 deletions
|
@ -9,7 +9,7 @@
|
|||
* https://www.electronjs.org/docs/latest/tutorial/process-model#the-main-process
|
||||
*/
|
||||
import { nativeImage } from "electron";
|
||||
import { app, BrowserWindow, Menu, Tray } from "electron/main";
|
||||
import { app, BrowserWindow, Menu, protocol, Tray } from "electron/main";
|
||||
import serveNextAt from "next-electron-server";
|
||||
import { existsSync } from "node:fs";
|
||||
import fs from "node:fs/promises";
|
||||
|
@ -229,7 +229,12 @@ const setupTrayItem = (mainWindow: BrowserWindow) => {
|
|||
*
|
||||
* See also: [Note: Transferring large amount of data over IPC]
|
||||
*/
|
||||
const registerStreamProtocol = () => {};
|
||||
const registerStreamProtocol = () => {
|
||||
protocol.handle("stream", (request: Request) => {
|
||||
log.info({ e: "Got incoming stream", request });
|
||||
return new Response("", { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Older versions of our app used to maintain a cache dir using the main
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { ensureElectron } from "@/next/electron";
|
||||
import { isDevBuild } from "@/next/env";
|
||||
import log from "@/next/log";
|
||||
import { CustomError } from "@ente/shared/error";
|
||||
import { Events, eventBus } from "@ente/shared/events";
|
||||
|
@ -992,6 +993,16 @@ class ExportService {
|
|||
fileExportName,
|
||||
file,
|
||||
);
|
||||
// TODO(MR): Productionalize
|
||||
if (isDevBuild) {
|
||||
console.log({ a: "will send req", updatedFileStream });
|
||||
const req = new Request("stream://foo", {
|
||||
method: "POST",
|
||||
body: updatedFileStream,
|
||||
});
|
||||
const res = await fetch(req);
|
||||
console.log({ a: "got res", res });
|
||||
}
|
||||
await electron.saveStreamToDisk(
|
||||
`${collectionExportPath}/${fileExportName}`,
|
||||
updatedFileStream,
|
||||
|
|
Loading…
Reference in a new issue