Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Ren

Manav Rathic035d5cafa30
diff --git a/web/apps/photos/.env.development b/web/apps/photos/.env.development
index 5b43c1bb87..1fd1fcf31e 100644
--- a/web/apps/photos/.env.development
+++ b/web/apps/photos/.env.development
@@ -26,3 +26,4 @@
#NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
#NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT = http://localhost:3002
+#NEXT_PUBLIC_ENTE_PAYMENTS_ENDPOINT = http://localhost:3002
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx
index 28b908b28a..4d6bae3f57 100644
--- a/web/packages/accounts/pages/credentials.tsx
+++ b/web/packages/accounts/pages/credentials.tsx
@@ -18,7 +18,7 @@ import {
} from "@ente/shared/crypto/helpers";
import type { B64EncryptionResult } from "@ente/shared/crypto/types";
import { CustomError } from "@ente/shared/error";
-import { getAccountsURL, getEndpoint } from "@ente/shared/network/api";
+import { accountsAppURL, getEndpoint } from "@ente/shared/network/api";
import InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore";
import {
LS_KEYS,
@@ -166,7 +166,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
isTwoFactorPasskeysEnabled: true,
});
InMemoryStore.set(MS_KEYS.REDIRECT_URL, PAGES.ROOT);
- window.location.href = `${getAccountsURL()}/passkeys/flow?passkeySessionID=${passkeySessionID}&redirect=${
+ window.location.href = `${accountsAppURL()}/passkeys/flow?passkeySessionID=${passkeySessionID}&redirect=${
window.location.origin
}/passkeys/finish`;
return undefined;
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index 87a954979e..852995a88f 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -10,7 +10,7 @@ import SingleInputForm, {
type SingleInputFormProps,
} from "@ente/shared/components/SingleInputForm";
import { ApiError } from "@ente/shared/error";
-import { getAccountsURL } from "@ente/shared/network/api";
+import { accountsAppURL } from "@ente/shared/network/api";
import InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore";
import localForage from "@ente/shared/storage/localForage";
import { LS_KEYS, getData, setData } from "@ente/shared/storage/localStorage";
@@ -85,7 +85,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
isTwoFactorPasskeysEnabled: true,
});
setIsFirstLogin(true);
- window.location.href = `${getAccountsURL()}/passkeys/flow?passkeySessionID=${passkeySessionID}&redirect=${
+ window.location.href = `${accountsAppURL()}/passkeys/flow?passkeySessionID=${passkeySessionID}&redirect=${
window.location.origin
}/passkeys/finish`;
router.push(PAGES.CREDENTIALS);
diff --git a/web/packages/shared/network/api.ts b/web/packages/shared/network/api.ts
index d6cdb403bf..437f4a45f0 100644
--- a/web/packages/shared/network/api.ts
+++ b/web/packages/shared/network/api.ts
@@ -34,13 +34,16 @@ export const getUploadEndpoint = () => {
return `https://uploader.ente.io`;
};
-export const getAccountsURL = () => {
- const accountsURL = process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT;
- if (accountsURL) {
- return accountsURL;
- }
- return `https://accounts.ente.io`;
-};
+/**
+ * Return the URL of the Ente Accounts app.
+ *
+ * Defaults to our production instance, "https://accounts.ente.io", but can be
+ * overridden by setting the `NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT` environment
+ * variable to a non-empty value.
+ */
+export const accountsAppURL = () =>
+ process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT ||
+ `https://accounts.ente.io`;
export const getAlbumsURL = () => {
const albumsURL = process.env.NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT;