π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Impl
Manav Rathi3ee741abbb2a
diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.tsindex f2d591c0f8..be725ab589 100644--- a/web/packages/new/photos/services/collection.ts+++ b/web/packages/new/photos/services/collection.ts@@ -371,6 +371,49 @@ export const deleteFromTrash = async (fileIDs: number[]) => {}};+/**+ * Rename a collection on remote.+ *+ * Remote only, does not modify local state.+ *+ * @param collection The collection to rename.+ *+ * @param newName The new name of the collection+ */+export const renameCollection = async (+ collection: Collection2,+ newName: string,+) => {+ if (collection.magicMetadata?.data.subType == CollectionSubType.quicklink) {+ // Convert quicklinks to a regular collection before giving them a name.+ await updateCollectionPrivateMagicMetadata(collection, {+ subType: CollectionSubType.default,+ });+ }+ const { encryptedData: encryptedName, nonce: nameDecryptionNonce } =+ await encryptBox(new TextEncoder().encode(newName), collection.key);+ await postCollectionsRename({+ collectionID: collection.id,+ encryptedName,+ nameDecryptionNonce,+ });+};++interface RenameRequest {+ collectionID: number;+ encryptedName: string;+ nameDecryptionNonce: string;+}++const postCollectionsRename = async (renameRequest: RenameRequest) =>+ ensureOk(+ await fetch(await apiURL("/collections/rename"), {+ method: "POST",+ headers: await authenticatedRequestHeaders(),+ body: JSON.stringify(renameRequest),+ }),+ );+/*** Update the private magic metadata contents of a collection on remote.*