π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
conv
Manav Rathi2b784d80c3dd
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsxindex 72730911b4..540330ff51 100644--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx@@ -25,7 +25,7 @@ import type {PublicURL,UpdatePublicURL,} from "@/media/collection";-import { COLLECTION_ROLE, type CollectionUser } from "@/media/collection";+import { type CollectionUser } from "@/media/collection";import { PublicLinkCreated } from "@/new/photos/components/share/PublicLinkCreated";import { avatarTextColor } from "@/new/photos/services/avatar";import type { CollectionSummary } from "@/new/photos/services/collection/ui";@@ -153,12 +153,12 @@ function SharingDetails({ collection, type }) {: collection.owner?.email;const collaborators = collection.sharees- ?.filter((sharee) => sharee.role === COLLECTION_ROLE.COLLABORATOR)+ ?.filter((sharee) => sharee.role == "COLLABORATOR").map((sharee) => sharee.email);const viewers =collection.sharees- ?.filter((sharee) => sharee.role === COLLECTION_ROLE.VIEWER)+ ?.filter((sharee) => sharee.role == "VIEWER").map((sharee) => sharee.email) || [];const isOwner = galleryContext.user?.id === collection.owner?.id;@@ -345,17 +345,15 @@ const EmailShare: React.FC<EmailShareProps> = ({ collection, onRootClose }) => {const closeManageEmailShare = () => setManageEmailShareView(false);const openManageEmailShare = () => setManageEmailShareView(true);- const participantType = useRef<- COLLECTION_ROLE.COLLABORATOR | COLLECTION_ROLE.VIEWER- >(undefined);+ const participantType = useRef<"COLLABORATOR" | "VIEWER">(undefined);const openAddCollab = () => {- participantType.current = COLLECTION_ROLE.COLLABORATOR;+ participantType.current = "COLLABORATOR";openAddParticipant();};const openAddViewer = () => {- participantType.current = COLLECTION_ROLE.VIEWER;+ participantType.current = "VIEWER";openAddParticipant();};@@ -469,7 +467,7 @@ interface AddParticipantProps {open: boolean;onClose: () => void;onRootClose: () => void;- type: COLLECTION_ROLE.VIEWER | COLLECTION_ROLE.COLLABORATOR;+ type: "VIEWER" | "COLLABORATOR";}const AddParticipant: React.FC<AddParticipantProps> = ({@@ -541,7 +539,7 @@ const AddParticipant: React.FC<AddParticipantProps> = ({{...{ onClose }}onRootClose={handleRootClose}title={- type === COLLECTION_ROLE.VIEWER+ type == "VIEWER"? t("add_viewers"): t("add_collaborators")}@@ -554,7 +552,7 @@ const AddParticipant: React.FC<AddParticipantProps> = ({placeholder={t("enter_email")}fieldType="email"buttonText={- type === COLLECTION_ROLE.VIEWER+ type == "VIEWER"? t("add_viewers"): t("add_collaborators")}@@ -818,19 +816,17 @@ const ManageEmailShare: React.FC<ManageEmailShareProps> = ({const closeAddParticipant = () => setAddParticipantView(false);const openAddParticipant = () => setAddParticipantView(true);- const participantType = useRef<- COLLECTION_ROLE.COLLABORATOR | COLLECTION_ROLE.VIEWER- >(null);+ const participantType = useRef<"COLLABORATOR" | "VIEWER">(null);const selectedParticipant = useRef<CollectionUser>(null);const openAddCollab = () => {- participantType.current = COLLECTION_ROLE.COLLABORATOR;+ participantType.current = "COLLABORATOR";openAddParticipant();};const openAddViewer = () => {- participantType.current = COLLECTION_ROLE.VIEWER;+ participantType.current = "VIEWER";openAddParticipant();};@@ -857,12 +853,12 @@ const ManageEmailShare: React.FC<ManageEmailShareProps> = ({const isOwner = galleryContext.user.id === collection.owner?.id;const collaborators = collection.sharees- ?.filter((sharee) => sharee.role === COLLECTION_ROLE.COLLABORATOR)+ ?.filter((sharee) => sharee.role == "COLLABORATOR").map((sharee) => sharee.email);const viewers =collection.sharees- ?.filter((sharee) => sharee.role === COLLECTION_ROLE.VIEWER)+ ?.filter((sharee) => sharee.role == "VIEWER").map((sharee) => sharee.email) || [];const openManageParticipant = (email) => {diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.tsindex 1ece43eb8f..815c0cae29 100644--- a/web/apps/photos/src/utils/collection.ts+++ b/web/apps/photos/src/utils/collection.ts@@ -3,7 +3,6 @@ import { joinPath } from "@/base/file-name";import log from "@/base/log";import { updateMagicMetadata } from "@/gallery/services/magic-metadata";import {- COLLECTION_ROLE,type Collection,CollectionMagicMetadataProps,CollectionPublicMagicMetadataProps,@@ -306,7 +305,7 @@ export const isQuickLinkCollection = (collection: Collection) =>export function isIncomingViewerShare(collection: Collection, user: User) {const sharee = collection.sharees?.find((sharee) => sharee.id === user.id);- return sharee?.role === COLLECTION_ROLE.VIEWER;+ return sharee?.role == "VIEWER";}export function isValidMoveTarget(diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.tsindex 07784ae074..26a5f5d94f 100644--- a/web/packages/media/collection.ts+++ b/web/packages/media/collection.ts@@ -8,17 +8,12 @@ import { ItemVisibility } from "@/media/file-metadata";export type CollectionType = "folder" | "favorites" | "album" | "uncategorized";-export enum COLLECTION_ROLE {- VIEWER = "VIEWER",- OWNER = "OWNER",- COLLABORATOR = "COLLABORATOR",- UNKNOWN = "UNKNOWN",-}+export type CollectionRole = "VIEWER" | "OWNER" | "COLLABORATOR" | "UNKNOWN";export interface CollectionUser {id: number;email: string;- role: COLLECTION_ROLE;+ role: CollectionRole;}export interface EncryptedCollection {diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex 257c976529..dc5d82e253 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -2,7 +2,7 @@ import {isArchivedCollection,isPinnedCollection,} from "@/gallery/services/magic-metadata";-import { COLLECTION_ROLE, type Collection } from "@/media/collection";+import { type Collection } from "@/media/collection";import type { EnteFile, FilePrivateMagicMetadata } from "@/media/file";import { mergeMetadata } from "@/media/file";import { isArchivedFile } from "@/media/file-metadata";@@ -1457,7 +1457,7 @@ const isIncomingCollabShare = (collection: Collection, user: User) => {// TODO: Need to audit the types// eslint-disable-next-line @typescript-eslint/no-unnecessary-conditionconst sharee = collection.sharees?.find((sharee) => sharee.id === user.id);- return sharee?.role === COLLECTION_ROLE.COLLABORATOR;+ return sharee?.role == "COLLABORATOR";};const isOutgoingShare = (collection: Collection, user: User) =>diff --git a/web/packages/new/photos/services/files.ts b/web/packages/new/photos/services/files.tsindex 61c1e4e90b..d46fd10646 100644--- a/web/packages/new/photos/services/files.ts+++ b/web/packages/new/photos/services/files.ts@@ -33,7 +33,7 @@ export const getAllLocalFiles = async () =>* "hidden" to get it to instead return hidden files that we know about locally.*/export const getLocalFiles = async (type: "normal" | "hidden" = "normal") => {- const tableName = type === "normal" ? FILES_TABLE : HIDDEN_FILES_TABLE;+ const tableName = type == "normal" ? FILES_TABLE : HIDDEN_FILES_TABLE;const files: EnteFile[] =(await localForage.getItem<EnteFile[]>(tableName)) ?? [];return files;@@ -48,7 +48,7 @@ export const setLocalFiles = async (type: "normal" | "hidden",files: EnteFile[],) => {- const tableName = type === "normal" ? FILES_TABLE : HIDDEN_FILES_TABLE;+ const tableName = type == "normal" ? FILES_TABLE : HIDDEN_FILES_TABLE;await localForage.setItem(tableName, files);};