1- import { browserName , browserVersion , isMobile } from "react-device-detect" ;
1+ import { browserName , browserVersion , isMobile } from "react-device-detect" ;
2+
3+ type ConfigFile = {
4+ PKG_URL ?: string ;
5+ BACKEND_URL ?: string ;
6+ } ;
7+ const rawConfig : unknown = ( window as any ) . __APP_CONFIG__ ;
8+ const configFile : ConfigFile = rawConfig && typeof rawConfig === "object" ? ( rawConfig as ConfigFile ) : { } ;
29
310// 2GB
411export const MAX_UPLOAD_SIZE : number = 2 * 1000 * 1000 * 1000 ;
@@ -10,18 +17,16 @@ export const UPLOAD_CHUNK_SIZE: number = 1024 * 1024;
1017// progress bar smooth time in seconds.
1118export const SMOOTH_TIME : number = 2 ;
1219
13- const isStable = process . env . REACT_APP_ENV === "stable" ;
14-
15- export const PKG_URL = `https://postguard-${ process . env . REACT_APP_ENV } .cs.ru.nl/pkg`
20+ export const PKG_URL = configFile . PKG_URL ?? `https://postguard-${ process . env . REACT_APP_ENV } .cs.ru.nl/pkg`
1621
1722// Stable: https://cryptify.nl/api/v2
1823// Main: https://cryptify.nl/main/api/v2
19- export const BACKEND_URL = isStable ? "https://cryptify.nl/api/v2" : "https://cryptify.nl/main /api/v2";
24+ export const BACKEND_URL = configFile . BACKEND_URL ?? "https://cryptify.nl/api/v2" ;
2025
2126export const METRICS_HEADER = {
22- "X-PostGuard-Client-Version" : `${ browserName } ${
23- isMobile ? "(mobile)" : ""
24- } ,${ browserVersion } ,${ process . env . REACT_APP_NAME } ,${
25- process . env . REACT_APP_VERSION
26- } `,
27+ "X-PostGuard-Client-Version" : `${ browserName } ${
28+ isMobile ? "(mobile)" : ""
29+ } ,${ browserVersion } ,${ process . env . REACT_APP_NAME } ,${
30+ process . env . REACT_APP_VERSION
31+ } `,
2732} ;
0 commit comments