Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
vikas-cis committed Mar 13, 2019
2 parents b23d5e8 + c35f3ce commit 1c4f2b5
Show file tree
Hide file tree
Showing 157 changed files with 3,015 additions and 2,175 deletions.
3 changes: 2 additions & 1 deletion .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"dev": "environments/environment.ts",
"docker1": "environments/environment.docker1.ts",
"docker2": "environments/environment.docker2.ts",
"prod": "environments/environment.prod.ts"
"prod": "environments/environment.prod.ts",
"test": "environments/environment.test.ts"
}
}
],
Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ before_script:
- yarn install
- if [[ $TRUE_COMMIT_MESSAGES == *"+latest"* ]]; then yarn add https://github.com/particl/particl-market; fi;

script:
script:
- echo 'Build Dist' && echo -en 'travis_fold:start:script.build\\r'
- yarn build --base-href="./"
- echo -en 'travis_fold:end:script.build\\r'

- echo 'Lint Codebase' && echo -en 'travis_fold:start:script.lint\\r'
- yarn run lint
- echo -en 'travis_fold:end:script.lint\\r'

- echo 'Test Codebase' && echo -en 'travis_fold:start:script.test\\r'
- yarn run travis:test
- echo -en 'travis_fold:end:script.test\\r'

- if [[ $TRUE_COMMIT_MESSAGES == *"+build"* ]]; then ./nightly.sh; fi;

- echo 'Done!'

# Disable coveralls for now
after_script:
- npm run coveralls
Expand Down
Binary file modified background-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified download-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = function (config) {
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
environment: 'test'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
Expand All @@ -41,7 +41,7 @@ module.exports = function (config) {
browsers: ['Chrome'],
singleRun: false,
captureTimeout: 210000,
browserDisconnectTolerance: 3,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000,
});
Expand Down
27 changes: 15 additions & 12 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@ if (process.platform === 'linux') {

/* check for paths existence and create */
[ app.getPath('userData'),
app.getPath('userData') + '/testnet'
].map(path => !fs.existsSync(path) && fs.mkdir(path));
path.join(app.getPath('userData'), 'testnet')
].map(path => !fs.existsSync(path) && fs.mkdirSync(path));

if (app.getVersion().includes('RC'))
if (app.getVersion().includes('testnet'))
process.argv.push(...['-testnet']);

const options = require('./modules/options').parse();
const options = require('./modules/daemon/daemonConfig').getConfiguration();
const log = require('./modules/logger').init();
const init = require('./modules/init');
const rpc = require('./modules/rpc/rpc');
const _auth = require('./modules/webrequest/http-auth');
const daemon = require('./modules/daemon/daemon');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
Expand All @@ -41,10 +39,10 @@ app.on('ready', () => {
log.info('app ready')
log.debug('argv', process.argv);
log.debug('options', options);

// initialize the authentication filter
_auth.init();

initMainWindow();
init.start(mainWindow);
});
Expand Down Expand Up @@ -92,7 +90,11 @@ function initMainWindow() {
minHeight: 675,
icon: path.join(__dirname, 'resources/icon.png'),

frame: true,
darkTheme: true,

webPreferences: {
backgroundThrottling: false,
webviewTag: false,
nodeIntegration: false,
sandbox: true,
Expand All @@ -101,6 +103,11 @@ function initMainWindow() {
},
});

// Hide the menu bar, press ALT
// to show it again.
mainWindow.setMenuBarVisibility(false);
mainWindow.setAutoHideMenuBar(true);

// and load the index.html of the app.
if (options.dev) {
mainWindow.loadURL('http://localhost:4200');
Expand Down Expand Up @@ -153,10 +160,6 @@ function makeTray() {
{
label: 'View',
submenu: [
{
label: 'Reload',
click() { mainWindow.webContents.reloadIgnoringCache(); }
},
{
label: 'Open Dev Tools',
click() { mainWindow.openDevTools(); }
Expand Down
52 changes: 26 additions & 26 deletions modules/clientBinaries/clientBinaries.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"clients": {
"particld": {
"version": "0.17.0.3",
"version": "0.18.0.5",
"platforms": {
"linux": {
"arm": {
"download": {
"url": "https://github.com/particl/particl-core/releases/download/v0.17.0.3/particl-0.17.0.3-arm-linux-gnueabihf.tar.gz",
"url": "https://github.com/particl/particl-core/releases/download/v0.18.0.5rc1/particl-0.18.0.5-arm-linux-gnueabihf.tar.gz",
"type": "tar",
"sha256": "b7f301739958b4780ffe290bfd926fb95b3761b15585b67f6d81bca6b1517d9e",
"bin": "particl-0.17.0.3/bin/particld"
"sha256": "d505e45dfb8a0004f5b22b49d6723f2125127f608267fb9b23312379470986c8",
"bin": "particl-0.18.0.5/bin/particld"
},
"bin": "particld",
"commands": {
Expand All @@ -19,17 +19,17 @@
],
"output": [
"Particl Core Daemon",
"0.17.0.3"
"0.18.0.5"
]
}
}
},
"ia32": {
"download": {
"url": "https://github.com/particl/particl-core/releases/download/v0.17.0.3/particl-0.17.0.3-i686-pc-linux-gnu_nousb.tar.gz",
"url": "https://github.com/particl/particl-core/releases/download/v0.18.0.5rc1/particl-0.18.0.5-i686-pc-linux-gnu_nousb.tar.gz",
"type": "tar",
"sha256": "9d74f18058811fad45f1873d78644cf869c10ec04170ffa1c0b3f36470356b91",
"bin": "particl-0.17.0.3/bin/particld"
"sha256": "cca3fa817d0c2a9e5cc910b83653329e6f8f1d42876624af31dd3c21fe6e7676",
"bin": "particl-0.18.0.5/bin/particld"
},
"bin": "particld",
"commands": {
Expand All @@ -39,17 +39,17 @@
],
"output": [
"Particl Core Daemon",
"0.17.0.3"
"0.18.0.5"
]
}
}
},
"x64": {
"download": {
"url": "https://github.com/particl/particl-core/releases/download/v0.17.0.3/particl-0.17.0.3-x86_64-linux-gnu_nousb.tar.gz",
"url": "https://github.com/particl/particl-core/releases/download/v0.18.0.5rc1/particl-0.18.0.5-x86_64-linux-gnu_nousb.tar.gz",
"type": "tar",
"sha256": "ed974d679c0867d8fae1f1eacb876312f43ab6177966707203b807c58f6ade85",
"bin": "particl-0.17.0.3/bin/particld"
"sha256": "b1db81fb1c4f6301abdabdeec0a53c26d0d6fad97d3aa300eb97ba19765411ab",
"bin": "particl-0.18.0.5/bin/particld"
},
"bin": "particld",
"commands": {
Expand All @@ -59,7 +59,7 @@
],
"output": [
"Particl Core Daemon",
"0.17.0.3"
"0.18.0.5"
]
}
}
Expand All @@ -68,10 +68,10 @@
"mac": {
"x64": {
"download": {
"url": "https://github.com/particl/particl-core/releases/download/v0.17.0.3/particl-0.17.0.3-osx64.tar.gz",
"url": "https://github.com/particl/particl-core/releases/download/v0.18.0.5rc1/particl-0.18.0.5-osx64.tar.gz",
"type": "tar",
"sha256": "f5c8a0ca28b3c8449b8b09c5b9d35aeffad2830718a18792dc94204a9018fca3",
"bin": "particl-0.17.0.3/bin/particld"
"sha256": "d543b115d447cf1f4c7ac02dfeb3b6fee09851fbec8e3521ec665d75b2969a9d",
"bin": "particl-0.18.0.5/bin/particld"
},
"bin": "particld",
"commands": {
Expand All @@ -81,7 +81,7 @@
],
"output": [
"Particl Core Daemon",
"0.17.0.3"
"0.18.0.5"
]
}
}
Expand All @@ -90,10 +90,10 @@
"win": {
"ia32": {
"download": {
"url": "https://github.com/particl/particl-core/releases/download/v0.17.0.3/particl-0.17.0.3-win32.zip",
"url": "https://github.com/particl/particl-core/releases/download/v0.18.0.5rc1/particl-0.18.0.5-win32.zip",
"type": "zip",
"sha256": "69b037e5ef791d5f9321737afb6c9ec2e1137890ee7beb9c13ed8d88d18f8874",
"bin": "particl-0.17.0.3/bin/particld.exe"
"sha256": "f9b7a97cbe9ebeb591cb0cca08460061b4d7efc7141558e6f73e08a8c29225b0",
"bin": "particl-0.18.0.5/bin/particld.exe"
},
"bin": "particld.exe",
"commands": {
Expand All @@ -103,17 +103,17 @@
],
"output": [
"Particl Core Daemon",
"0.17.0.3"
"0.18.0.5"
]
}
}
},
"x64": {
"download": {
"url": "https://github.com/particl/particl-core/releases/download/v0.17.0.3/particl-0.17.0.3-win64.zip",
"url": "https://github.com/particl/particl-core/releases/download/v0.18.0.5rc1/particl-0.18.0.5-win64.zip",
"type": "zip",
"sha256": "35004203add1efc06dfe6d0912afe313fa087e44738138ae2a8df31b9cf049fb",
"bin": "particl-0.17.0.3/bin/particld.exe"
"sha256": "d1b74698091fa76ec41f7808b4e052fadb623a3a0553e109d03d5d8d54c689cf",
"bin": "particl-0.18.0.5/bin/particld.exe"
},
"bin": "particld.exe",
"commands": {
Expand All @@ -123,7 +123,7 @@
],
"output": [
"Particl Core Daemon",
"0.17.0.3"
"0.18.0.5"
]
}
}
Expand All @@ -132,4 +132,4 @@
}
}
}
}
}
36 changes: 32 additions & 4 deletions modules/clientBinaries/clientBinariesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const got = require('got'),
fs = require('fs'),
crypto = require('crypto'),
path = require('path'),
tmp = require('tmp'),
mkdirp = require('mkdirp'),
unzip = require('node-unzip-2'),
spawn = require('buffered-spawn'),
Expand Down Expand Up @@ -117,6 +116,17 @@ class Manager extends EventEmitter {
return this._scan(options);
}

/**
* Stops any ongoing download.
*
* Emits a 'close' event that is only necessarily detected when a download is ongoing.
*
* @return void
*/
shutdown() {
this.emit('cancel');
}

/**
* Download a particular client.
*
Expand Down Expand Up @@ -188,7 +198,7 @@ class Manager extends EventEmitter {
this._logger.debug('Generating download folder path ...');

const downloadFolder = path.join(
options.downloadFolder || tmp.dirSync().name,
options.downloadFolder,
client.id
);

Expand All @@ -207,6 +217,20 @@ class Manager extends EventEmitter {

stream.pipe(writeStream);

this.once('cancel', async () => {
this._logger.info('Stopping download of binary...');
try {
stream.unpipe(writeStream);
writeStream.end();
stream.destroy();
} catch (err) { }
if (progressBar) {
progressBar.stop();
}

reject({message: 'Cancellation of download', status: 'cancel'});
});

stream.on('downloadProgress', (info) => {
if (progressBar) {
progressBar.update(info.transferred);
Expand Down Expand Up @@ -238,6 +262,12 @@ class Manager extends EventEmitter {
status: 'error'
});
}

try {
// Attempt at cleanup
// (in case of situation such as noted by the caveat in https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options )
writeStream.close();
} catch (err) { }
this._logger.error(err);
reject(new Error(`Error downloading package for ${clientId}: ${err.message}`));
});
Expand Down Expand Up @@ -265,8 +295,6 @@ class Manager extends EventEmitter {
return promise;
})
.then((dInfo) => {
const downloadFolder = dInfo.downloadFolder,
downloadFile = dInfo.downloadFile;

// test checksum
let value, algorithm, expectedHash;
Expand Down
10 changes: 5 additions & 5 deletions modules/clientBinaries/generateVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var getOSXAsset = function (data, asset, hashes) {
data.type = "dmg";
} else if (asset.name.endsWith('.tar.gz') || asset.name.endsWith('.tar')) {
data.type = "tar";
}
}
data.sha256 = getHash("osx", asset.name, hashes);
}

Expand Down Expand Up @@ -82,7 +82,7 @@ var getAssetDetails = function (asset, hashes, version) {

// add .exe extension for windows binaries
let bin = `particld${data.platform === 'win' ? '.exe' : ''}`

// return asset only if it is fully compliant
return (data.platform && data.arch && data.type ? {
platform: data.platform,
Expand Down Expand Up @@ -139,14 +139,14 @@ var getHashesForPlatform = function (platform, path, hashes) {
*/
got(`${releasesURL}`).then(response => {
const body = JSON.parse(response.body);
let releaseIndex = 0;
let releaseIndex = 1;
let release;
const skipPrerelease = !(process.argv.includes('-prerelease'))
while (body[releaseIndex].prerelease && skipPrerelease) {
releaseIndex++;
}
release = body[releaseIndex];

let tag = release.tag_name.substring(1).replace(/rc./g, "");
let binaries = [];

Expand Down Expand Up @@ -187,7 +187,7 @@ got(`${releasesURL}`).then(response => {
binaries.push(entry);
}
})

// include entries in JSON object
var platforms = json.clients.particld.platforms;
binaries.forEach(binary => {
Expand Down
Loading

0 comments on commit 1c4f2b5

Please sign in to comment.