π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Newer
Manav Rathi10e55b67396b
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsxindex 3d3f9f964a..9108d29d2e 100644--- a/web/apps/photos/src/components/Sidebar/index.tsx+++ b/web/apps/photos/src/components/Sidebar/index.tsx@@ -1,4 +1,5 @@import { openAccountsManagePasskeysPage } from "@/accounts/services/passkey";+import { initiateEmail, openURL } from "@/new/photos/utils/web";import { EnteDrawer } from "@/new/shared/components/EnteDrawer";import log from "@/next/log";import { savedLogs } from "@/next/log-web";@@ -73,7 +74,6 @@ import {isSubscriptionCancelled,isSubscriptionPastDue,} from "utils/billing";-import { openLink } from "utils/common";import { getDownloadAppMessage } from "utils/ui";import { isFamilyAdmin, isPartOfFamily } from "utils/user/family";import { testUpload } from "../../../tests/upload.test";@@ -594,10 +594,10 @@ const HelpSection: React.FC = () => {const { setDialogMessage } = useContext(AppContext);const { openExportModal } = useContext(GalleryContext);- const openRoadmap = () =>- openLink("https://github.com/ente-io/ente/discussions", true);+ const requestFeature = () =>+ openURL("https://github.com/ente-io/ente/discussions");- const contactSupport = () => openLink("mailto:[email protected]", true);+ const contactSupport = () => initiateEmail("[email protected]");function openExport() {if (isElectron()) {@@ -610,7 +610,7 @@ const HelpSection: React.FC = () => {return (<><EnteMenuItem- onClick={openRoadmap}+ onClick={requestFeature}label={t("REQUEST_FEATURE")}variant="secondary"/>diff --git a/web/apps/photos/src/utils/billing/index.ts b/web/apps/photos/src/utils/billing/index.tsindex 302baa97ee..2afe4f395f 100644--- a/web/apps/photos/src/utils/billing/index.ts+++ b/web/apps/photos/src/utils/billing/index.ts@@ -1,3 +1,4 @@+import { openURL } from "@/new/photos/utils/web";import log from "@/next/log";import { SetDialogBoxAttributes } from "@ente/shared/components/DialogBox/types";import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";@@ -8,7 +9,6 @@ import billingService from "services/billingService";import { Plan, Subscription } from "types/billing";import { SetLoading } from "types/gallery";import { BonusData, UserDetails } from "types/user";-import { openLink } from "utils/common";import { getSubscriptionPurchaseSuccessMessage } from "utils/ui";import { getTotalFamilyUsage, isPartOfFamily } from "utils/user/family";@@ -220,7 +220,7 @@ export async function manageFamilyMethod(try {setLoading(true);const familyPortalRedirectURL = getRedirectURL(REDIRECTS.FAMILIES);- openLink(familyPortalRedirectURL, true);+ openURL(familyPortalRedirectURL);} catch (e) {log.error("failed to redirect to family portal", e);setDialogMessage({diff --git a/web/apps/photos/src/utils/common/index.ts b/web/apps/photos/src/utils/common/index.tsindex 9de9f54c41..91628f98c4 100644--- a/web/apps/photos/src/utils/common/index.ts+++ b/web/apps/photos/src/utils/common/index.ts@@ -6,16 +6,6 @@ export const preloadImage = (imgBasePath: string) => {new Image().srcset = srcSet.join(",");};-export function openLink(href: string, newTab?: boolean) {- const a = document.createElement("a");- a.href = href;- if (newTab) {- a.target = "_blank";- }- a.rel = "noreferrer noopener";- a.click();-}-export function isClipboardItemPresent() {return typeof ClipboardItem !== "undefined";}diff --git a/web/apps/photos/src/utils/ui/index.tsx b/web/apps/photos/src/utils/ui/index.tsxindex c930f47c8c..f8c0d6cb12 100644--- a/web/apps/photos/src/utils/ui/index.tsx+++ b/web/apps/photos/src/utils/ui/index.tsx@@ -1,3 +1,4 @@+import { openURL } from "@/new/photos/utils/web";import { ensureElectron } from "@/next/electron";import { AppUpdate } from "@/next/types/ipc";import { DialogBoxAttributes } from "@ente/shared/components/DialogBox/types";@@ -7,7 +8,6 @@ import { Link } from "@mui/material";import { t } from "i18next";import { Trans } from "react-i18next";import { Subscription } from "types/billing";-import { openLink } from "utils/common";export const getDownloadAppMessage = (): DialogBoxAttributes => {return {@@ -25,7 +25,7 @@ export const getDownloadAppMessage = (): DialogBoxAttributes => {};};-const downloadApp = () => openLink("https://ente.io/download/desktop", true);+const downloadApp = () => openURL("https://ente.io/download/desktop");export const getTrashFilesMessage = (deleteFileHelper,diff --git a/web/packages/new/photos/components/MLSettings.tsx b/web/packages/new/photos/components/MLSettings.tsxindex 8e010d0ac6..96d9be767b 100644--- a/web/packages/new/photos/components/MLSettings.tsx+++ b/web/packages/new/photos/components/MLSettings.tsx@@ -28,6 +28,7 @@ import { t } from "i18next";import React, { useEffect, useState } from "react";import { Trans } from "react-i18next";import type { NewAppContextPhotos } from "../types/context";+import { openURL } from "../utils/web";interface MLSettingsProps {/** If `true`, then this drawer page is shown. */@@ -232,8 +233,10 @@ interface EnableMLProps {}const EnableML: React.FC<EnableMLProps> = ({ onEnable }) => {- const showDetails = () => 3;- /*openLink("https://ente.io/blog/desktop-ml-beta", true)*/ return (+ // TODO-ML: Update link.+ const moreDetails = () => openURL("https://ente.io/blog/desktop-ml-beta");++ return (<Stack py={"20px"} px={"16px"} spacing={"32px"}><Typography color="text.muted">{pt(@@ -245,7 +248,7 @@ const EnableML: React.FC<EnableMLProps> = ({ onEnable }) => {{t("ENABLE")}</Button>- <Button color="secondary" size="large" onClick={showDetails}>+ <Button color="secondary" size="large" onClick={moreDetails}>{t("ML_MORE_DETAILS")}</Button></Stack>diff --git a/web/packages/new/photos/utils/web.ts b/web/packages/new/photos/utils/web.tsindex 18f72bd61e..7236cab798 100644--- a/web/packages/new/photos/utils/web.ts+++ b/web/packages/new/photos/utils/web.ts@@ -1,3 +1,16 @@+/**+ * Open the given {@link url} in a new browser tab.+ *+ * @param url The URL to open.+ */+export const openURL = (url: string) => {+ const a = document.createElement("a");+ a.href = url;+ a.target = "_blank";+ a.rel = "noopener";+ a.click();+};+/*** Open the system configured email client, initiating a new email to the given* {@link email} address.@@ -5,6 +18,6 @@export const initiateEmail = (email: string) => {const a = document.createElement("a");a.href = "mailto:" + email;- a.rel = "noreferrer noopener";+ a.rel = "noopener";a.click();};