Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (startsWith(url, 'http') || startsWith(url, 'mailto')) {
event.preventDefault()
shell.openExternal(url)
nucleus.track('EXTERNAL_LINK', { href: url })
return
}
logger.debug('Opening new window.', {
event,
url,
})
})
})
// allow save image option
contextMenu({
showSaveImageAs: true,
})
// system stats.
await system.setup()
// user settings.
await settings.initialSetup()
await settings.setup()
// analytics & app settings.
await nucleus.setup()
// services
await Promise.all([
rollbar.setup(), // bug tracking.
function startUp() {
log.info('Starting App')
process.on('uncaughtException', error => log.error('Uncaught: ', { error }))
mainWindow = createUi()
rendererLogger = createRendererLogger()
mainWindow.once('closed', () => (mainWindow = null))
if (config.devtools) installDevtools()
contextMenu({ showInspectElement: config.devtools })
initializeMenu()
// wire modules to UI dispatches
const dispatch = action => {
log.silly('Sending action via IPC to renderer', { action })
mainWindow.webContents.send('dispatch', action)
}
const actionHandlers = [
registerConfig(dispatch),
registerDiscovery(dispatch),
registerRobotLogs(dispatch, mainWindow),
registerUpdate(dispatch),
registerBuildrootUpdate(dispatch),
registerLabware(dispatch, mainWindow),
]
_handleSetWebviewRef (n) {
this._webview = n;
if (n) {
contextMenu({window: this._webview});
}
}
_handleDOMReady() {
if (!this._webview) {
return;
}
this._webview.removeEventListener('dom-ready', this._handleDOMReady);
contextMenu({ window: this._webview });
this._setBody();
}
export async function attachContextMenu(window: BrowserWindow) {
contexMenu({
window,
showInspectElement: true,
showSaveImageAs: true,
prepend: (params, browserWindow): MenuItem[] => [new MenuItem({
label: 'Rainbow',
enabled: true,
visible: params.mediaType === 'image',
click() {
log.warn("The Rainbow warns you!");
},
})],
});
}
function createContextMenuInternal() {
contextMenuInternal.default({
showInspectElement: false
});
}