diff --git a/packages/shared/src/components/MainFeedLayout.tsx b/packages/shared/src/components/MainFeedLayout.tsx index e94a993cad..928b40f0a5 100644 --- a/packages/shared/src/components/MainFeedLayout.tsx +++ b/packages/shared/src/components/MainFeedLayout.tsx @@ -64,7 +64,7 @@ import { QueryStateKeys, useQueryState } from '../hooks/utils/useQueryState'; import { useSearchResultsLayout } from '../hooks/search/useSearchResultsLayout'; import useCustomDefaultFeed from '../hooks/feed/useCustomDefaultFeed'; import { useSearchContextProvider } from '../contexts/search/SearchContext'; -import { isDevelopment } from '../lib/constants'; +import { isDevelopment, isProductionAPI } from '../lib/constants'; const FeedExploreHeader = dynamic( () => @@ -319,9 +319,10 @@ export default function MainFeedLayout({ variables: { ...propsByFeed[feedName].variables, ...dynamicPropsByFeed[feedName]?.variables, - version: isDevelopment - ? 1 - : dynamicFeedVersionByFeed[feedName] || feedVersion, + version: + isDevelopment && !isProductionAPI + ? 1 + : dynamicFeedVersionByFeed[feedName] || feedVersion, }, }; }, [ diff --git a/packages/shared/src/components/auth/RegistrationForm.tsx b/packages/shared/src/components/auth/RegistrationForm.tsx index fcb2d0eac8..6fd12d0e13 100644 --- a/packages/shared/src/components/auth/RegistrationForm.tsx +++ b/packages/shared/src/components/auth/RegistrationForm.tsx @@ -27,7 +27,7 @@ import AuthContainer from './AuthContainer'; import { onValidateHandles } from '../../hooks/useProfileForm'; import ExperienceLevelDropdown from '../profile/ExperienceLevelDropdown'; import Alert, { AlertType, AlertParagraph } from '../widgets/Alert'; -import { isDevelopment } from '../../lib/constants'; +import { isDevelopment, isProductionAPI } from '../../lib/constants'; import { Typography, TypographyTag, @@ -224,9 +224,10 @@ const RegistrationForm = ({ 'traits.experienceLevel': 'NOT_ENGINEER', }), headers: { - 'True-Client-Ip': isDevelopment - ? undefined - : turnstileRef?.current?.getResponse(), + 'True-Client-Ip': + isDevelopment && !isProductionAPI + ? undefined + : turnstileRef?.current?.getResponse(), }, }); }; diff --git a/packages/shared/src/components/crypto.ts b/packages/shared/src/components/crypto.ts index 24e3f5fd16..9b5d3feb55 100644 --- a/packages/shared/src/components/crypto.ts +++ b/packages/shared/src/components/crypto.ts @@ -1,4 +1,4 @@ -import { isDevelopment } from '../lib/constants'; +import { isDevelopment, isProductionAPI } from '../lib/constants'; const base64ToBuf = (b: string) => Uint8Array.from(atob(b), (c) => c.charCodeAt(0)); @@ -10,7 +10,7 @@ export const decrypt = async ( algorithmLength = 256, subtle = globalThis.crypto.subtle, ): Promise => { - if (!subtle || isDevelopment) { + if (!subtle || (isDevelopment && !isProductionAPI)) { return input; } const keyObject = await subtle.importKey( diff --git a/packages/shared/src/lib/constants.ts b/packages/shared/src/lib/constants.ts index 51f3fa0f6d..369e764b57 100644 --- a/packages/shared/src/lib/constants.ts +++ b/packages/shared/src/lib/constants.ts @@ -35,6 +35,8 @@ export const businessWebsiteUrl = 'https://r.daily.dev/business'; export const appsUrl = 'https://daily.dev/apps'; export const timezoneSettingsUrl = 'https://r.daily.dev/timezone'; export const isDevelopment = process.env.NODE_ENV === 'development'; +export const isProductionAPI = + process.env.NEXT_PUBLIC_API_URL === 'https://api.daily.dev'; export const isProduction = process.env.NODE_ENV === 'production'; export const isTesting = process.env.NODE_ENV === 'test' || (!isDevelopment && !isProduction); diff --git a/packages/webapp/next.config.ts b/packages/webapp/next.config.ts index f695307a70..c251e24068 100644 --- a/packages/webapp/next.config.ts +++ b/packages/webapp/next.config.ts @@ -32,6 +32,7 @@ const withSerwist = withSerwistInit({ const nextConfig: NextConfig = { transpilePackages: ['@dailydotdev/shared'], + allowedDevOrigins: ['app.local.fylla.dev', 'app.staging.daily.dev'], ...withSerwist({ ...withBundleAnalyzer({ i18n: {