Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.liveReloadServer.server) {
this.liveReloadServer.close();
} else {
this.liveReloadServer.watcher.close();
}
this.liveReloadServer = null;
});
}
if (this.ngrokServer) {
await this.tryCatch(() => {
this.ngrokServer.close();
this.ngrokServer = null;
});
}
await this.tryCatch(ngrok.kill());
// only log this if we started properly
if (this.ready) {
console.log(`Done`);
}
this.ready = false;
}
LocalWebhook.expressServer = app.listen(expressPort, function() {
debug("express started on http://localhost:" + expressPort);
});
LocalWebhook.service = serverOptions.service;
switch (LocalWebhook.service) {
case "ngrok":
// Start ngrok.
var ngrok = require("ngrok");
var ngrokPort = expressPort;
var ngrokRegion = serverOptions.region || "us";
var ngrokSubdomain = serverOptions.subdomain || undefined;
var ngrokAuthToken = serverOptions.authtoken || undefined;
ngrok.kill().then(function() {
ngrok
.connect({
addr: ngrokPort,
region: ngrokRegion,
subdomain: ngrokSubdomain,
authtoken: ngrokAuthToken,
bind_tls: true,
})
.then(function(ngrokUrl) {
LocalWebhook.publicUrl = ngrokUrl;
debug("ngrok started on " + LocalWebhook.publicUrl);
resolve();
}, reject);
});
break;
console.log('annotating jobs result')
for (let result of results) {
await sauceLabs.annotateJob(result.job_id, buildId, result.result.failed === 0)
}
console.log(chalk`{green done}`)
} catch (error) {
console.log(chalk` {red Reaceived error}`)
console.log(error)
exitCode = 1
}
/**
* Cleanup
*/
ngrok.kill()
server.close()
process.exit(exitCode)
}
static exit() {
let pc = global._PackagerController;
if (pc) {
if (pc._expressServer) {
pc._expressServer.close();
}
if (pc._packager) {
pc._packager.kill('SIGTERM');
}
if (pc._ngrokUrl || pc._packagerNgrokUrl) {
ngrok.kill();
}
}
}
stop() {
if (this.isStarted()) ngrok.kill();
}
}
this.props.setURL(url);
log.info(url);
this.props.setWorldPublic(true);
this.setState({
msg: 'You are now sharing with the world!',
lastClient: '',
logs: {
top: '2.3em',
borderBottom: '2px solid #186926'
}
});
});
} else if (this.props.serverStatus === 'RUNNING' && this.props.worldPublic) {
this.props.setURL(`http://${this.props.ip}:${this.props.port}`);
ngrok.disconnect();
ngrok.kill();
this.props.setWorldPublic(false);
this.setState({
msg: 'Just sharing locally!',
lastClient: '',
logs: {
top: '2.3em',
borderBottom: '2px solid #186926'
}
});
} else {
this.setState({
msg: 'Click Start and then share with the world',
lastClient: '',
logs: {
top: '2.3em',
borderBottom: '2px solid #691850'