Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 50132ad

Browse files
authored
Merge pull request #88 from Microsoft/eanders-MS
Eanders ms
2 parents c0a963d + 68506a3 commit 50132ad

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

src/client/emulator.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,13 @@ export class Emulator {
111111
};
112112
request(options);
113113
}
114+
115+
public static quitAndInstall() {
116+
const settings = getSettings();
117+
let options: request.OptionsWithUrl = {
118+
url: `${this.serviceUrl}/emulator/system/quitAndInstall`,
119+
method: "POST"
120+
};
121+
request(options);
122+
}
114123
}

src/client/hyperlinkHandler.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@
3131
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3232
//
3333

34-
import { shell, remote } from 'electron';
34+
import { shell } from 'electron';
3535
import * as URL from 'url';
3636
import * as QueryString from 'querystring';
3737
import { InspectorActions, AddressBarActions } from './reducers';
3838
import { getSettings, selectedActivity$, deselectActivity } from './settings';
3939
import { Settings as ServerSettings } from '../types/serverSettingsTypes';
40+
import { Emulator } from './emulator';
4041
import * as log from './log';
4142

4243

@@ -116,9 +117,7 @@ function navigateCommandUrl(params: string[]) {
116117
return;
117118
const json = decodeURIComponent(params['args']);
118119
const args = JSON.parse(json);
119-
if (args.cmd === 'autoUpdater.quitAndInstall') {
120-
if (remote.autoUpdater) {
121-
remote.autoUpdater.quitAndInstall();
122-
}
120+
if (args === 'autoUpdater.quitAndInstall') {
121+
Emulator.quitAndInstall();
123122
}
124123
}

src/server/controllers/emulator/emulatorController.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import * as Restify from 'restify';
3535
import * as HttpStatus from "http-status-codes";
36+
import { autoUpdater } from 'electron';
3637
import { getSettings, getStore } from '../../settings';
3738
import { emulator } from '../../emulator';
3839
import { RestServer } from '../../restServer';
@@ -68,6 +69,7 @@ export class EmulatorController {
6869
server.router.post('/emulator/:conversationId/typing', this.typing);
6970
server.router.post('/emulator/:conversationId/ping', this.ping);
7071
server.router.del('/emulator/:conversationId/userdata', this.deleteUserData);
72+
server.router.post('/emulator/system/quitAndInstall', this.quitAndInstall);
7173
}
7274

7375
static getUsers = (req: Restify.Request, res: Restify.Response, next: Restify.Next): any => {
@@ -168,4 +170,16 @@ export class EmulatorController {
168170
ResponseTypes.sendErrorResponse(req, res, next, err);
169171
}
170172
}
173+
174+
static quitAndInstall = (req: Restify.Request, res: Restify.Response, next: Restify.Next): any => {
175+
try {
176+
if (autoUpdater) {
177+
autoUpdater.quitAndInstall();
178+
}
179+
res.send(HttpStatus.OK);
180+
res.end();
181+
} catch (err) {
182+
ResponseTypes.sendErrorResponse(req, res, next, err);
183+
}
184+
}
171185
}

src/server/emulator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class Emulator {
6262
// Note: We're intentionally sending and ISettings here, not a Settings. This
6363
// is why we're getting the value from getStore().getState().
6464
Electron.ipcMain.on('clientStarted', () => {
65-
// DISABLED: Use chrome's proxy settings for all outgoing requests
65+
// Use system proxy settings for outgoing requests
6666
const session = Electron.session.defaultSession;
6767
this.proxyAgent = new ElectronProxyAgent(session);
6868
http.globalAgent = this.proxyAgent;

0 commit comments

Comments
 (0)