Browse Source

Merge pull request #153 from SuperNETorg/dl

Dl
all-modes
pbca26 8 years ago
committed by GitHub
parent
commit
1955d709f4
  1. 2
      gui/EasyDEX-GUI
  2. BIN
      gui/agama-icon-small.png
  3. 43
      gui/agama-icon.svg
  4. BIN
      gui/bg.jpg
  5. BIN
      gui/bg2.jpg
  6. 31
      gui/bluebird.min.js
  7. 16
      gui/index.html
  8. 52
      gui/init.js
  9. 6
      gui/jRoll.min.css
  10. 1
      gui/jRoll.min.js
  11. 108
      gui/loading.css
  12. 215
      gui/loading.js
  13. 4
      gui/module-hack.js
  14. 2
      main.js
  15. 28
      make-patch.sh
  16. 3
      package.json
  17. 10
      routes/shepherd.js
  18. 3
      version

2
gui/EasyDEX-GUI

@ -1 +1 @@
Subproject commit ba50df3108aa7c3dc27583f15e4f85d80ac08cda
Subproject commit 7399c05db6464596edf4c242f5a3a57445c70ded

BIN
gui/agama-icon-small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

43
gui/agama-icon.svg

@ -1,43 +0,0 @@
<svg width="62" height="62" xmlns="http://www.w3.org/2000/svg">
<g>
<title>background</title>
<rect fill="none" id="canvas_background" height="64" width="64" y="-1" x="-1"/>
</g>
<g>
<title>Layer 1</title>
<g id="svg_1">
<g id="svg_2">
<path id="svg_3" d="m-95.883,25.261" fill="#FFFFFF"/>
</g>
<g id="svg_4">
<g id="svg_5">
<g id="svg_6">
<polyline id="svg_7" points="5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 " fill="none"/>
</g>
</g>
<g id="svg_8">
<g id="svg_9">
<polyline id="svg_10" points="5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 " fill="none"/>
</g>
</g>
<g id="svg_11">
<g id="svg_12">
<polyline id="svg_13" points="5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 5.016998291015625,16.1199951171875 " fill="none"/>
</g>
</g>
<g id="svg_14">
<g id="svg_15">
<path id="svg_16" d="m5.017,16.12"/>
</g>
</g>
</g>
<path id="svg_17" d="m25.98,50.215c-2.344,-0.536 -3.68,-2.914 -3.097,-4.579c-6.44,3.197 -12.483,2.971 -18.131,-0.678c0.041,0.104 0.082,0.208 0.124,0.312c6.681,10.741 16.851,15.481 30.51,14.221c3.236,-7.521 3.861,-13.971 1.874,-19.351c-1.248,-1.697 -3.004,-1.71 -5.268,-0.041c-0.961,0.561 -1.489,3.06 -1.584,7.499c-0.266,1.98 -1.743,2.853 -4.428,2.617" fill="#FCC414" clip-rule="evenodd" fill-rule="evenodd"/>
<path id="svg_18" d="m4.752,44.958c5.648,3.649 11.691,3.875 18.131,0.678c0.16,-0.457 0.464,-0.86 0.932,-1.157c2.521,-1.906 3.361,-3.856 2.521,-5.85c-0.85,-3.058 -4.675,-4.436 -11.473,-4.137c-3.756,0.08 -5.555,-1.439 -5.397,-4.557c0.498,-2.718 1.92,-4.086 4.266,-4.105c0.537,-0.086 1.049,-0.066 1.537,0.058c-3.75,-4.456 -5.289,-9.947 -4.617,-16.473c-0.159,0.142 -0.316,0.287 -0.473,0.433c-9.212,9.231 -11.02,20.934 -5.427,35.11" fill="#F59E1B" clip-rule="evenodd" fill-rule="evenodd"/>
<path id="svg_19" d="m15.267,25.888c0.896,0.229 1.709,0.813 2.438,1.752c2.473,1.993 4.859,2.661 7.159,2.004c1.945,-0.811 2.463,-2.33 1.552,-4.557c-1.062,-1.742 -2.796,-3.39 -5.204,-4.945c-1.717,-1.979 -1.544,-3.929 0.517,-5.85c1.455,-1.012 2.964,-1.12 4.525,-0.323c0.666,0.23 1.268,1.105 1.805,2.623c-0.693,-7.092 -0.405,-12.033 0.862,-14.824c-7.258,0.684 -13.349,3.233 -18.273,7.647c-0.67,6.526 0.869,12.017 4.619,16.473" fill="#EC6922" clip-rule="evenodd" fill-rule="evenodd"/>
<path id="svg_20" d="m28.06,16.592c0.302,0.852 0.583,1.906 0.845,3.162c0.582,2.774 1.498,4.595 2.747,5.462c1.194,0.532 1.899,0.15 2.117,-1.147c0.123,-1.364 -0.001,-3.055 -0.372,-5.074c-0.393,-3.504 0.857,-5.282 3.749,-5.333c2.727,0.436 3.794,1.923 3.2,4.46c1.971,-3.824 6.071,-6.31 12.301,-7.458c-5.227,-6.048 -13.135,-9.013 -23.724,-8.896c-1.268,2.791 -1.555,7.732 -0.863,14.824" fill="#383C8F" clip-rule="evenodd" fill-rule="evenodd"/>
<path id="svg_21" d="m40.346,18.122c-1.623,2.394 -2.765,4.452 -3.426,6.173c-0.578,1.829 -0.481,3.122 0.291,3.878c2.344,1.144 4.701,-2.734 7.004,-4.736c1.918,-1.668 4.619,-0.639 5.277,2.118c0.264,1.68 -0.316,2.863 -1.743,3.549c5.066,-0.177 8.928,2.53 11.585,8.121l-0.003,-0.301c0.798,-11.687 -1.249,-20.719 -6.399,-25.925c-0.094,-0.113 -0.189,-0.225 -0.285,-0.336c-6.23,1.149 -10.33,3.635 -12.301,7.459" fill="#0FA8E0" clip-rule="evenodd" fill-rule="evenodd"/>
<path id="svg_22" d="m46.195,29.595c-2.898,0.535 -4.848,1.182 -5.85,1.94c-1.47,1.845 -1.297,3.45 0.517,4.816c4.689,5.427 6.13,13.785 4.845,23.139l14.131,0.072l-0.505,-22.337c-2.657,-5.591 -6.519,-8.298 -11.585,-8.121c-0.437,0.211 -0.955,0.375 -1.553,0.491" fill="#61C1D2" clip-rule="evenodd" fill-rule="evenodd"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gui/bg.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
gui/bg2.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

31
gui/bluebird.min.js

File diff suppressed because one or more lines are too long

16
gui/index.html

@ -3,14 +3,14 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="EasyDEX-GUI/assets/global/css/bootstrap.min.css">
<link rel="stylesheet" href="jRoll.min.css">
<link rel="stylesheet" href="loading.css">
<script type="text/javascript" src="module-hack.js"></script>
<link rel="stylesheet" href="EasyDEX-GUI/assets/mainWindow/css/jRoll.min.css">
<link rel="stylesheet" href="EasyDEX-GUI/assets/mainWindow/css/loading.css">
<script type="text/javascript" src="EasyDEX-GUI/assets/mainWindow/js/module-hack.js"></script>
<script type="text/javascript" src="EasyDEX-GUI/assets/global/vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="EasyDEX-GUI/assets/scripts/config.js"></script>
<script type="text/javascript" src="bluebird.min.js"></script>
<script type="text/javascript" src="loading.js"></script>
<script type="text/javascript" src="jRoll.min.js"></script>
<script type="text/javascript" src="EasyDEX-GUI/assets/mainWindow/js/bluebird.min.js"></script>
<script type="text/javascript" src="EasyDEX-GUI/assets/mainWindow/js/loading.js"></script>
<script type="text/javascript" src="EasyDEX-GUI/assets/mainWindow/js/jRoll.min.js"></script>
<script>if (window.module) module = window.module;</script>
</head>
<body class="agamaMode">
@ -24,12 +24,12 @@
<div id="pulse" class="pulse-loader"></div>
</div-->
<div id="agamaMode">
<img src="agama-icon.svg" class="agama-logo" alt="Agama Wallet" width="80" height="100" />
<img src="EasyDEX-GUI/assets/mainWindow/img/agama-icon.svg" class="agama-logo" alt="Agama Wallet" width="80" height="100" />
<div id="agamaModeStatus">Choose Agama mode</div>
<button onClick="closeMainWindow()" class="btn btn-primary">Native only</button>
<button onClick="normalStart()" class="btn btn-primary">Normal start</button>
</div>
</div>
<script type="text/javascript" src="init.js"></script>
<script type="text/javascript" src="EasyDEX-GUI/assets/mainWindow/js/init.js"></script>
</body>
</html>

52
gui/init.js

@ -1,52 +0,0 @@
$(document).ready(function() {
const remote = require('electron').remote;
var window = remote.getCurrentWindow();
var appConf = remote.getCurrentWindow().appConfig;
$('#pulse').jRoll({
radius: 100,
animation: 'pulse'
});
inititalWalletLoading();
$('#loading_status_text').text('Starting Wallet. Please wait...');
function inititalWalletLoading() {
// run iguana-less mode with no daemons startup
if (appConf && appConf.iguanaLessMode) {
// do something
} else { // run normal mode with 2 iguana instances started prior loading GUI
if (appConf && !appConf.manualIguanaStart) {
StartIguana();
}
var portcheck;
function startcheck() {
portcheck = setInterval(function(){
Iguana_activehandle(appConf).then(function(result){
console.log(result);
if (result !== 'error') {
stopcheck();
if (appConf && appConf.useBasiliskInstance) {
StartIguana_Cache();
}
$('#loading_status_text').text('Connecting to Basilisk Network...');
EDEX_DEXgetinfoAll(appConf.skipBasiliskNetworkCheck, appConf.minNotaries, appConf);
}
})
}, 2000);
}
function stopcheck() {
clearInterval(portcheck);
}
startcheck();
}
}
});

6
gui/jRoll.min.css

File diff suppressed because one or more lines are too long

1
gui/jRoll.min.js

File diff suppressed because one or more lines are too long

108
gui/loading.css

@ -1,108 +0,0 @@
body {
overflow: hidden !important;
border: solid 1px #ccc;
height: 300px;
}
.text-center {
text-align: center;
}
.loader-block {
height: 240px;
width: 100%;
position: absolute;
top: -30px;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.pulse-loader {
position: absolute;
top: 10px;
left: -100px;
margin: 80px 50px;
width: 400px !important;
}
body.agamaMode {
background-color: rgba(33, 33, 33, 0.85);
padding-top: 40px;
color: #fff;
}
.agama-logo {
padding-bottom: 20px;
}
#agamaModeStatus {
padding-bottom: 25px;
font-weight: bold;
font-size: 16px;
}
.btn-primary.focus,
.btn-primary:focus,
.btn-primary:hover,
.btn-primary:active,
.btn-primary.active {
background-color: #ffa726 !important;
border-color: #ffa726 !important;
}
.btn.active.focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn:active:focus,
.btn:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.btn {
padding: 6px 15px;
font-size: 14px;
line-height: 1.57142857;
border-radius: 3px;
-webkit-box-shadow: 0 1px 4px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 4px 0 rgba(0,0,0,.1);
-webkit-transition: border .2s linear,color .2s linear,width .2s linear,background-color .2s linear;
-o-transition: border .2s linear,color .2s linear,width .2s linear,background-color .2s linear;
transition: border .2s linear,color .2s linear,width .2s linear,background-color .2s linear;
-webkit-font-smoothing: subpixel-antialiased;
font-weight: bold;
display: inline-block;
padding: 6px 15px;
margin-bottom: 0;
line-height: 1.57142857;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 3px;
}
.btn-primary {
color: #fff;
background-color: #FF6600;
border-color: #FF6600;
}
.btn:first-child {
margin-right: 20px;
}
.btn:last-child {
margin-left: 20px;
}

215
gui/loading.js

@ -1,215 +0,0 @@
function closeMainWindow() {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
window.createWindow('open');
window.hide();
}
function normalStart() {
const remote = require('electron').remote;
let appConf = remote.getCurrentWindow().appConfig;
appConf.iguanaLessMode = false;
// run iguana-less mode with no daemons startup
if (appConf && appConf.iguanaLessMode) {
// do something
} else { // run normal mode with 2 iguana instances started prior loading GUI
if (appConf && !appConf.manualIguanaStart) {
StartIguana();
}
var portcheck;
function startcheck() {
portcheck = setInterval(function() {
Iguana_activehandle(appConf).then(function(result){
console.log(result);
if (result !== 'error') {
stopcheck();
if (appConf && appConf.useBasiliskInstance) {
StartIguana_Cache();
}
$('#loading_status_text').text('Connecting to Basilisk Network...');
EDEX_DEXgetinfoAll(appConf.skipBasiliskNetworkCheck, appConf.minNotaries, appConf);
}
})
}, 2000);
}
function stopcheck() {
clearInterval(portcheck);
}
startcheck();
}
}
function IguanaAJAX(url, ajax_data, timeout) {
return $.ajax({
data: JSON.stringify(ajax_data),
url: url,
type: 'POST',
dataType: 'json',
timeout: timeout ? timeout : 120000
//beforeSend: showLoadingImgFn
})
.fail(function(xhr, textStatus, error) {
// handle request failures
});
}
function Iguana_activehandle(appConf) {
return new Promise((resolve) => {
var ajax_data = {
'agent': 'SuperNET',
'method': 'activehandle'
},
AjaxOutputData = IguanaAJAX('http://127.0.0.1:' + appConf.iguanaCorePort, ajax_data).done(function(data) {
//$('#loading_status_text').text('Retrieving active handle...');
//console.log(AjaxOutputData.responseText);
AjaxOutputData = JSON.parse(AjaxOutputData.responseText)
//console.log(AjaxOutputData);
resolve(AjaxOutputData);
})
.fail(function(xhr, textStatus, error) {
// $('#loading_status_text').text('Retrieving active handle error!');
// handle request failures
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
}
console.log(textStatus);
console.log(error);
});
});
}
//Iguana_activehandle().then(function(result){
//console.log(result)
//})
function StartIguana() {
var ajax_data = { 'herd': 'iguana'};
console.log(ajax_data);
$('#agamaModeStatus').text('Starting main iguana instance...');
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:17777/shepherd/herd',
dataType: 'xml/html/script/json', // expected format for response
contentType: 'application/json', // send as JSON
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
console.log('== ActiveHandle Data OutPut ==');
console.log(AjaxOutputData);
},
error: function(xhr, textStatus, error) {
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
}
console.log(textStatus);
console.log(error);
}
});
}
function StartIguana_Cache() {
$('#agamaModeStatus').text('Starting basilisk iguana instance...');
var ajax_data = {
'mode': 'basilisk',
'coin': 'all'
};
var start_iguana_cache= $.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:17777/shepherd/forks',
contentType: 'application/json', // send as JSON
})
start_iguana_cache.done(function(data) {
_data = JSON.parse(data);
console.log(_data.result);
sessionStorage.setItem('IguanaCachePort', _data.result);
});
}
function EDEX_DEXgetinfoAll(skip, minNotaries, appConf) {
const remote = require('electron').remote;
var window = remote.getCurrentWindow();
if (!skip) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dpow',
'method': 'notarychains'
},
tmp_index = 0,
tmp_index_failed = 0,
get_dex_notarychains = IguanaAJAX('http://127.0.0.1:' + appConf.iguanaCorePort, ajax_data, 10000).done(function(data) {
get_dex_notarychains = JSON.parse(get_dex_notarychains.responseText);
if (minNotaries > get_dex_notarychains.length) { // if config value exceeds total num of notaries
minNotaries = get_dex_notarychains.length;
}
get_dex_notarychains = get_dex_notarychains.splice(0, minNotaries);
$.each(get_dex_notarychains, function( coin_index, coin_value ) {
console.log(coin_index + ': ' + coin_value);
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dex',
'method': 'getinfo',
'symbol': coin_value
};
console.log(ajax_data);
if (coin_value !== 'MESH' || coin_value !== 'CEAL') {
var getinfo_each_chain = IguanaAJAX('http://127.0.0.1:' + appConf.iguanaCorePort, ajax_data, 10000).done(function(data) {
getinfo_each_chain = JSON.parse(getinfo_each_chain.responseText);
console.log(getinfo_each_chain);
tmp_index++;
$('#loading_sub_status_text').text('Connection status... ' + tmp_index + '/' + get_dex_notarychains.length + ': ' + coin_value);
if (getinfo_each_chain.error === 'less than required responses') {
$('#loading_sub_status_output_text').text('Output: ' + getinfo_each_chain.error);
} else {
$('#loading_sub_status_output_text').text('Output: Connected');
}
if ( tmp_index + tmp_index_failed === minNotaries ) {
console.log('min notaries connected');
window.createWindow('open');
window.hide();
}
})
.fail(function(xhr, textStatus, error) {
tmp_index_failed++;
if ( tmp_index + tmp_index_failed === minNotaries ) {
console.log('min notaries connected');
window.createWindow('open');
window.hide();
}
// handle request failures
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
}
console.log(textStatus);
console.log(error);
});
}
});
});
} else {
window.createWindow('open');
window.hide();
}
}

4
gui/module-hack.js

@ -1,4 +0,0 @@
if (typeof module === 'object') {
window.module = module;
module = undefined;
}

2
main.js

@ -28,7 +28,7 @@ Promise = require('bluebird');
const appBasicInfo = {
name: 'Agama',
version: '0.2.0.1a-beta'
version: '0.2.0.21a-beta'
};
app.setName(appBasicInfo.name);

28
make-patch.sh

@ -0,0 +1,28 @@
cd gui/EasyDEX-GUI/react
echo "building gui..."
rm -rf ./build
mkdir build
mkdir build/assets
cp -R src/assets build/
./node_modules/.bin/webpack --config ./webpack.prod.config.js
cd ../../../
echo "copy patch files"
rm -rf ./patch.zip
rm -rf ./patch
mkdir patch
mkdir patch/gui
mkdir patch/gui/EasyDEX-GUI
cp -R gui/EasyDEX-GUI/react/build patch/gui/EasyDEX-GUI/react
cp -R gui/EasyDEX-GUI/assets patch/gui/EasyDEX-GUI
cp gui/index.html patch/gui/index.html
cp ./main.js patch
cp ./version patch
cp -R routes patch/routes
cp -R private patch/private
echo "package patch.zip"
cd patch
zip -r patch.zip gui routes private main.js version
cd ../
cp patch/patch.zip ./
rm -rf patch
echo "patch.zip is ready"

3
package.json

@ -5,7 +5,8 @@
"description": "Agama Desktop App",
"main": "main.js",
"scripts": {
"start": "electron ."
"start": "electron .",
"make-patch": "./make-patch.sh"
},
"repository": "https://github.com/SuperNETorg/Agama/",
"keywords": [

10
routes/shepherd.js

@ -452,7 +452,15 @@ shepherd.get('/update/patch/check', function(req, res, next) {
response.statusCode &&
response.statusCode === 200) {
const remoteVersion = body.split('\n');
const localVersion = fs.readFileSync(rootLocation + 'version', 'utf8').split('\r\n');
const localVersionFile = fs.readFileSync(rootLocation + 'version', 'utf8');
let localVersion;
if (localVersionFile.indexOf('\r\n') > -1) {
localVersion = localVersionFile.split('\r\n');
} else {
localVersion = localVersionFile.split('\n');
}
console.log(localVersion);
if (remoteVersion[0] === localVersion[0]) {
const successObj = {

3
version

@ -1,2 +1,3 @@
version=0.2.0.2a
version=0.2.0.21a
type=e-beta
minversion=0.2.0.2
Loading…
Cancel
Save