Skip to content

Commit

Permalink
Merge pull request #51 from VerusCoin/dev
Browse files Browse the repository at this point in the history
0.7.1
  • Loading branch information
Asherda authored Jul 14, 2020
2 parents dd18eed + ea62b8b commit 0166f1a
Show file tree
Hide file tree
Showing 41 changed files with 1,229 additions and 363 deletions.
24 changes: 12 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ stages:
variables:
DOCKER_DRIVER: overlay2
DEFAULT_VERUSCOIN_BRANCH: release
VERUS_VERSION: 0.7.0-4
VERUSCOIN_VERSION: 0.7.0-4
KOMODO_VERSION: 0.6.0
VERUS_VERSION: 0.7.1
VERUSCOIN_VERSION: 0.7.1
KOMODO_VERSION: 0.6.1
BINARY_SOURCE: VerusCoin
VERUS_APPIMAGE_X64: Verus-Desktop-v${VERUS_VERSION}-x86_64.AppImage
VERUS_APPIMAGE_ARM64: Verus-Desktop-v${VERUS_VERSION}-arm64.AppImage
Expand Down Expand Up @@ -54,9 +54,9 @@ build:linux:
- tar -xzvf Verus-CLI-Linux-v${VERUSCOIN_VERSION}-amd64.tar.gz --strip=1 --directory assets/bin/linux64/verusd
- rm Verus-CLI-Linux-v${VERUSCOIN_VERSION}-amd64.tar.gz
- mkdir -p assets/bin/linux64/komodod
- wget https://github.com/KomodoPlatform/komodo/releases/download/${KOMODO_VERSION}/linux64_${KOMODO_VERSION}.tar.gz
- tar -xzvf linux64_${KOMODO_VERSION}.tar.gz --strip=1 --directory assets/bin/linux64/komodod
- rm linux64_${KOMODO_VERSION}.tar.gz
- wget https://github.com/KomodoPlatform/komodo/releases/download/${KOMODO_VERSION}/komodo_linux_${KOMODO_VERSION}.tar.gz
- tar -xzvf komodo_linux_${KOMODO_VERSION}.tar.gz --strip=1 --directory assets/bin/linux64/komodod
- rm komodo_linux_${KOMODO_VERSION}.tar.gz
- strip --strip-unneeded assets/bin/linux64/komodod/komodod && strip --strip-unneeded assets/bin/linux64/komodod/komodo-cli
- gsutil cp $STAGING/VerusCoin/Zcash/zcashd-linux-amd64.tar.gz .
- tar -xzvf zcashd-linux-amd64.tar.gz --directory assets/bin/linux64/
Expand Down Expand Up @@ -134,11 +134,11 @@ build:windows:
- yarn run build
- cd ../../..
- mkdir -p assets/bin/win64/komodod
- wget https://github.com/KomodoPlatform/komodo/releases/download/${KOMODO_VERSION}/win64_${KOMODO_VERSION}.zip
- unzip win64_${KOMODO_VERSION}.zip
- wget https://github.com/KomodoPlatform/komodo/releases/download/${KOMODO_VERSION}/komodo_windows_${KOMODO_VERSION}.zip
- unzip komodo_windows_${KOMODO_VERSION}.zip
- mv win64/komodod.exe win64/komodo-cli.exe assets/bin/win64/komodod
- rm -rf win64
- rm win64_${KOMODO_VERSION}.zip
- rm komodo_windows_${KOMODO_VERSION}.zip
- gsutil cp $STAGING/$VERUS_CLI_WINDOWS .
- unzip -qq Verus-CLI-Windows-v${VERUSCOIN_VERSION}.zip -d assets/bin/win64
- mv assets/bin/win64/verus-cli assets/bin/win64/verusd
Expand Down Expand Up @@ -179,12 +179,12 @@ build:mac:
- yarn run build
- cd ../../..
- gsutil cp $STAGING/$VERUS_CLI_MACOS .
- wget https://github.com/KomodoPlatform/komodo/releases/download/${KOMODO_VERSION}/macos_${KOMODO_VERSION}.tar.gz
- wget https://github.com/KomodoPlatform/komodo/releases/download/${KOMODO_VERSION}/komodo_macos_${KOMODO_VERSION}.tar.gz
- mkdir -p assets/bin/osx/verusd
- mkdir -p assets/bin/osx/komodod
- tar -xzf Verus-CLI-MacOS-v${VERUSCOIN_VERSION}.tar.gz --strip=1 --directory assets/bin/osx/verusd
- tar -xzvf macos_${KOMODO_VERSION}.tar.gz --strip=1 --directory assets/bin/osx/komodod
- rm macos_${KOMODO_VERSION}.tar.gz
- tar -xzvf komodo_macos_${KOMODO_VERSION}.tar.gz --strip=1 --directory assets/bin/osx/komodod
- rm komodo_macos_${KOMODO_VERSION}.tar.gz
- rm Verus-CLI-MacOS-v${VERUSCOIN_VERSION}.tar.gz
- gsutil cp $STAGING/VerusCoin/Zcash/zcashd-macos.tar.gz .
- tar -xzvf zcashd-macos.tar.gz --directory assets/bin/osx/
Expand Down
2 changes: 1 addition & 1 deletion gui/Verus-Desktop-GUI
Submodule Verus-Desktop-GUI updated 131 files
31 changes: 25 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ ipcMain.on('staticVar', (event, arg) => {
event.sender.send('staticVar', !arg ? staticVar : staticVar[arg]);
});

let localVersion;
const localVersionFile = fs.readFileSync(`${__dirname}/version`, 'utf8');

localVersion = localVersionFile.split(localVersionFile.indexOf('\r\n') > -1 ? '\r\n' : '\n');

global.USB_HOME_DIR = path.resolve(__dirname, './usb_home')

// TODO: Implement in a way less likely to confuse people
// USB Mode sets all necesarry files/folders to be in app parent directory
global.USB_MODE = false
/*localVersion[2] &&
localVersion[2].split("=")[1] &&
localVersion[2].split("=")[1] === "usb"
? true
: false;*/

global.HOME = global.USB_MODE
? global.USB_HOME_DIR
: os.platform() === "win32"
? process.env.APPDATA
: process.env.HOME;

if (osPlatform === 'linux') {
process.env.ELECTRON_RUN_AS_NODE = true;
}
Expand All @@ -47,20 +69,15 @@ const { appConfig } = api
/*const nativeCoindList = api.scanNativeCoindBins(); // dex related
api.setVar('nativeCoindList', nativeCoindList);*/

let localVersion;
let localVersionFile = api.readVersionFile();
localVersion = localVersionFile.split(localVersionFile.indexOf('\r\n') > -1 ? '\r\n' : '\n');

const appBasicInfo = {
name: 'Verus Desktop',
mode: global.USB_MODE ? 'usb' : 'standard',
version: localVersion[0],
};

app.setName(appBasicInfo.name);
app.setVersion(appBasicInfo.version);

api.createAgamaDirs();

// parse argv
let _argv = {};

Expand All @@ -87,6 +104,7 @@ for (let i = 0; i < process.argv.length; i++) {
const appSessionHash = _argv.token ? _argv.token : randomBytes(32).toString('hex');
const _spvFees = api.getSpvFees();

api.writeLog('usb mode: ' + global.USB_MODE, 'init');
api.writeLog(`app info: ${appBasicInfo.name} ${appBasicInfo.version}`);
api.writeLog('sys info:');
api.writeLog(`totalmem_readable: ${formatBytes(os.totalmem())}`);
Expand All @@ -102,6 +120,7 @@ if (process.argv.indexOf('devmode') > -1 ||
api.log(`app init ${appSessionHash}`, 'init');
}

api.log('usb mode: ' + global.USB_MODE, 'init');
api.log(`app info: ${appBasicInfo.name} ${appBasicInfo.version}`, 'init');
api.log('sys info:', 'init');
api.log(`totalmem_readable: ${formatBytes(os.totalmem())}`, 'init');
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "verus-desktop",
"productName": "Verus-Desktop",
"version": "0.7.0-4",
"version": "0.7.1",
"description": "Verus Desktop Wallet App",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -56,6 +56,7 @@
"buffer-reverse": "^1.0.1",
"coinselect": "github:bitcoinjs/coinselect",
"create-hash": "git://github.com/pbca26/createHash#electron-v4",
"csv-writer": "^1.6.0",
"ethers": "^4.0.44",
"express": "^4.14.0",
"fix-path": "^2.1.0",
Expand Down
39 changes: 38 additions & 1 deletion private/mainmenu.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const { Menu } = require('electron');
const electron = require('electron');
const app = electron.app;
const { shell } = require('electron');
const { shell, dialog } = require('electron');
const {
pathsAgama,
pathsDaemons,
} = require('../routes/api/pathsUtil');
const path = require('path')
const fs = require('fs')

const template = [
{
Expand Down Expand Up @@ -138,6 +140,41 @@ const template = [
shell.openItem(pathsDaemons().komodocliDir);
}
},
/*{
label: global.USB_MODE ? 'Disable USB Mode' : 'Enable USB Mode',
click (item, focusedWindow) {
const verusIcon = path.join(__dirname, '../assets/icons/vrsc_256x256x32.png');
try {
const rootLocation = path.join(__dirname, '../');
const location = `${rootLocation}version`
const localVersionFile = fs.readFileSync(location, 'utf8');
let localVersion = localVersionFile.split(localVersionFile.indexOf('\r\n') > -1 ? '\r\n' : '\n');
localVersion[2] = global.USB_MODE ? "mode=standard" : "mode=usb"
fs.writeFileSync(location, localVersion.join('\n'))
dialog.showMessageBox({
icon: verusIcon,
title: "Success",
message: `${
global.USB_MODE ? "Disabled" : "Enabled"
} USB mode, restart Verus Desktop for changes to take effect.`,
});
} catch(e) {
console.log(e)
dialog.showMessageBox({
icon: verusIcon,
type: "error",
title: "Error",
message: `Failed to ${
global.USB_MODE ? "disable" : "enable"
} USB mode.`,
});
}
}
}*/,
]
}
];
Expand Down
7 changes: 6 additions & 1 deletion routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ api.logFileIndex = {};
api.coindStdout = {};
api.guiLog = {};
api.rpcConf = {};
api.customKomodoNetworks = {};
api.appRuntimeLog = [];
api.lockDownAddCoin = false;
api._isWatchOnly = false;
Expand Down Expand Up @@ -70,10 +71,10 @@ api.pathsAgama();
api.pathsDaemons();

// core
api = require('./api/data_files/jsonFileManager')(api);
api = require('./api/log.js')(api);
api = require('./api/config.js')(api);
api = require('./api/users.js')(api);
api = require('./api/data_files/jsonFileManager')(api);
api = require('./api/init.js')(api);

api.createAgamaDirs();
Expand Down Expand Up @@ -142,6 +143,7 @@ api = require('./api/native/nameRegistration.js')(api);
api = require('./api/native/idRegistration.js')(api);
api = require('./api/native/idRevocation.js')(api);
api = require('./api/native/idInformation.js')(api);
api = require('./api/native/getCurrencies.js')(api);
api = require('./api/native/getCurrency.js')(api);
api = require('./api/native/currencyGraylist.js')(api);
api = require('./api/native/idRecovery.js')(api);
Expand Down Expand Up @@ -183,6 +185,9 @@ api = require('./api/addressBook.js')(api);
api = require('./api/dice.js')(api);
api = require('./api/system.js')(api);

// Utility APIs
api = require('./api/utility_apis/csvExport.js')(api);

// elections
api = require('./api/elections.js')(api);

Expand Down
25 changes: 14 additions & 11 deletions routes/api/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = (api) => {
const localMissing = flatDefault.filter(x => {return !flatLocal.includes(x)})

if (localMissing.length > 0) {
api.log('The local is missing the following properties! Attempting to add them in now...', 'settings');
api.log('The local config is missing the following properties! Attempting to add them in now...', 'settings');
api.log(localMissing, 'settings');

localMissing.forEach(propertyGroup => {
Expand Down Expand Up @@ -99,11 +99,7 @@ module.exports = (api) => {
}

fs.writeFileSync(configFileName,
JSON.stringify(appSettings)
.replace(/,/g, ',\n') // format json in human readable form
.replace(/":/g, '": ')
.replace(/{/g, '{\n')
.replace(/}/g, '\n}'), 'utf8');
JSON.stringify(appSettings), 'utf8');


api.log('config.json write file is done', 'settings');
Expand All @@ -112,6 +108,7 @@ module.exports = (api) => {
} catch (e) {
api.log('error writing config', 'settings');
api.log(e, 'settings');
throw e;
}
}

Expand All @@ -129,14 +126,20 @@ module.exports = (api) => {

res.end(JSON.stringify(retObj));
} else {
api.saveLocalAppConf(req.body.configObj);
try {
api.saveLocalAppConf(req.body.configObj);
} catch(e) {
res.end(JSON.stringify({
msg: 'error',
result: e.message,
}));
return
}

const retObj = {
res.end(JSON.stringify({
msg: 'success',
result: 'config saved',
};

res.end(JSON.stringify(retObj));
}));
}
} else {
const retObj = {
Expand Down
12 changes: 11 additions & 1 deletion routes/api/daemonControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ module.exports = (api) => {
let port = null;

api.log(`${coin} daemon activation requested with ${daemon} binary...`, 'native.process');
api.log(`selected data: ${JSON.stringify(acOptions, null, '\t')}`, 'native.confd');

return new Promise((resolve, reject) => {
// Set coin daemon bin location into memory if it doesn't exist there yet
Expand All @@ -431,6 +430,17 @@ module.exports = (api) => {
api.log(`${coin} dir path set to ${api[`${coinLc}Dir`]}...`, 'native.process');
} else api.log(`${coin} data directory retrieved...`, 'native.process');

if (global.USB_MODE) {
acOptions.push(`-datadir=${api[`${coin.toLowerCase()}Dir`]}`)
} else if (
api.appConfig.coin.native.dataDir[coin] &&
api.appConfig.coin.native.dataDir[coin].length > 0
) {
acOptions.push(`-datadir=${api.appConfig.coin.native.dataDir[chainTicker]}`)
}

api.log(`selected data: ${JSON.stringify(acOptions, null, '\t')}`, 'native.confd');

api.initCoinDir(coinLc)
.then(() => {
return Promise.all([api.initLogfile(coin), api.initConffile(coin, confName, fallbackPort)])
Expand Down
Loading

0 comments on commit 0166f1a

Please sign in to comment.