()
| 99 | }; |
| 100 | |
| 101 | const startUpdate = () => { |
| 102 | const urls = [ |
| 103 | oaConfig.noTrack !== false ? 'https://*/api/*/science' : '', |
| 104 | oaConfig.noTrack !== false ? 'https://*/api/*/metrics' : '', |
| 105 | oaConfig.noTyping === true ? 'https://*/api/*/typing' : '' |
| 106 | ].filter(x => x); |
| 107 | |
| 108 | if (urls.length > 0) session.defaultSession.webRequest.onBeforeRequest({ urls }, (e, cb) => cb({ cancel: true })); |
| 109 | |
| 110 | const startMin = process.argv?.includes?.('--start-minimized'); |
| 111 | if (Constants.USE_NEW_UPDATER && updater.tryInitUpdater(buildInfo, Constants.NEW_UPDATE_ENDPOINT, Constants.USE_RUST_BSPATCH)) { |
| 112 | const inst = updater.getUpdater(); |
| 113 | |
| 114 | inst.on('host-updated', () => autoStart.update(() => {})); |
| 115 | inst.on('unhandled-exception', fatal); |
| 116 | inst.on('InconsistentInstallerState', fatal); |
| 117 | inst.on('update-error', console.error); |
| 118 | |
| 119 | require('./firstRun').do(); |
| 120 | } else { |
| 121 | moduleUpdater.init(Constants.UPDATE_ENDPOINT, buildInfo); |
| 122 | } |
| 123 | |
| 124 | splash.events.once('APP_SHOULD_LAUNCH', () => { |
| 125 | if (!process.env.OPENASAR_NOSTART) startCore(); |
| 126 | }); |
| 127 | |
| 128 | let done; |
| 129 | splash.events.once('APP_SHOULD_SHOW', () => { |
| 130 | if (done) return; |
| 131 | done = true; |
| 132 | |
| 133 | desktopCore.setMainWindowVisible(!startMin); |
| 134 | |
| 135 | setTimeout(() => { // Try to update our asar |
| 136 | const config = require('./config'); |
| 137 | if (oaConfig.setup !== true) config.open(); |
| 138 | |
| 139 | if (oaConfig.autoupdate !== false) { |
| 140 | try { |
| 141 | require('./asarUpdate')(); |
| 142 | } catch (e) { |
| 143 | log('AsarUpdate', e); |
| 144 | } |
| 145 | } |
| 146 | }, 3000); |
| 147 | }); |
| 148 | |
| 149 | splash.initSplash(startMin); |
| 150 | }; |
| 151 | |
| 152 | |
| 153 | module.exports = () => { |
nothing calls this directly
no test coverage detected