From 50b53781707799a0a725f02442230d22fce70f73 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 12 Dec 2022 15:54:18 +0100 Subject: [PATCH] BrowserStack local iOS testing compatibility On iOS, BrowserStack routes localhost connections for testing of local code through an actual domain (bs-local.com) because iOS blocks localhost connections to content that's not sitting on the phone. This commit adds changes to treat bs-local.com just like localhost, such that a locally served dev server can be tested with BrowserStack. --- src/config/config.local.ts | 2 +- src/lib/Constants.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/config.local.ts b/src/config/config.local.ts index f738bf48b..8df4edc26 100644 --- a/src/config/config.local.ts +++ b/src/config/config.local.ts @@ -33,7 +33,7 @@ export default { apiEndpoint: window.sessionStorage['use-local-kyc-server'] // switch that can be set to use local kyc server // Note that locally signed grants are not actually eligible for higher limits on the deployed Fastspot and // OASIS test instances because they don't exist in the deployed TEN31 Pass's database. - ? 'http://localhost:8082' + ? `http://${window.location.hostname}:8082` : 'https://test.pass.ten31.com', appId: window.location.protocol === 'https:' ? 'ecf6f03e-7af0-4af8-a4a8-c3a8cc16e168' diff --git a/src/lib/Constants.ts b/src/lib/Constants.ts index cf9824c1e..4a42de12a 100644 --- a/src/lib/Constants.ts +++ b/src/lib/Constants.ts @@ -12,8 +12,8 @@ export const ENV_TEST = 'test'; export const ENV_DEV = 'dev'; export const MAINNET_ORIGIN = 'https://wallet.nimiq.com'; -export const TESTNET_ORIGIN = window.location.hostname === 'localhost' - ? 'http://localhost:8081' +export const TESTNET_ORIGIN = window.location.hostname === 'localhost' || window.location.hostname === 'bs-local.com' + ? `${window.location.protocol}//${window.location.hostname}:8081` : 'https://wallet.nimiq-testnet.com'; export const FIAT_CURRENCY_DENYLIST = [