π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
nn
Manav Rathi29f569307812
diff --git a/desktop/eslint.config.mjs b/desktop/eslint.config.mjsindex 29a4bf34d9..a0812cc88a 100644--- a/desktop/eslint.config.mjs+++ b/desktop/eslint.config.mjs@@ -39,6 +39,10 @@ export default ts.config("error",{ allowTernary: true },],+ // Allow force unwrapping potentially optional values.+ //+ // See: [Note: non-null-assertions have better stack trace]+ "@typescript-eslint/no-non-null-assertion": "off",},},);diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.tsindex d281001798..4d09c1d869 100644--- a/desktop/src/main/stream.ts+++ b/desktop/src/main/stream.ts@@ -9,7 +9,6 @@ import { pathToFileURL } from "node:url";import log from "./log";import { ffmpegConvertToMP4 } from "./services/ffmpeg";import { markClosableZip, openZip } from "./services/zip";-import { ensure } from "./utils/common";import { writeStream } from "./utils/stream";import {deleteTempFile,@@ -57,16 +56,16 @@ const handleStreamRequest = async (request: Request): Promise<Response> => {const { host, searchParams } = new URL(url);switch (host) {case "read":- return handleRead(ensure(searchParams.get("path")));+ return handleRead(searchParams.get("path")!);case "read-zip":return handleReadZip(- ensure(searchParams.get("zipPath")),- ensure(searchParams.get("entryName")),+ searchParams.get("zipPath")!,+ searchParams.get("entryName")!,);case "write":- return handleWrite(ensure(searchParams.get("path")), request);+ return handleWrite(searchParams.get("path")!, request);case "video": {const op = searchParams.get("op");@@ -77,14 +76,16 @@ const handleStreamRequest = async (request: Request): Promise<Response> => {case "generate-hls":return new Response("TODO", { status: 400 });default:- return new Response("", { status: 404 });+ return new Response(`Unknown op ${op}`, {+ status: 404,+ });}}const token = searchParams.get("token");const done = searchParams.get("done") !== null;if (!token) {- return new Response("", { status: 404 });+ return new Response("Missing token", { status: 404 });}return done ? handleVideoDone(token) : handleVideoRead(token);@@ -178,7 +179,7 @@ const handleReadZip = async (zipPath: string, entryName: string) => {};const handleWrite = async (path: string, request: Request) => {- await writeStream(path, ensure(request.body));+ await writeStream(path, request.body!);return new Response("", { status: 200 });};@@ -226,7 +227,7 @@ export const clearPendingVideoResults = () => pendingVideoResults.clear();*/const handleConvertToMP4Write = async (request: Request) => {const inputTempFilePath = await makeTempFilePath();- await writeStream(inputTempFilePath, ensure(request.body));+ await writeStream(inputTempFilePath, request.body!);const outputTempFilePath = await makeTempFilePath("mp4");try {diff --git a/web/packages/build-config/eslintrc-base.mjs b/web/packages/build-config/eslintrc-base.mjsindex b93dd77123..ade20b908c 100644--- a/web/packages/build-config/eslintrc-base.mjs+++ b/web/packages/build-config/eslintrc-base.mjs@@ -40,16 +40,19 @@ export default tseslint.config(],// Allow force unwrapping potentially optional values.//- // It is best if these can be avoided by restructuring the code, but- // there do arise legitimate scenarios where we know from code logic- // that the value should be present. Of course, the surrounding code- // might change causing that expectation to be falsified, but in- // certain cases there isn't much we can do other than throwing an- // exception.+ // [Note: non-null-assertions have better stack trace]+ //+ // It is best if non-null assertions can be avoided by restructuring+ // the code, but there do arise legitimate scenarios where we know+ // from code logic that the value should be present. Of course, the+ // surrounding code might change causing that expectation to be+ // falsified, but in certain cases there isn't much we can do other+ // than throwing an exception.//// Instead of rolling our own such exception (which we in fact used- // to do at one point), rely on the JS's native undefined property- // access exception since that conveys more information in the logs.+ // to do at, look in git history a utility function named "ensure"),+ // it is better rely on the JS's native undefined property access+ // exception since that conveys more information in the logs."@typescript-eslint/no-non-null-assertion": "off",// Allow `while(true)` etc."@typescript-eslint/no-unnecessary-condition": [