Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
msg.exitcode = 0;
// Send message back to controller.
cmdport.send(args.topic, msg);
return;
}
}
var nextcmd = msgProcessor.process(msg, args.topic);
if (nextcmd == null) {
//client.end();
// setTimeout(function() {
// process.exit();
// }, 1000);
return;
}
var setenvPromise = Q.resolve();
if(nextcmd.setenv) {
for (var target in nextcmd.env) {
var newenv = nextcmd.env[target];
var envmsg = {
command: "setenv",
logdir: nextcmd.env[target]["logdir"],
}
if( typeof newenv["$path"] != 'undefined'){
envmsg.path = newenv["$path"];
delete newenv["$path"];
}
envmsg.env = newenv;
setenvPromise = sendCommand(nextcmd.env[target][target], envmsg);
}
}
var clientTopic = nextcmd.target;
function namespace(uri, httpd, resources){
var iri = new (require('iri').IRI)(uri);
var pathParts = (iri.path() || '').split('/');
if(pathParts[1]==='about:setup'){
var base = iri.resolveReference('/about:setup/').toString();
return require('q').resolve({
// the base is... whatever the page was requested with
base: base,
// But the 'permalink' to the namespace is http://localhost/about:setup/
resource: 'http://localhost/about:setup/'+iri.toString().substring(base.length),
label: 'Setup',
option: {
'http://magnode.org/Setup': setupOpts,
useTransformTypes: ['http://magnode.org/view/Setup'],
}
});
}
}
module.exports.check_os = function () {
// Build OSX apps available for OSX platform only, so we reject on others platforms
return process.platform === 'darwin' ?
Q.resolve(process.platform) :
Q.reject('Cordova tooling for OSX requires Apple OS X');
};
}
this._debug('received msg')
var timestamp = hrtime()
// this thing repeats work all over the place
var chainedObj
var promiseValid
var valid = utils.validateMsg(msg)
if (valid) {
// if (msg.txType === TxData.types.public) {
// return this._receivePublicMsg(msg, senderInfo)
// }
promiseValid = Q.resolve()
} else {
promiseValid = Q.reject(new Error('received invalid msg'))
}
var from
return this._receivingPromise = promiseValid
.then(function () {
return self.lookupIdentity(senderInfo)
})
.then(function (result) {
from = result
var fromKey = utils.firstKey(result.identity.pubkeys, {
type: 'bitcoin',
networkName: self.networkName,
purpose: 'messaging'
})
scrollBaseToVisibility(base) {
var distanceToVisibleCanvas = this.distanceToVisibleCanvas(base);
if (distanceToVisibleCanvas !== 0) {
return this.scrollTo(this.layoutHelpers.yOffset + distanceToVisibleCanvas);
} else {
return Q.resolve();
}
}
.then(() => {
if (repo) {
return Q.resolve(repo);
}
return Q.reject(
new Error('Failed to get repo URL from options or current directory.')
);
})
.fail(err => {
.catch(err => err.code !== 'ENOENT' ? reject(err) : resolve(null))
.then(() => Promise((c, e) => {
var parse = function(body) {
try {
return Q.resolve(qs.parse(body));
}
catch (e) {
return Q.reject({code: 400, message: 'Unable to parse body.'});
}
};