π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Forward
Manav Rathifb16346b0de9
diff --git a/desktop/src/main/services/ffmpeg-worker.ts b/desktop/src/main/services/ffmpeg-worker.tsindex 5e16772372..f687ef26cd 100644--- a/desktop/src/main/services/ffmpeg-worker.ts+++ b/desktop/src/main/services/ffmpeg-worker.ts@@ -44,7 +44,7 @@ export interface FFmpegUtilityProcess {ffmpegGenerateHLSPlaylistAndSegments: (inputFilePath: string,outputPathPrefix: string,- outputUploadURL: string,+ uploadURLs: string[],) => Promise<FFmpegGenerateHLSPlaylistAndSegmentsResult | undefined>;ffmpegDetermineVideoDuration: (inputFilePath: string) => Promise<number>;@@ -220,7 +220,7 @@ export interface FFmpegGenerateHLSPlaylistAndSegmentsResult {const ffmpegGenerateHLSPlaylistAndSegments = async (inputFilePath: string,outputPathPrefix: string,- outputUploadURL: string,+ uploadURLs: string[],): Promise<FFmpegGenerateHLSPlaylistAndSegmentsResult | undefined> => {const { isH264, isHDR, bitrate } =await detectVideoCharacteristics(inputFilePath);@@ -520,7 +520,7 @@ const ffmpegGenerateHLSPlaylistAndSegments = async (// the generated .ts file.videoSize = await fs.stat(videoPath).then((st) => st.size);- await uploadVideoSegments(videoPath, videoSize, outputUploadURL);+ await uploadVideoSegments(videoPath, videoSize, uploadURLs);} catch (e) {log.error("HLS generation failed", e);await Promise.all([deletePathIgnoringErrors(playlistPath)]);@@ -784,7 +784,7 @@ const pseudoFFProbeVideo = async (inputFilePath: string) => {/*** Upload the file at the given {@link videoFilePath} to the provided presigned- * {@link objectUploadURL} using a HTTP PUT request.+ * URL(s) using a HTTP PUT request.** In case on non-HTTP-4xx errors, retry up to 3 times with exponential backoff.*@@ -795,7 +795,9 @@ const pseudoFFProbeVideo = async (inputFilePath: string) => {** @param videoSize The size in bytes of the file at {@link videoFilePath}.*- * @param objectUploadURL A pre-signed URL to upload the file.+ * @param uploadURLs A pre-signed URL(s) to upload the file. For singular+ * uploads this'll be a singleton array, otherwise will contain multipart URLs+ * and completion URL.** ---*@@ -819,10 +821,17 @@ const pseudoFFProbeVideo = async (inputFilePath: string) => {const uploadVideoSegments = async (videoFilePath: string,videoSize: number,- objectUploadURL: string,+ uploadURLs: string[],) => {const waitTimeBeforeNextTry = [5000, 20000];+ if (uploadURLs.length != 1) throw new Error("TODO(HLS): WIP");+ // This can be either a single pre-signed URL (for a normal upload), or a+ // list of part upload URLs and a completion URL (for multipart uploads).+ //+ // See: [Note: Passing HLS multipart upload URLs over IPC]+ const objectUploadURL = uploadURLs[0]!;+while (true) {let abort = false;try {diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.tsindex 58767c5ae1..222f7333ef 100644--- a/desktop/src/main/stream.ts+++ b/desktop/src/main/stream.ts@@ -277,9 +277,10 @@ const handleVideoDone = async (token: string) => {** The difference here is that we the conversion generates two streams^ - one* for the HLS playlist itself, and one for the file containing the encrypted- * and transcoded video chunks. The video stream we write to the objectUploadURL- * (provided via {@link params}), and then we return a JSON object containing- * the token for the playlist, and other metadata for use by the renderer.+ * and transcoded video chunks. The video stream we write to the pre-signed+ * object upload URL(s) (provided via {@link params}), and then we return a JSON+ * object containing the token for the playlist, and other metadata for use by+ * the renderer.** ^ if the video doesn't require a stream to be generated (e.g. it is very* small and already uses a compatible codec) then a HTT 204 is returned and@@ -289,8 +290,8 @@ const handleGenerateHLSWrite = async (request: Request,params: URLSearchParams,) => {- const objectUploadURL = params.get("objectUploadURL");- if (!objectUploadURL) throw new Error("Missing objectUploadURL");+ const uploadURLs = params.getAll("url");+ if (uploadURLs.length) throw new Error("Missing upload URL(s)");let inputItem: Parameters<typeof makeFileForStreamOrPathOrZipItem>[0];const path = params.get("path");@@ -324,7 +325,7 @@ const handleGenerateHLSWrite = async (result = await worker.ffmpegGenerateHLSPlaylistAndSegments(inputFilePath,outputFilePathPrefix,- objectUploadURL,+ uploadURLs,);if (!result) {