π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Inline
Manav Rathi8a4df070822f
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsxindex b658cbcf08..7a24b30034 100644--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx@@ -68,7 +68,6 @@ import {import {appendCollectionKeyToShareURL,getDeviceLimitOptions,- shareExpiryOptions,} from "utils/collection";import * as Yup from "yup";@@ -1620,6 +1619,37 @@ const ManageLinkExpiry: React.FC<ManageLinkExpiryProps> = ({);};+export const shareExpiryOptions = () => [+ { label: t("never"), value: () => 0 },+ { label: t("after_time.hour"), value: () => microsecsAfter("hour") },+ { label: t("after_time.day"), value: () => microsecsAfter("day") },+ { label: t("after_time.week"), value: () => microsecsAfter("week") },+ { label: t("after_time.month"), value: () => microsecsAfter("month") },+ { label: t("after_time.year"), value: () => microsecsAfter("year") },+];++const microsecsAfter = (after: "hour" | "day" | "week" | "month" | "year") => {+ let date = new Date();+ switch (after) {+ case "hour":+ date = new Date(date.getTime() + 60 * 60 * 1000);+ break;+ case "day":+ date.setDate(date.getDate() + 1);+ break;+ case "week":+ date.setDate(date.getDate() + 7);+ break;+ case "month":+ date.setMonth(date.getMonth() + 1);+ break;+ case "year":+ date.setFullYear(date.getFullYear() + 1);+ break;+ }+ return date.getTime() * 1000;+};+interface ManageDeviceLimitProps {publicShareProp: PublicURL;collection: Collection;diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.tsindex be545fc410..0a6761bde5 100644--- a/web/apps/photos/src/utils/collection.ts+++ b/web/apps/photos/src/utils/collection.ts@@ -21,7 +21,6 @@ import { updateMagicMetadata } from "@/new/photos/services/magic-metadata";import { safeDirectoryName } from "@/new/photos/utils/native-fs";import { CustomError } from "@ente/shared/error";import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";-import { getUnixTimeInMicroSecondsWithDelta } from "@ente/shared/time";import type { User } from "@ente/shared/user/types";import bs58 from "bs58";import { t } from "i18next";@@ -199,30 +198,6 @@ export function getDeviceLimitOptions() {return [0, 2, 5, 10, 25, 50].map((i) => _intSelectOption(i));}-export const shareExpiryOptions = () => [- { label: t("never"), value: () => 0 },- {- label: t("after_time.hour"),- value: () => getUnixTimeInMicroSecondsWithDelta({ hours: 1 }),- },- {- label: t("after_time.day"),- value: () => getUnixTimeInMicroSecondsWithDelta({ days: 1 }),- },- {- label: t("after_time.week"),- value: () => getUnixTimeInMicroSecondsWithDelta({ days: 7 }),- },- {- label: t("after_time.month"),- value: () => getUnixTimeInMicroSecondsWithDelta({ months: 1 }),- },- {- label: t("after_time.year"),- value: () => getUnixTimeInMicroSecondsWithDelta({ years: 1 }),- },-];-export const changeCollectionVisibility = async (collection: Collection,visibility: ItemVisibility,diff --git a/web/packages/shared/time/index.ts b/web/packages/shared/time/index.tsdeleted file mode 100644index 7b1b3aa5ef..0000000000--- a/web/packages/shared/time/index.ts+++ /dev/null@@ -1,23 +0,0 @@-export interface TimeDelta {- hours?: number;- days?: number;- months?: number;- years?: number;-}--export function getUnixTimeInMicroSecondsWithDelta(delta: TimeDelta): number {- let date = new Date();- if (delta?.hours) {- date = new Date(date.getTime() + delta.hours * 60 * 60 * 1000);- }- if (delta?.days) {- date.setDate(date.getDate() + delta.days);- }- if (delta?.months) {- date.setMonth(date.getMonth() + delta.months);- }- if (delta?.years) {- date.setFullYear(date.getFullYear() + delta.years);- }- return date.getTime() * 1000;-}