Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/shared/src/components/MainFeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
() =>
Expand Down Expand Up @@ -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,
},
};
}, [
Expand Down
9 changes: 5 additions & 4 deletions packages/shared/src/components/auth/RegistrationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
},
});
};
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/components/crypto.ts
Original file line number Diff line number Diff line change
@@ -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));
Expand All @@ -10,7 +10,7 @@ export const decrypt = async (
algorithmLength = 256,
subtle = globalThis.crypto.subtle,
): Promise<string> => {
if (!subtle || isDevelopment) {
if (!subtle || (isDevelopment && !isProductionAPI)) {
return input;
}
const keyObject = await subtle.importKey(
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions packages/webapp/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down