Browse Source

Merge pull request #172 from SuperNETorg/master

master update
pkg_automation_electrum
ca333 7 years ago
committed by GitHub
parent
commit
580f04423a
  1. 28
      gui/agama-instance-error.html
  2. 24
      gui/app-closing.html
  3. 35
      gui/index.html
  4. 35
      gui/startup/agama-instance-error.html
  5. 31
      gui/startup/app-closing.html
  6. 72
      gui/startup/app-settings.html
  7. 69
      gui/startup/index.html
  8. 0
      gui/startup/main.html
  9. 102
      main.js
  10. 3
      make-patch.sh
  11. 2
      package.json
  12. 27
      routes/appConfig.js
  13. 14
      routes/cache.js
  14. 824
      routes/shepherd.js
  15. 2
      version
  16. 2
      version_build

28
gui/agama-instance-error.html

@ -1,28 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="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="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">
<div class="text-center">
<div id="agamaMode">
<img src="EasyDEX-GUI/assets/mainWindow/img/agama-icon.svg" class="agama-logo" alt="Agama Wallet" width="80" height="100" />
<div id="agamaModeStatus">Another Agama instance is already running!</div>
<div>Please close all other instances and restart the app.</div>
<br />
<button onClick="quitApp()" class="btn btn-primary btn-close-app">Quit</button>
</div>
</div>
<script type="text/javascript" src="EasyDEX-GUI/assets/mainWindow/js/init.js"></script>
</body>
</html>

24
gui/app-closing.html

@ -1,24 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="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="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">
<div class="text-center">
<div id="agamaMode" class="app-closing">
<img src="EasyDEX-GUI/assets/mainWindow/img/agama-icon.svg" class="agama-logo" alt="Agama Wallet" width="80" height="100" />
<div id="agamaModeStatus">App is closing. Please wait...</div>
</div>
</div>
</body>
</html>

35
gui/index.html

@ -1,35 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="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="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">
<div class="text-center">
<!--div id="normalStart">
<div class="loader-block">
<div id="loading_status_text">Starting Wallet. Please wait...</div>
<div id="loading_sub_status_text"></div>
<div id="loading_sub_status_output_text"></div>
</div>
<div id="pulse" class="pulse-loader"></div>
</div-->
<div id="agamaMode">
<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="EasyDEX-GUI/assets/mainWindow/js/init.js"></script>
</body>
</html>

35
gui/startup/agama-instance-error.html

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="../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="../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 agama-default-window-height">
<div class="text-center">
<div id="agamaMode">
<img
src="../EasyDEX-GUI/assets/mainWindow/img/agama-icon.svg"
class="agama-logo"
alt="Agama Wallet"
width="80"
height="100" />
<div id="agamaModeStatus">Another Agama instance is already running!</div>
<div>Please close all other instances and restart the app.</div>
<br />
<button
onClick="quitApp()"
class="btn btn-primary btn-close-app">Quit</button>
</div>
</div>
<script type="text/javascript" src="../EasyDEX-GUI/assets/mainWindow/js/init.js"></script>
</body>
</html>

31
gui/startup/app-closing.html

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="../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="../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 agama-default-window-height">
<div class="text-center">
<div
id="agamaMode"
class="app-closing">
<img
src="../EasyDEX-GUI/assets/mainWindow/img/agama-icon.svg"
class="agama-logo"
alt="Agama Wallet"
width="80"
height="100" />
<div id="agamaModeStatus">App is closing. Please wait...</div>
</div>
</div>
</body>
</html>

72
gui/startup/app-settings.html

@ -0,0 +1,72 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="../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="../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 agama-app-settings-window">
<div id="debugOut"></div>
<div class="text-center">
<div
id="agamaMode"
class="app-settings">
<div
class="btn-close"
onClick="closeSettingsWindow()">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-close.png">
</div>
<img
src="../EasyDEX-GUI/assets/mainWindow/img/agama-icon.svg"
class="agama-logo"
alt="Agama Wallet"
width="80"
height="100" />
<div id="agamaModeStatus">App configuration (selected options only)</div>
<div
id="agamaConfigBlock"
class="agama-config-block"></div>
<!-- debug overlay -->
<div
id="debugOverlay"
class="debug-overlay hide"></div>
<div class="settings-buttons-block">
<button
onClick="testBins('komodod')"
class="btn btn-info pull-left">Test binaries</button>
<button
onClick="handleSaveSettings()"
class="btn btn-primary margin-right-20">Save</button>
<button
onClick="initSettingsForm()"
class="btn btn-primary">Reset changes</button>
<button
onClick="setDefaultAppSettings()"
class="btn btn-primary">Reset all settings</button>
</div>
<!-- toaster -->
<div
id="toast-container"
class="single-toast toast-bottom-right hide">
<div class="toast toast-success">
<button
class="toast-close-button"
onClick="hideToastImmediate()">×</button>
<div class="toast-title">Settings notification</div>
<div class="toast-message"></div>
</div>
</div>
<button onClick="reloadSettingsWindow()" class="btn btn-primary" style="margin-top: 20px">Reload</button>
</div>
<script>initSettingsForm()</script>
</div>
</body>
</html>

69
gui/startup/index.html

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="../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="../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">
<div class="text-center">
<div id="agamaMode">
<div
class="btn-close"
onClick="quitApp()">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-close.png">
</div>
<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
id="nativeOnlyBtn"
onClick="closeMainWindow(true)"
class="btn btn-primary btn-mode btn-native">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cube.png"> KMD native
</button>
<div
id="nativeOnlyBtnCarret"
class="btn btn-primary btn-caret margin-right-20"
onClick="toggleDropdown()">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-caret-down.png">
</div>
<ul class="dropdown-menu hide">
<li onClick="closeMainWindow()">
<a>KMD + REVS + JUMBLR</a>
</li>
<li onClick="closeMainWindow(null, true)">
<a>Custom</a>
</li>
</ul>
<button
id="normalStartBtn"
onClick="normalStart()"
class="btn btn-primary btn-mode">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cubes.png"> All modes
</button>
<div class="margin-top-20">
<button
id="settingsBtn"
onClick="openSettingsWindow()"
class="btn btn-info btn-mode">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cogs.png"> Settings
</button>
</div>
</div>
</div>
<script type="text/javascript" src="../EasyDEX-GUI/assets/mainWindow/js/init.js"></script>
</body>
</html>

0
gui/main.html → gui/startup/main.html

102
main.js

@ -71,6 +71,11 @@ shepherd.writeLog(`os_release: ${os.release()}`);
shepherd.writeLog(`os_type: ${os.type()}`); shepherd.writeLog(`os_type: ${os.type()}`);
var appConfig = shepherd.loadLocalConfig(); // load app config var appConfig = shepherd.loadLocalConfig(); // load app config
appConfig['daemonOutput'] = false; // shadow setting
let __defaultAppSettings = require('./routes/appConfig.js').config;
__defaultAppSettings['daemonOutput'] = false; // shadow setting
const _defaultAppSettings = __defaultAppSettings;
shepherd.writeLog(`app started in ${(appConfig.dev ? 'dev mode' : ' user mode')}`); shepherd.writeLog(`app started in ${(appConfig.dev ? 'dev mode' : ' user mode')}`);
@ -131,7 +136,9 @@ let willQuitApp = false;
let mainWindow; let mainWindow;
let loadingWindow; let loadingWindow;
let appCloseWindow; let appCloseWindow;
let appSettingsWindow;
let closeAppAfterLoading = false; let closeAppAfterLoading = false;
let forceQuitApp = false;
const _zcashParamsExist = shepherd.zcashParamsExist(); const _zcashParamsExist = shepherd.zcashParamsExist();
module.exports = guiapp; module.exports = guiapp;
@ -151,7 +158,7 @@ function createLoadingWindow() {
try { try {
loadingWindow = new BrowserWindow({ loadingWindow = new BrowserWindow({
width: 500, width: 500,
height: 300, height: 335,
frame: false, frame: false,
icon: iguanaIcon, icon: iguanaIcon,
show: false, show: false,
@ -190,10 +197,10 @@ function createLoadingWindow() {
console.log(`guiapp and sockets.io are listening on port ${appConfig.agamaPort + 1}`); console.log(`guiapp and sockets.io are listening on port ${appConfig.agamaPort + 1}`);
shepherd.writeLog(`guiapp and sockets.io are listening on port ${appConfig.agamaPort + 1}`); shepherd.writeLog(`guiapp and sockets.io are listening on port ${appConfig.agamaPort + 1}`);
}); });
loadingWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort + 1}/gui/agama-instance-error.html`); loadingWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort + 1}/gui/startup/agama-instance-error.html`);
console.log('another agama app is already running'); console.log('another agama app is already running');
} }
}) });
shepherd.setIO(io); // pass sockets object to shepherd router shepherd.setIO(io); // pass sockets object to shepherd router
shepherd.setVar('appBasicInfo', appBasicInfo); shepherd.setVar('appBasicInfo', appBasicInfo);
@ -202,9 +209,11 @@ function createLoadingWindow() {
loadingWindow.createWindow = createWindow; // expose createWindow to front-end scripts loadingWindow.createWindow = createWindow; // expose createWindow to front-end scripts
loadingWindow.appConfig = appConfig; loadingWindow.appConfig = appConfig;
loadingWindow.forseCloseApp = forseCloseApp; loadingWindow.forseCloseApp = forseCloseApp;
loadingWindow.createAppSettingsWindow = createAppSettingsWindow;
loadingWindow.startKMDNative = shepherd.startKMDNative;
// load our index.html (i.e. easyDEX GUI) // load our index.html (i.e. easyDEX GUI)
loadingWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/`); loadingWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/startup`);
loadingWindow.webContents.on('did-finish-load', function() { loadingWindow.webContents.on('did-finish-load', function() {
setTimeout(function() { setTimeout(function() {
loadingWindow.show(); loadingWindow.show();
@ -223,24 +232,34 @@ function createLoadingWindow() {
}); });
loadingWindow.on('close', (e) => { loadingWindow.on('close', (e) => {
if (willQuitApp) { if (!forseCloseApp) {
/* the user tried to quit the app */ if (willQuitApp) {
loadingWindow = null; /* the user tried to quit the app */
} else { loadingWindow = null;
/* the user only tried to close the window */ } else {
closeAppAfterLoading = true; /* the user only tried to close the window */
e.preventDefault(); closeAppAfterLoading = true;
} e.preventDefault();
}
}
}); });
} }
// close app // close app
function forseCloseApp() { function forseCloseApp() {
loadingWindow = null; forceQuitApp = true;
mainWindow = null;
app.quit(); app.quit();
} }
function setDefaultAppSettings() {
shepherd.saveLocalAppConf(_defaultAppSettings);
}
function updateAppSettings(_settings) {
shepherd.saveLocalAppConf(_settings);
appConfig = _settings;
}
app.on('ready', createLoadingWindow); app.on('ready', createLoadingWindow);
function createAppCloseWindow() { function createAppCloseWindow() {
@ -253,7 +272,7 @@ function createAppCloseWindow() {
show: false, show: false,
}); });
appCloseWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/app-closing.html`); appCloseWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/startup/app-closing.html`);
appCloseWindow.webContents.on('did-finish-load', function() { appCloseWindow.webContents.on('did-finish-load', function() {
setTimeout(function() { setTimeout(function() {
@ -262,7 +281,49 @@ function createAppCloseWindow() {
}); });
} }
function reloadSettingsWindow() {
appSettingsWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/startup/app-settings.html`);
}
function createAppSettingsWindow() {
// initialise window
appSettingsWindow = new BrowserWindow({ // dirty hack to prevent main window flash on quit
width: 750,
height: 820,
frame: false,
icon: iguanaIcon,
show: false,
});
appSettingsWindow.appConfig = appConfig;
appSettingsWindow.appConfigSchema = shepherd.appConfigSchema;
appSettingsWindow.defaultAppSettings = _defaultAppSettings;
appSettingsWindow.destroyAppSettingsWindow = destroyAppSettingsWindow;
appSettingsWindow.reloadSettingsWindow = reloadSettingsWindow;
appSettingsWindow.testLocation = shepherd.testLocation;
appSettingsWindow.setDefaultAppSettings = setDefaultAppSettings;
appSettingsWindow.updateAppSettings = updateAppSettings;
appSettingsWindow.testBins = shepherd.testBins;
appSettingsWindow.zcashParamsExist = _zcashParamsExist;
appSettingsWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/startup/app-settings.html`);
appSettingsWindow.webContents.on('did-finish-load', function() {
setTimeout(function() {
appSettingsWindow.show();
}, 40);
});
}
function destroyAppSettingsWindow() {
appSettingsWindow.hide();
appSettingsWindow = null;
}
function createWindow(status) { function createWindow(status) {
if (appSettingsWindow) {
destroyAppSettingsWindow();
}
if (status === 'open') { if (status === 'open') {
require(path.join(__dirname, 'private/mainmenu')); require(path.join(__dirname, 'private/mainmenu'));
@ -326,7 +387,7 @@ function createWindow(status) {
mainWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/EasyDEX-GUI/`); mainWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/EasyDEX-GUI/`);
} }
} else { } else {
mainWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/main.html`); mainWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/startup/main.html`);
} }
mainWindow.webContents.on('context-menu', (e, params) => { // context-menu returns params mainWindow.webContents.on('context-menu', (e, params) => { // context-menu returns params
@ -349,7 +410,7 @@ function createWindow(status) {
shepherd.writeLog('exiting app...'); shepherd.writeLog('exiting app...');
shepherd.dumpCacheBeforeExit(); shepherd.dumpCacheBeforeExit();
shepherd.quitKomodod(); shepherd.quitKomodod(1000);
pm2.connect(true, function(err) { pm2.connect(true, function(err) {
console.log('connecting to pm2...'); console.log('connecting to pm2...');
@ -468,7 +529,8 @@ app.on('window-all-closed', function() {
// Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. // Calling event.preventDefault() will prevent the default behaviour, which is terminating the application.
app.on('before-quit', function(event) { app.on('before-quit', function(event) {
console.log('before-quit'); console.log('before-quit');
if (mainWindow === null && loadingWindow != null) { // mainWindow not intitialised and loadingWindow not dereferenced shepherd.killRogueProcess('iguana'); // kill any rogue iguana core instances
if (!forceQuitApp && mainWindow === null && loadingWindow != null) { // mainWindow not intitialised and loadingWindow not dereferenced
// loading window is still open // loading window is still open
console.log('before-quit prevented'); console.log('before-quit prevented');
shepherd.writeLog('quit app after loading is done'); shepherd.writeLog('quit app after loading is done');
@ -482,7 +544,7 @@ app.on('before-quit', function(event) {
// Emitted when all windows have been closed and the application will quit. // Emitted when all windows have been closed and the application will quit.
// Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. // Calling event.preventDefault() will prevent the default behaviour, which is terminating the application.
app.on('will-quit', function(event) { app.on('will-quit', function(event) {
if (mainWindow === null && loadingWindow != null) { if (!forceQuitApp && mainWindow === null && loadingWindow != null) {
// loading window is still open // loading window is still open
console.log('will-quit while loading window active'); console.log('will-quit while loading window active');
event.preventDefault(); event.preventDefault();
@ -492,7 +554,7 @@ app.on('will-quit', function(event) {
// Emitted when the application is quitting. // Emitted when the application is quitting.
// Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. // Calling event.preventDefault() will prevent the default behaviour, which is terminating the application.
app.on('quit', function(event) { app.on('quit', function(event) {
if (mainWindow === null && loadingWindow != null) { if (!forceQuitApp && mainWindow === null && loadingWindow != null) {
console.log('quit while loading window active'); console.log('quit while loading window active');
event.preventDefault(); event.preventDefault();
} }

3
make-patch.sh

@ -16,8 +16,7 @@ mkdir patch/gui/EasyDEX-GUI/react
mkdir patch/gui/EasyDEX-GUI/react mkdir patch/gui/EasyDEX-GUI/react
cp -R gui/EasyDEX-GUI/react/build patch/gui/EasyDEX-GUI/react/build cp -R gui/EasyDEX-GUI/react/build patch/gui/EasyDEX-GUI/react/build
cp -R gui/EasyDEX-GUI/assets patch/gui/EasyDEX-GUI cp -R gui/EasyDEX-GUI/assets patch/gui/EasyDEX-GUI
cp gui/index.html patch/gui/index.html cp -R gui/startup patch/gui/startup
cp gui/app-closing.html patch/gui/app-closing.html
cp ./main.js patch cp ./main.js patch
cp ./version patch cp ./version patch
cp -R routes patch/routes cp -R routes patch/routes

2
package.json

@ -1,7 +1,7 @@
{ {
"name": "agama_app", "name": "agama_app",
"productName": "Agama", "productName": "Agama",
"version": "0.1.6", "version": "0.2.22",
"description": "Agama Desktop App", "description": "Agama Desktop App",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

27
routes/appConfig.js

@ -1,5 +1,5 @@
const appConfig = { const appConfig = {
config: { config: { // default config
edexGuiOnly: true, edexGuiOnly: true,
iguanaGuiOnly: false, iguanaGuiOnly: false,
manualIguanaStart: false, manualIguanaStart: false,
@ -23,6 +23,7 @@ const appConfig = {
}, },
iguanaLessMode: true, iguanaLessMode: true,
roundValues: false, roundValues: false,
experimentalFeatures: false,
dataDir: '', dataDir: '',
}, },
schema: { schema: {
@ -66,6 +67,7 @@ const appConfig = {
}, },
iguanaCorePort: { iguanaCorePort: {
display: true, display: true,
initDisplay: true,
type: 'number', type: 'number',
displayName: 'Iguana Core Port', displayName: 'Iguana Core Port',
info: 'Default Iguana Core Port. Change it if you have conflicts with other applications.', info: 'Default Iguana Core Port. Change it if you have conflicts with other applications.',
@ -92,8 +94,9 @@ const appConfig = {
}, },
dev: { dev: {
display: true, display: true,
initDisplay: true,
displayName: 'Developer mode', displayName: 'Developer mode',
info: 'Enable developer mode.', info: 'Enable developer mode',
type: 'boolean', type: 'boolean',
}, },
v2: { v2: {
@ -102,12 +105,14 @@ const appConfig = {
}, },
useBasiliskInstance: { useBasiliskInstance: {
display: true, display: true,
initDisplay: true,
displayName: 'Iguana Core Basilisk Instance', displayName: 'Iguana Core Basilisk Instance',
info: 'Enable dedicated Iguana Core instance to handle all Basilisk network requests', info: 'Enable dedicated Iguana Core instance to handle all Basilisk network requests',
type: 'boolean', type: 'boolean',
}, },
debug: { debug: {
display: true, display: true,
initDisplay: true,
displayName: 'Debug', displayName: 'Debug',
info: 'Enable debug output', info: 'Enable debug output',
type: 'boolean', type: 'boolean',
@ -137,15 +142,29 @@ const appConfig = {
roundValues: { roundValues: {
display: true, display: true,
displayName: 'Enable amount rounding', displayName: 'Enable amount rounding',
info: 'Round \"dust\" amounts to save screen space.', info: 'Round \"dust\" amounts to save screen space',
type: 'boolean',
},
experimentalFeatures: {
display: true,
initDisplay: true,
displayName: 'Enable experimental features',
type: 'boolean', type: 'boolean',
}, },
dataDir: { dataDir: {
display: true, display: true,
initDisplay: true,
displayName: 'Komodo data directory', displayName: 'Komodo data directory',
info: 'The data directory is the location where Komodo data files are stored, including the wallet data file.', info: 'The data directory is the location where Komodo data files are stored, including the wallet data file',
type: 'folder', type: 'folder',
}, },
daemonOutput: {
display: false,
initDisplay: true,
displayName: 'Output daemon prints (debug)',
info: 'Output daemon prints to GUI for debug purposes',
type: 'boolean',
},
}, },
}; };

14
routes/cache.js

@ -30,7 +30,7 @@ cache.get = function(req, res, next) {
console.log('serving cache from disk'); console.log('serving cache from disk');
if (fs.existsSync(`${cache.iguanaDir}/shepherd/cache-${pubkey}.json`)) { if (fs.existsSync(`${cache.iguanaDir}/shepherd/cache-${pubkey}.json`)) {
fs.readFile(`${cache.iguanaDir}/shepherd/cache-${pubkey}.json`, 'utf8', function (err, data) { fs.readFile(`${cache.iguanaDir}/shepherd/cache-${pubkey}.json`, 'utf8', function(err, data) {
if (err) { if (err) {
const errorObj = { const errorObj = {
msg: 'error', msg: 'error',
@ -101,7 +101,7 @@ cache.groomGet = function(req, res, next) {
if (_filename) { if (_filename) {
if (fs.existsSync(`${cache.iguanaDir}/shepherd/cache-${_filename}.json`)) { if (fs.existsSync(`${cache.iguanaDir}/shepherd/cache-${_filename}.json`)) {
fs.readFile(`${cache.iguanaDir}/shepherd/cache-${_filename}.json`, 'utf8', function (err, data) { fs.readFile(`${cache.iguanaDir}/shepherd/cache-${_filename}.json`, 'utf8', function(err, data) {
if (err) { if (err) {
const errorObj = { const errorObj = {
msg: 'error', msg: 'error',
@ -198,7 +198,7 @@ cache.groomPost = function(req, res) {
console.log('appending groom post to in mem cache'); console.log('appending groom post to in mem cache');
console.log('appending groom post to on disk cache'); console.log('appending groom post to on disk cache');
fs.writeFile(`${cache.iguanaDir}/shepherd/cache-${_filename}.json`, _payload, function (err) { fs.writeFile(`${cache.iguanaDir}/shepherd/cache-${_filename}.json`, _payload, function(err) {
if (err) { if (err) {
const errorObj = { const errorObj = {
msg: 'error', msg: 'error',
@ -499,7 +499,7 @@ cache.one = function(req, res, next) {
request({ request({
url: mock ? `http://localhost:17777/shepherd/mock?url=${dexUrl}` : dexUrl, url: mock ? `http://localhost:17777/shepherd/mock?url=${dexUrl}` : dexUrl,
method: 'GET' method: 'GET'
}, function (error, response, body) { }, function(error, response, body) {
if (response && if (response &&
response.statusCode && response.statusCode &&
response.statusCode === 200) { response.statusCode === 200) {
@ -528,7 +528,7 @@ cache.one = function(req, res, next) {
request({ request({
url: `http://kmd.explorer.supernet.org/api/addr/${address}/?noTxList=1`, url: `http://kmd.explorer.supernet.org/api/addr/${address}/?noTxList=1`,
method: 'GET' method: 'GET'
}, function (error, response, body) { }, function(error, response, body) {
if (response && if (response &&
response.statusCode && response.statusCode &&
response.statusCode === 200) { response.statusCode === 200) {
@ -676,7 +676,7 @@ cache.one = function(req, res, next) {
request({ request({
url: mock ? `http://localhost:17777/shepherd/mock?url=${tempUrl}` : tempUrl, url: mock ? `http://localhost:17777/shepherd/mock?url=${tempUrl}` : tempUrl,
method: 'GET' method: 'GET'
}, function (error, response, body) { }, function(error, response, body) {
if (response && if (response &&
response.statusCode && response.statusCode &&
response.statusCode === 200) { response.statusCode === 200) {
@ -709,7 +709,7 @@ cache.one = function(req, res, next) {
request({ request({
url: mock ? `http://localhost:17777/shepherd/mock?url=${tempUrl}` : tempUrl, url: mock ? `http://localhost:17777/shepherd/mock?url=${tempUrl}` : tempUrl,
method: 'GET' method: 'GET'
}, function (error, response, body) { }, function(error, response, body) {
if (response && if (response &&
response.statusCode && response.statusCode &&
response.statusCode === 200) { response.statusCode === 200) {

824
routes/shepherd.js

File diff suppressed because it is too large

2
version

@ -1,3 +1,3 @@
version=0.2.0.21a version=0.2.0.22a
type=e-beta type=e-beta
minversion=0.2.0.2 minversion=0.2.0.2

2
version_build

@ -1 +1 @@
0.2.0.1a-beta 0.2.0.22a-beta

Loading…
Cancel
Save