Skip to content

Commit

Permalink
Merge pull request #1 from binary-com/master
Browse files Browse the repository at this point in the history
Release to Production
  • Loading branch information
jy-deriv committed May 24, 2016
2 parents 7825e59 + af9c444 commit da1e338
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 14 deletions.
1 change: 1 addition & 0 deletions scripts/compile.pl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
['styles', 'home/styles', 'haml', 'full_width', 'Styles'],
['affiliate/signup', 'affiliates/signup', 'toolkit', 'default', 'Affiliate'],
['user/logintrouble', 'misc/logintrouble', 'toolkit', 'default', 'Login trouble'],
['endpoint', 'misc/endpoint', 'toolkit', 'default', 'Endpoint'],
['legal/us_patents', 'legal/us_patents', 'toolkit', 'default', 'US Patents'],
['cashier', 'cashier/index', 'haml', 'default', 'Cashier'],
['cashier/payment_methods', 'cashier/payment_methods', 'toolkit', 'default', 'Payment Methods'],
Expand Down
2 changes: 1 addition & 1 deletion scripts/lib/BS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ sub menu {
id => 'topMenuApplications',
url => url_for('/applications'),
text => localize('Applications'),
link_class => 'pjaxload',
link_class => 'ja-hide pjaxload',
};

# push @{$menu}, $self->_main_menu_trading();
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/binary/base/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ URL.prototype = {
staticHost = staticHost.substr(0, staticHost.indexOf('/js/') + 1);
}
else {
staticHost = 'https://static.binary.com/';
staticHost = 'https://www.binary.com/';
}

window.staticHost = staticHost;
Expand Down
18 changes: 18 additions & 0 deletions src/javascript/binary/endpoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pjax_config_page("endpoint", function(){
return {
onLoad: function() {
$('#new_endpoint').on('click', function () {
var server_url = $('#server_url').val(),
app_id = $('#app_id').val();
if (Trim(server_url) !== '') localStorage.setItem('server_url', server_url);
if (Trim(app_id) !== '') localStorage.setItem('app_id', app_id);
window.location.reload();
});
$('#reset_endpoint').on('click', function () {
localStorage.removeItem('server_url');
localStorage.removeItem('app_id');
window.location.reload();
});
}
};
});
2 changes: 1 addition & 1 deletion src/javascript/binary/pages/client/logged_in.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var LoggedInHandler = (function() {
redirect_url = page.url.default_redirect_url();
var lang_cookie = $.cookie('language');
if(lang_cookie && lang_cookie !== page.language()) {
redirect_url.replace(new RegExp('\/' + page.language() + '\/', 'i'), '/' + lang_cookie.toLowerCase() + '/');
redirect_url = redirect_url.replace(new RegExp('\/' + page.language() + '\/', 'i'), '/' + lang_cookie.toLowerCase() + '/');
}
}
document.getElementById('loading_link').setAttribute('href', redirect_url);
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/binary/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function BinarySocketClass() {
authorized = false,
timeouts = {},
req_number = 0,
socketUrl = socket_url + '?app_id=' + app_id + (page.language() ? '&l=' + page.language() : '');
socketUrl = getSocketURL() + '?app_id=' + getAppId() + (page.language() ? '&l=' + page.language() : '');

var clearTimeouts = function(){
for(var k in timeouts){
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/binary/static/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Login = (function() {
};

var login_url = function() {
return 'https://oauth.binary.com/oauth2/authorize?app_id=' + app_id + '&l=' + page.language();
return 'https://oauth.binary.com/oauth2/authorize?app_id=' + getAppId() + '&l=' + page.language();
};

var is_login_pages = function() {
Expand Down
12 changes: 9 additions & 3 deletions src/javascript/config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/*
* Configuration values needed in js codes
*
*
* NOTE:
* Please use the following command to avoid accidentally committing personal changes
* git update-index --assume-unchanged src/javascript/config.js
*
*/

var app_id = '1';
var socket_url = 'wss://ws.binaryws.com/websockets/v3';
function getAppId() {
return localStorage.getItem('app_id') ? localStorage.getItem('app_id') :
/staging\.binary\.com/i.test(window.location.hostname) ? '1098' : '1';
}

function getSocketURL() {
return localStorage.getItem('server_url') ? 'wss://' + localStorage.getItem('server_url') + '/websockets/v3' : 'wss://ws.binaryws.com/websockets/v3';
}
2 changes: 1 addition & 1 deletion src/templates/haml/layouts/default/javascripts.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!= "window.page_params = { settings: ". $javascript->{settings} . "};"

- foreach my $lib (@{ $javascript->{libs} }) {
%script{:src => $lib :defer=>"true"}
%script{:async => "true", :defer => "true", :src => $lib}
- }

%script{:async => "true", :defer => "true", :src => "https://apis.google.com/js/platform.js"}
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@
<tr class="flex-tr">
<td class="flex-tr-child" id="max-open-position">
<a href="#" id="max-open-position-tooltip" rel="tooltip" title="">
<img src="https://static.binary.com/images/common/question_1.png">
<img src="[% request.url_for('images/common/question_1.png') %]">
</a>
</td>
<td class="flex-tr-child" id="open-positions"></td>
</tr>
<tr class="flex-tr">
<td class="flex-tr-child" id="max-acc-balance">
<a href="#" id="max-acc-balance-tooltip" rel="tooltip" title="">
<img src="https://static.binary.com/images/common/question_1.png">
<img src="[% request.url_for('images/common/question_1.png') %]">
</a>
</td>
<td class="flex-tr-child" id="account-balance"></td>
</tr>
<tr class="flex-tr">
<td class="flex-tr-child" id="max-daily-turnover">
<a href="#" id="max-daily-turnover-tooltip" rel="tooltip" title="">
<img src="https://static.binary.com/images/common/question_1.png">
<img src="[% request.url_for('images/common/question_1.png') %]">
</a>
</td>
<td class="flex-tr-child" id="daily-turnover"></td>
</tr>
<tr class="flex-tr">
<td class="flex-tr-child" id="max-aggregate">
<a href="#" id="max-aggregate-tooltip" rel="tooltip" title="">
<img src="https://static.binary.com/images/common/question_1.png">
<img src="[% request.url_for('images/common/question_1.png') %]">
</a>
</td>
<td class="flex-tr-child" id="payout"></td>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/toolkit/global/javascripts.html.tt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</script>

[%= FOREACH js IN javascript.libs =%]
<script src='[%= js =%]' defer></script>
<script src='[%= js =%]' defer async></script>
[%= END =%]

<script src="https://apis.google.com/js/platform.js" defer async></script>
46 changes: 46 additions & 0 deletions src/templates/toolkit/misc/endpoint.html.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<div class="endpoint-config">
<h1>[% l('Change API Endpoint') %]</h1>
<div class="grd-parent grd-row-padding">
<div class="rbox form">
<div class="rbox-wrap">
<fieldset>
<legend>[% l('Details') %]</legend>
<div class="grd-row-padding row clear">
<div class="grd-grid-4 form_label">
<label for="server_url">[% l('Server') %]</label>
</div>
<div class="grd-grid-8">
<input type="text" class="text" id="server_url" maxlength="30"></input>
<p class="hint">
[% l('e.g. www.binaryqa36.com') %]
</p>
<p class="errorfield" id="error-server_url" style="display:none"></p>
</div>
</div>
<div class="grd-row-padding row clear">
<div class="grd-grid-4 form_label">
<label for="app_id">[% l('OAuth App ID (Optional)') %]</label>
</div>
<div class="grd-grid-8">
<input type="text" class="text" id="app_id" maxlength="30"></input>
<p class="hint">
[% l('e.g. id-HXSSH5AIQylFwsiUcXGqpXApvnFe') %]
<br/>
[% l('You have to register and get App ID before you can use different OAuth server for authentication. For more information refer to OAuth details on https://developers.binary.com/.') %]
</p>
<p class="errorfield" id="error-app_id" style="display:none"></p>
</div>
</div>
</fieldset>
<fieldset class="center-aligned" id="formlayout">
<div class="button" style="display:inline-block">
<button class="button" id="new_endpoint">[% l('Submit') %]</button>
</div>
<div class="button" style="display:inline-block">
<button class="button" id="reset_endpoint">[% l('Reset to Original Settings') %]</button>
</div>
</fieldset>
</div>
</div>
</div>
</div>

0 comments on commit da1e338

Please sign in to comment.