This commit is contained in:
Manav Rathi 2024-06-06 12:16:07 +05:30
parent d247cc6cad
commit c035d5cafa
No known key found for this signature in database
4 changed files with 15 additions and 11 deletions

View File

@ -26,3 +26,4 @@
#NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002 #NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
#NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT = http://localhost:3002 #NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT = http://localhost:3002
#NEXT_PUBLIC_ENTE_PAYMENTS_ENDPOINT = http://localhost:3002

View File

@ -18,7 +18,7 @@ import {
} from "@ente/shared/crypto/helpers"; } from "@ente/shared/crypto/helpers";
import type { B64EncryptionResult } from "@ente/shared/crypto/types"; import type { B64EncryptionResult } from "@ente/shared/crypto/types";
import { CustomError } from "@ente/shared/error"; 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 InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore";
import { import {
LS_KEYS, LS_KEYS,
@ -166,7 +166,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
isTwoFactorPasskeysEnabled: true, isTwoFactorPasskeysEnabled: true,
}); });
InMemoryStore.set(MS_KEYS.REDIRECT_URL, PAGES.ROOT); 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 window.location.origin
}/passkeys/finish`; }/passkeys/finish`;
return undefined; return undefined;

View File

@ -10,7 +10,7 @@ import SingleInputForm, {
type SingleInputFormProps, type SingleInputFormProps,
} from "@ente/shared/components/SingleInputForm"; } from "@ente/shared/components/SingleInputForm";
import { ApiError } from "@ente/shared/error"; 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 InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore";
import localForage from "@ente/shared/storage/localForage"; import localForage from "@ente/shared/storage/localForage";
import { LS_KEYS, getData, setData } from "@ente/shared/storage/localStorage"; import { LS_KEYS, getData, setData } from "@ente/shared/storage/localStorage";
@ -85,7 +85,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
isTwoFactorPasskeysEnabled: true, isTwoFactorPasskeysEnabled: true,
}); });
setIsFirstLogin(true); setIsFirstLogin(true);
window.location.href = `${getAccountsURL()}/passkeys/flow?passkeySessionID=${passkeySessionID}&redirect=${ window.location.href = `${accountsAppURL()}/passkeys/flow?passkeySessionID=${passkeySessionID}&redirect=${
window.location.origin window.location.origin
}/passkeys/finish`; }/passkeys/finish`;
router.push(PAGES.CREDENTIALS); router.push(PAGES.CREDENTIALS);

View File

@ -34,13 +34,16 @@ export const getUploadEndpoint = () => {
return `https://uploader.ente.io`; return `https://uploader.ente.io`;
}; };
export const getAccountsURL = () => { /**
const accountsURL = process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT; * Return the URL of the Ente Accounts app.
if (accountsURL) { *
return accountsURL; * Defaults to our production instance, "https://accounts.ente.io", but can be
} * overridden by setting the `NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT` environment
return `https://accounts.ente.io`; * variable to a non-empty value.
}; */
export const accountsAppURL = () =>
process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT ||
`https://accounts.ente.io`;
export const getAlbumsURL = () => { export const getAlbumsURL = () => {
const albumsURL = process.env.NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT; const albumsURL = process.env.NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT;