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');
});
}
import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import ChevronDown16 from '@carbon/icons-react/lib/chevron--down/16';
import { settings } from 'carbon-components';
const { prefix } = settings;
export const translationIds = {
'close.menu': 'close.menu',
'open.menu': 'open.menu',
};
const defaultTranslations = {
[translationIds['close.menu']]: 'Close menu',
[translationIds['open.menu']]: 'Open menu',
};
/**
* `ListBoxMenuIcon` is used to orient the icon up or down depending on the
* state of the menu for a given `ListBox`
*/
const ListBoxMenuIcon = ({ isOpen, translateWithId: t }) => {
const className = cx({
[`${prefix}--list-box__menu-icon`]: true,
[`${prefix}--list-box__menu-icon--open`]: isOpen,
});
const description = isOpen ? t('close.menu') : t('open.menu');
return (
<div role="button">
<title>{description}</title></div>