Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_unsubscribeViaBrowser(url, callback) {
if ((!this.isForwarded && !this.settings.confirmForBrowser) ||
userConfirm(this.confirmText, `A browser will be opened at: ${shortenURL(url)}`)) {
logIfDebug(`Opening a browser window to:\n${url}`);
if (this.settings.defaultBrowser === "native" || electronCantOpen(url)) {
open(url);
callback(null, /* unsubscribed=*/true);
} else {
const browserWindow = new remote.BrowserWindow({
'web-preferences': { 'web-security': false, 'nodeIntegration': false },
'width': 1000,
'height': 800,
'center': true,
"alwaysOnTop": true,
});
browserWindow.on('closed', () => {
callback(null, /* unsubscribed=*/true);
});
browserWindow.webContents.on('did-fail-load', (event, errorCode, errorDescription) => {
// Unable to load this URL in a browser window. Redirect to a native browser.
logIfDebug(`Failed to open URL in browser window: ${errorCode} ${errorDescription}`);
browserWindow.destroy();
.forEach(pathname => open(pathname));
}
const http = devCommonProxy.listen(PORT, () => {
resolve();
const serverUrl = `http://127.0.0.1:${PORT}`;
console.log(chalk.bgGreen.bold(`Development server started at ${serverUrl}`));
open(serverUrl);
});
http.on('error', reject);
private openInBrowser(event: GoLiveEvent) {
const host = '127.0.0.1';
const port = event.LSPP.port;
const pathname = this.getPathname();
const protocol = 'http:';
const browserName = extensionConfig.browser.get();
if (!browserName) return;
const openParams: string[] = [];
if (browserName !== 'default') {
openParams.push(getNormalizedBrowserName(browserName));
}
open(`${protocol}//${host}:${port}${pathname}`, { app: openParams });
}
server.listen(port, config.host, () => {
const addr = `http://${config.host}:${port}/`
logger.success(`Server running at ${addr}`)
if (config.open) open(addr)
})
}
this.props.actions.confirmOnlineAction(() => {
open('https://git.door43.org/user/sign_up');
});
}