Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1642 from matin-deriv/end_of_webtrader
Browse files Browse the repository at this point in the history
feat: End of Webtrader
  • Loading branch information
matin-deriv authored Apr 11, 2023
2 parents 319dbe5 + 4698e21 commit 414dfc6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 40 deletions.
32 changes: 4 additions & 28 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function loadAppId(callback) {
}

function getUrl() {
var server_url = localStorage.getItem('config.server_url') || 'frontend.binaryws.com';
var server_url = localStorage.getItem('config.server_url') || 'red.binaryws.com';
return 'wss://' + server_url + '/websockets/v3';
}

Expand Down Expand Up @@ -80,28 +80,9 @@ function processRedirect(selected_language_name) {
var token = local_storage.get('oauth')[0].token;
sendAuthorize(token);
} else {
if(isEuCountrySelected(client_country)) {
window.location.href = moveToDerivUrl();
} else {
document.getElementById('loading_container').style.display="none"
document.getElementById('main_container').style.display="block"
$(function () {
$('body').css('display', 'block');
setTime();
setInterval(setTime, 1000);

var selected_language_name = (window.local_storage.get('i18n') || { value: 'en' }).value;
$.getJSON(VERSION + 'i18n/' + selected_language_name + '.json', function (data) {
setupi18nTranslation(data);
processFooter(selected_language_name);
});

onChangeSelectLanguage(selected_language_name);
});
}
window.location.href = moveToDerivUrl();
}
} else if (data.authorize){
var residence_country = data.authorize.country;
account_list = data.authorize.account_list;
var has_mf_mx_mlt = false;
for (var account in account_list){
Expand All @@ -113,12 +94,7 @@ function processRedirect(selected_language_name) {
return;
}
}
if (has_mf_mx_mlt || ((isEuCountrySelected(client_country) || isEuCountrySelected(residence_country)) && account_list.length == 1)){
window.location.href = moveToDerivUrl();
} else {
window.location.href = VERSION + 'main.html';
}

window.location.href = moveToDerivUrl();
}
}
})
Expand Down Expand Up @@ -188,7 +164,7 @@ function checkRedirectToken(params_str) {

function checkWindowSize() {
if (isSmallView()) {
window.location.assign(VERSION + 'unsupported_browsers/unsupported_browsers.html');
window.location.href = moveToDerivUrl();
return;
}
}
Expand Down
14 changes: 3 additions & 11 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ require(["modernizr"], function() {
var Modernizr = window.Modernizr;
if (!Modernizr.svg || !Modernizr.websockets || (Modernizr.touch && window.isSmallView()) ||
!Modernizr.localstorage || !Modernizr.webworkers || !Object.defineProperty) {
window.location.assign("unsupported_browsers/unsupported_browsers.html");
window.location.href = moveToDerivUrl();
return;
}
});
Expand Down Expand Up @@ -320,18 +320,10 @@ require(["jquery", "text!i18n/" + i18n_name + ".json"], function($, lang_json) {
.then(function(data) {
var client_country = data.website_status.clients_country;
if (!local_storage.get('oauth')) {
if (isEuCountrySelected(client_country)) {
window.location.href = moveToDerivUrl();
} else {
showMainContent();
}
window.location.href = moveToDerivUrl();
} else {
websockets.cached.authorize().then(function(auth) {
if (shouldRedirectMf(client_country, auth.authorize)) {
window.location.href = moveToDerivUrl();
} else {
showMainContent();
}
window.location.href = moveToDerivUrl();
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/websockets/binary_websockets.es6
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const get_app_id = () => {
return app_id;
};

const get_server_url = () => localStorage.getItem('config.server_url') || 'frontend.binaryws.com';
const get_server_url = () => localStorage.getItem('config.server_url') || 'red.binaryws.com';

const get_socket_url = () => {
const server_url = get_server_url();
Expand Down

0 comments on commit 414dfc6

Please sign in to comment.