π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Revert "cond type take 1" - It just doesn't seem to work without casts
Manav Rathibd7fec03d372
diff --git a/web/packages/gallery/services/ffmpeg/web.ts b/web/packages/gallery/services/ffmpeg/web.tsindex 890bdd9882..f1b9a6912c 100644--- a/web/packages/gallery/services/ffmpeg/web.ts+++ b/web/packages/gallery/services/ffmpeg/web.ts@@ -44,23 +44,17 @@ const createFFmpeg = async () => {** @param blob The input data on which to run the command, provided as a blob.*- * @param outputFileExtension The extension(s) of the (temporary) output file- * which will be generated by the command. If multiple of these are provided,- * then the first one is used for the OUTPUT placeholder, while the rest of them- * are expected to have been generated by the ffmpeg command implicitly.+ * @param outputFileExtension The extension of the (temporary) output file which+ * will be generated by the command.*- * @returns The contents (bytes as {@link Uint8Array}) of the output file- * generated as a result of executing {@link command} on {@link blob}. If a- * single {@link outputFileExtension} is provided, then the result will be a- * single {@link Uint8Array}, otherwise it will be an array of- * {@link Uint8Array}, one for each entry in {@link outputFileExtension}- * respectively.+ * @returns The contents of the output file generated as a result of executing+ * {@link command} on {@link blob}.*/-export const ffmpegExecWeb = async <T extends string | string[]>(+export const ffmpegExecWeb = async (command: string[],blob: Blob,- outputFileExtension: T,-): Promise<T extends string ? Uint8Array : Uint8Array[]> => {+ outputFileExtension: string,+): Promise<Uint8Array> => {const ffmpeg = await ffmpegLazy();// Interleaving multiple ffmpeg.execs causes errors like//@@ -72,20 +66,14 @@ export const ffmpegExecWeb = async <T extends string | string[]>();};-const ffmpegExec = async <T extends string | string[]>(+const ffmpegExec = async (ffmpeg: FFmpeg,command: string[],- outputFileExtension: T,+ outputFileExtension: string,blob: Blob,-): Promise<T extends string ? Uint8Array : Uint8Array[]> => {+) => {const inputPath = newID("in_");- const firstOutputFileExtension =- typeof outputFileExtension == "string"- ? outputFileExtension- : outputFileExtension[0];- const outputSuffix = firstOutputFileExtension- ? "." + firstOutputFileExtension- : "";+ const outputSuffix = outputFileExtension ? "." + outputFileExtension : "";const outputPath = newID("out_") + outputSuffix;const cmd = substitutePlaceholders(command, inputPath, outputPath);@@ -109,17 +97,12 @@ const ffmpegExec = async <T extends string | string[]>(throw new Error(`ffmpeg command failed with exit code ${status}`);}- if (typeof outputFileExtension == "string") {- const result = await ffmpeg.readFile(outputPath);- if (typeof result == "string")- throw new Error("Expected binary data");+ const result = await ffmpeg.readFile(outputPath);+ if (typeof result == "string") throw new Error("Expected binary data");- const ms = Date.now() - startTime;- log.debug(() => `[wasm] ffmpeg ${cmd.join(" ")} (${ms} ms)`);- return result;- } else {- return [] as Uint8Array[];- }+ const ms = Date.now() - startTime;+ log.debug(() => `[wasm] ffmpeg ${cmd.join(" ")} (${ms} ms)`);+ return result;} finally {try {await ffmpeg.deleteFile(inputPath);