From 66884d2068959516e57abfe2529b693edb471138 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Wed, 22 Dec 2021 16:11:45 +0800 Subject: [PATCH 1/4] added deriv.be to supported domains along with an app ID --- src/common/constants.js | 12 ++++++++++-- src/common/websocket/config.js | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/common/constants.js b/src/common/constants.js index a878dd3d623..d2f2916b71b 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -2,19 +2,27 @@ const isBrowser = () => typeof window !== 'undefined' const deriv_com_url = 'deriv.com' const deriv_me_url = 'deriv.me' +const deriv_be_url = 'deriv.be' const deriv_com_app_id = 16929 const deriv_me_app_id = 1411 +const deriv_be_app_id = 30767 -const supported_domains = [deriv_com_url, deriv_me_url] +const supported_domains = [deriv_com_url, deriv_me_url, deriv_be_url] const domain_url = isBrowser() && supported_domains.includes(window.location.hostname) ? window.location.hostname : deriv_com_url +const getDomainAppID = () => { + if (domain_url === deriv_me_url) return deriv_me_app_id + else if (domain_url === deriv_be_url) return deriv_be_app_id + else return deriv_com_app_id +} + // URL export const domain_full_url = `https://${domain_url}` -export const deriv_app_id = domain_url === deriv_com_url ? deriv_com_app_id : deriv_me_app_id +export const deriv_app_id = getDomainAppID() export const deriv_app_url = `https://app.${domain_url}` export const deriv_api_url = `https://api.${domain_url}` export const deriv_bot_app_url = `${deriv_app_url}/bot` diff --git a/src/common/websocket/config.js b/src/common/websocket/config.js index b5432301d38..123dafe66b2 100644 --- a/src/common/websocket/config.js +++ b/src/common/websocket/config.js @@ -19,6 +19,10 @@ export const domain_config = { hostname: 'deriv.me', app_id: 1411, }, + { + hostname: 'deriv.be', + app_id: 30767, + }, ], staging: { hostname: 'staging.deriv.com', From 8f794ad3bad22fd10bcb2a48e7d96ab4523010ee Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Thu, 23 Dec 2021 15:04:56 +0800 Subject: [PATCH 2/4] added domain to whitelist --- gatsby-browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gatsby-browser.js b/gatsby-browser.js index 4d102f42b83..e9f58993555 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -16,7 +16,7 @@ const is_browser = typeof window !== 'undefined' const checkDomain = () => { return eval( decodeURIComponent( - 'var%20curhost%20%3D%20window.location.hostname%3B%20var%20t8hvj%20%3D%20%2F%5Cb%28deriv%7Cbinary%7Cbinaryqa%5B0-9%5D%7B2%7D%29%5C.%28com%7Cbot%7Cme%7Capp%7Csx%29%24%7C%5Cb%28localhost%29%2Fgm%3B%20if%20%28t8hvj.test%28curhost%29%20%3D%3D%20false%29%7Balert%28%22Not%20our%20domain%22%29%7D', + 'var%20curhost%20%3D%20window.location.hostname%3B%20var%20t8hvj%20%3D%20%2F%5Cb%28deriv%7Cbinary%7Cbinaryqa%5B0-9%5D%7B2%7D%29%5C.%28com%7Cbot%7Cme%7Cbe%7Capp%7Csx%29%24%7C%5Cb%28localhost%29%2Fgm%3B%20if%20%28t8hvj.test%28curhost%29%20%3D%3D%20false%29%7Balert%28%22Not%20our%20domain%22%29%7D', ), ) } From 28754b7bef26520d202df83912838ce771e11834 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Mon, 10 Jan 2022 10:46:14 +0800 Subject: [PATCH 3/4] using constant variables for app ID --- src/common/constants.js | 6 +++--- src/common/websocket/config.js | 13 +++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/common/constants.js b/src/common/constants.js index d2f2916b71b..66e565da96c 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -4,9 +4,9 @@ const deriv_com_url = 'deriv.com' const deriv_me_url = 'deriv.me' const deriv_be_url = 'deriv.be' -const deriv_com_app_id = 16929 -const deriv_me_app_id = 1411 -const deriv_be_app_id = 30767 +export const deriv_com_app_id = 16929 +export const deriv_me_app_id = 1411 +export const deriv_be_app_id = 30767 const supported_domains = [deriv_com_url, deriv_me_url, deriv_be_url] const domain_url = diff --git a/src/common/websocket/config.js b/src/common/websocket/config.js index 123dafe66b2..c460b2f4bfe 100644 --- a/src/common/websocket/config.js +++ b/src/common/websocket/config.js @@ -7,21 +7,26 @@ * */ import { isBrowser } from '../utility' -import { default_server_url } from '../constants' +import { + default_server_url, + deriv_com_app_id, + deriv_me_app_id, + deriv_be_app_id, +} from '../constants' export const domain_config = { production: [ { hostname: 'deriv.com', - app_id: 11780, + app_id: deriv_com_app_id, // 11780, }, { hostname: 'deriv.me', - app_id: 1411, + app_id: deriv_me_app_id, }, { hostname: 'deriv.be', - app_id: 30767, + app_id: deriv_be_app_id, }, ], staging: { From f8ea17b56ed9ef338cac73126a1f61c561456118 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Mon, 10 Jan 2022 17:45:51 +0800 Subject: [PATCH 4/4] resolved deriv-app ID confusion --- src/common/websocket/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/websocket/config.js b/src/common/websocket/config.js index c460b2f4bfe..6fa3c2293db 100644 --- a/src/common/websocket/config.js +++ b/src/common/websocket/config.js @@ -18,7 +18,7 @@ export const domain_config = { production: [ { hostname: 'deriv.com', - app_id: deriv_com_app_id, // 11780, + app_id: deriv_com_app_id, }, { hostname: 'deriv.me',