feat: set client package based on redirect URL

This commit is contained in:
httpjamesm 2024-01-30 11:21:33 -05:00
parent daa1710cea
commit 5b8ec11b6c
No known key found for this signature in database

View file

@ -1,3 +1,4 @@
import { APPS, CLIENT_PACKAGE_NAMES } from '@ente/shared/apps/constants';
import {
CenteredFlex,
VerticallyCentered,
@ -6,6 +7,7 @@ import EnteButton from '@ente/shared/components/EnteButton';
import EnteSpinner from '@ente/shared/components/EnteSpinner';
import FormPaper from '@ente/shared/components/Form/FormPaper';
import { logError } from '@ente/shared/sentry';
import { LS_KEYS, setData } from '@ente/shared/storage/localStorage';
import InfoIcon from '@mui/icons-material/Info';
import { Box, Typography } from '@mui/material';
import { t } from 'i18next';
@ -45,6 +47,15 @@ const PasskeysFlow = () => {
}
}
let pkg = CLIENT_PACKAGE_NAMES.get(APPS.PHOTOS);
if (redirectURL.protocol === 'enteauth:') {
pkg = CLIENT_PACKAGE_NAMES.get(APPS.AUTH);
} else if (redirectURL.hostname.startsWith('accounts')) {
pkg = CLIENT_PACKAGE_NAMES.get(APPS.ACCOUNTS);
}
setData(LS_KEYS.CLIENT_PACKAGE, { name: pkg });
// get passkeySessionID from the query params
const passkeySessionID = searchParams.get('passkeySessionID') as string;