Skip to content

armgit / ente

Public Imported from GitHub
0

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

Get all files

Manav Rathi094f1daef3a8
diff --git a/web/apps/cast/src/services/cast.ts b/web/apps/cast/src/services/cast.ts
index fcb96447a4..3f2439af3b 100644
--- a/web/apps/cast/src/services/cast.ts
+++ b/web/apps/cast/src/services/cast.ts
@@ -209,6 +209,37 @@ const getCastCollection = async (
};
};
+/**
+ * Fetch the list of non-deleted files in the given collection.
+ *
+ * The returned files are not decrypted yet, so their metadata will not be
+ * readable.
+ */
+const getEncryptedCollectionFiles = async (
+ castToken: string,
+): Promise<EncryptedEnteFile[]> => {
+ let files: EncryptedEnteFile[] = [];
+ let sinceTime = 0;
+ let resp;
+ do {
+ resp = await HTTPService.get(
+ `${getEndpoint()}/cast/diff`,
+ { sinceTime },
+ {
+ "Cache-Control": "no-cache",
+ "X-Cast-Access-Token": castToken,
+ },
+ );
+ const diff = resp.data.diff;
+ files = files.concat(diff.filter((file) => !file.isDeleted));
+ sinceTime = diff.reduce(
+ (max, file) => Math.max(max, file.updationTime),
+ sinceTime,
+ );
+ } while (resp.data.hasMore);
+ return files;
+};
+
const syncPublicFiles = async (
castToken: string,
collection: Collection,