Skip to content

armgit / ente

Public Imported from GitHub
0

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

add option to override NEXT_PUBLIC_DISABLE_CF_UPLOAD_PROXY locally for testing

Abhinav87aac09f56f2
diff --git a/apps/photos/src/services/userService.ts b/apps/photos/src/services/userService.ts
index 100046bc8a..5165f844b1 100644
--- a/apps/photos/src/services/userService.ts
+++ b/apps/photos/src/services/userService.ts
@@ -1,5 +1,9 @@
import { PAGES } from 'constants/pages';
-import { getEndpoint, getFamilyPortalURL } from 'utils/common/apiUtil';
+import {
+ getEndpoint,
+ getFamilyPortalURL,
+ isDevDeployment,
+} from 'utils/common/apiUtil';
import { clearKeys } from 'utils/storage/sessionStorage';
import router from 'next/router';
import { clearData, getData, LS_KEYS } from 'utils/storage/localStorage';
@@ -526,6 +530,11 @@ export const updateMapEnabledStatus = async (newStatus: boolean) => {
export async function getDisableCFUploadProxyFlag(): Promise<boolean> {
try {
+ const disableCFUploadProxy =
+ process.env.NEXT_PUBLIC_DISABLE_CF_UPLOAD_PROXY;
+ if (isDevDeployment() && typeof disableCFUploadProxy !== 'undefined') {
+ return disableCFUploadProxy === 'true';
+ }
const featureFlags = (
await fetch('https://static.ente.io/feature_flags.json')
).json() as GetFeatureFlagResponse;
diff --git a/apps/photos/src/utils/common/apiUtil.ts b/apps/photos/src/utils/common/apiUtil.ts
index 59e88c1a3f..169521737a 100644
--- a/apps/photos/src/utils/common/apiUtil.ts
+++ b/apps/photos/src/utils/common/apiUtil.ts
@@ -99,7 +99,7 @@ It's a dev deployment (and should use the environment override for endpoints ) i
3. if the app is running locally (hence node_env is development)
4. if the app is running in test mode
*/
-const isDevDeployment = () => {
+export const isDevDeployment = () => {
if (globalThis?.location) {
return (
process.env.NEXT_PUBLIC_ENTE_WEB_ENDPOINT ===