Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Also reproducible on latest beta

Manav Rathi81d1563c3d2c
diff --git a/desktop/package.json b/desktop/package.json
index 69d54f75be..1f368c4b98 100644
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -39,7 +39,7 @@
"@typescript-eslint/eslint-plugin": "^7",
"@typescript-eslint/parser": "^7",
"concurrently": "^8",
- "electron": "^29",
+ "electron": "30.0.0-beta.8",
"electron-builder": "^24",
"electron-builder-notarize": "^1.5",
"eslint": "^8",
diff --git a/desktop/yarn.lock b/desktop/yarn.lock
index a5b86f1eb3..0c314db0f7 100644
--- a/desktop/yarn.lock
+++ b/desktop/yarn.lock
@@ -1214,10 +1214,10 @@ electron-updater@^6.1:
semver "^7.3.8"
tiny-typed-emitter "^2.1.0"
-electron@^29:
- version "29.3.0"
- resolved "https://registry.yarnpkg.com/electron/-/electron-29.3.0.tgz#8e65cb08e9c0952c66d3196e1b5c811c43b8c5b0"
- integrity sha512-ZxFKm0/v48GSoBuO3DdnMlCYXefEUKUHLMsKxyXY4nZGgzbBKpF/X8haZa2paNj23CLfsCKBOtfc2vsEQiOOsA==
+ version "30.0.0-beta.8"
+ resolved "https://registry.yarnpkg.com/electron/-/electron-30.0.0-beta.8.tgz#c4430b9cb662ec147709deaededefe6d7dcc0522"
+ integrity sha512-G2IMMxUVJopiskD5G5iCQh71u1Emp+Q7nS1bWRU/9sK8bKwW1qtyBb3qoq0X9bd7y0LuKUb79AOr3Ix+J6EKaQ==
dependencies:
"@electron/get" "^2.0.0"
"@types/node" "^20.9.0"
diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.ts
index 12b55f68b1..91934059b6 100644
--- a/web/apps/photos/src/utils/native-stream.ts
+++ b/web/apps/photos/src/utils/native-stream.ts
@@ -15,7 +15,35 @@
* @param stream The stream which should be written into the file.
* */
export const writeStream = async (path: string, stream: ReadableStream) => {
+ // return writeStreamOneShot(path, stream)
+ // The duplex parameter needs to be set to 'half' when streaming requests.
+ //
+ // Currently browsers, and specifically in our case, since this code runs
+ // only within our desktop (Electron) app, Chromium, don't support 'full'
+ // duplex mode (i.e. streaming both the request and the response).
+ // https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests
+ const req = new Request(`stream://write${path}`, {
+ // GET can't have a body
+ method: "POST",
+ headers: { "Content-Type": "application/octet-stream" },
+ body: stream,
+ // @ts-expect-error TypeScript's libdom.d.ts does not include the
+ // "duplex" parameter, e.g. see
+ // https://github.com/node-fetch/node-fetch/issues/1769.
+ duplex: "half",
+ });
+ const res = await fetch(req);
+ if (!res.ok)
+ throw new Error(
+ `Failed to write stream to ${path}: HTTP ${res.status}`,
+ );
+};
+
+export const writeStreamOneShot = async (
+ path: string,
+ stream: ReadableStream,
+) => {
const response = new Response(stream);
const blob = await response.blob();
// const ReadableStream()