π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Unused
Manav Rathi3502579b11c6
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsxindex 1a8a8795b3..106a4846f5 100644--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx@@ -58,6 +58,7 @@ import { avatarTextColor } from "ente-new/photos/services/avatar";import {deleteShareURL,shareCollection,+ unshareCollection,} from "ente-new/photos/services/collection";import type { CollectionSummary } from "ente-new/photos/services/collection/ui";import { usePhotosAppContext } from "ente-new/photos/types/context";@@ -70,7 +71,6 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";import { Trans } from "react-i18next";import {createShareableURL,- unshareCollection,updateShareableURL,} from "services/collectionService";import { z } from "zod/v4";@@ -724,7 +724,7 @@ const ManageEmailShare: React.FC<ManageEmailShareProps> = ({const collectionUnshare = async (email: string) => {try {showLoadingBar();- await unshareCollection(collection, email);+ await unshareCollection(collection.id, email);await galleryContext.syncWithRemote(false, true);} finally {hideLoadingBar();diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsxindex 0d87895552..58dfbb4073 100644--- a/web/apps/photos/src/components/Upload.tsx+++ b/web/apps/photos/src/components/Upload.tsx@@ -695,10 +695,7 @@ export const Upload: React.FC<UploadProps> = ({if (!wereFilesProcessed) closeUploadProgress();if (isDesktop) {if (watcher.isUploadRunning()) {- await watcher.allFileUploadsDone(- uploadItemsWithCollection,- collections,- );+ await watcher.allFileUploadsDone(uploadItemsWithCollection);} else if (watcher.isSyncPaused()) {// Resume folder watch after the user upload that// interrupted it is done.diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.tsindex 592311de97..361aaa2e68 100644--- a/web/apps/photos/src/services/collectionService.ts+++ b/web/apps/photos/src/services/collectionService.ts@@ -506,27 +506,6 @@ const renameCollection1 = async ();};-export const unshareCollection = async (- collection: Collection,- withUserEmail: string,-) => {- try {- const token = getToken();- const shareCollectionRequest = {- collectionID: collection.id,- email: withUserEmail,- };- await HTTPService.post(- await apiURL("/collections/unshare"),- shareCollectionRequest,- null,- { "X-Auth-Token": token },- );- } catch (e) {- log.error("unshare collection failed ", e);- }-};-export const createShareableURL = async (collection: Collection) => {try {const token = getToken();diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.tsindex b8e82acd00..904e35e236 100644--- a/web/apps/photos/src/services/watch.ts+++ b/web/apps/photos/src/services/watch.ts@@ -13,7 +13,7 @@ import type {FolderWatchSyncedFile,} from "ente-base/types/ipc";import { type UploadResult } from "ente-gallery/services/upload";-import type { Collection } from "ente-media/collection";+import type { UploadAsset } from "ente-gallery/services/upload/upload-service";import { EncryptedEnteFile } from "ente-media/file";import {getLocalFiles,@@ -370,21 +370,17 @@ class FolderWatcher {* Callback invoked by the uploader whenever all the files we requested to* {@link upload} get uploaded.*/- async allFileUploadsDone(- uploadItemsWithCollection: UploadItemWithCollection[],- collections: Collection[],- ) {+ async allFileUploadsDone(uploadedItems: UploadAsset[]) {const electron = ensureElectron();const watch = this.activeWatch;log.debug(() => ["watch/allFileUploadsDone",- JSON.stringify({ uploadItemsWithCollection, collections, watch }),+ JSON.stringify({ uploadedItems, watch }),]);- const { syncedFiles, ignoredFiles } = this.deduceSyncedAndIgnored(- uploadItemsWithCollection,- );+ const { syncedFiles, ignoredFiles } =+ this.deduceSyncedAndIgnored(uploadedItems);if (syncedFiles.length > 0)await electron.watch.updateSyncedFiles(@@ -404,9 +400,7 @@ class FolderWatcher {this.debouncedRunNextEvent();}- private deduceSyncedAndIgnored(- uploadItemsWithCollection: UploadItemWithCollection[],- ) {+ private deduceSyncedAndIgnored(uploadedItems: UploadAsset[]) {const syncedFiles: FolderWatch["syncedFiles"] = [];const ignoredFiles: FolderWatch["ignoredFiles"] = [];@@ -425,7 +419,7 @@ class FolderWatcher {this.unUploadableFilePaths.delete(path);};- for (const item of uploadItemsWithCollection) {+ for (const item of uploadedItems) {// Re the usage of ensureString: For desktop watch, the only// possibility for a UploadItem is for it to be a string (the// absolute path to a file on disk).diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.tsindex 9ff3619bef..8171dc794e 100644--- a/web/packages/new/photos/services/collection.ts+++ b/web/packages/new/photos/services/collection.ts@@ -518,19 +518,39 @@ export const shareCollection = async (const publicKey = await getPublicKey(withUserEmail);const encryptedKey = await boxSeal(collection.key, publicKey);- const res = await fetch(await apiURL("/collections/share"), {- method: "POST",- headers: await authenticatedRequestHeaders(),- body: JSON.stringify({- collectionID: collection.id,- email: withUserEmail,- role: role,- encryptedKey,+ ensureOk(+ await fetch(await apiURL("/collections/share"), {+ method: "POST",+ headers: await authenticatedRequestHeaders(),+ body: JSON.stringify({+ collectionID: collection.id,+ email: withUserEmail,+ role,+ encryptedKey,+ }),}),- });- ensureOk(res);+ );};+/**+ * Stop sharing a collection on remote with the given user.+ *+ * Remote only, does not modify local state.+ *+ * @param collectionID The ID of the collection to stop sharing with the user+ * having the given {@link email}.+ *+ * @param email The email of the Ente user with whom to stop sharing.+ */+export const unshareCollection = async (collectionID: number, email: string) =>+ ensureOk(+ await fetch(await apiURL("/collections/unshare"), {+ method: "POST",+ headers: await authenticatedRequestHeaders(),+ body: JSON.stringify({ collectionID, email }),+ }),+ );+/*** Delete the public link for the collection with given {@link collectionID}.*