-
Notifications
You must be signed in to change notification settings - Fork 66
Added loadURL and setProxy functionality
#41
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
|
|
||
| // @ts-check | ||
| 'use strict' | ||
|
|
||
|
|
@@ -267,6 +268,11 @@ function onReady () { | |
| case consts.eventNames.windowCmdShow: | ||
| elements[json.targetID].show() | ||
| break; | ||
| case consts.eventNames.windowCmdLoadUrl: | ||
| elements[json.targetID].loadURL(json.url, {}).then(() => { | ||
| client.write(json.targetID, consts.eventNames.windowEventLoadedUrl); | ||
| }); | ||
| break; | ||
| case consts.eventNames.windowCmdWebContentsCloseDevTools: | ||
| elements[json.targetID].webContents.closeDevTools() | ||
| break; | ||
|
|
@@ -277,11 +283,17 @@ function onReady () { | |
| elements[json.targetID].unmaximize() | ||
| break; | ||
| case consts.eventNames.windowCmdUpdateCustomOptions: | ||
| windowOptions[json.targetID] = json.windowOptions | ||
| client.write(json.targetID, consts.eventNames.windowEventUpdatedCustomOptions, json.windowOptions) | ||
| client.write(json.targetID, consts.eventNames.windowEventUpdatedCustomOptions, json.windowOptions); | ||
| break; | ||
| case consts.eventNames.windowCmdWebContentsExecuteJavascript: | ||
| elements[json.targetID].webContents.executeJavaScript(json.code).then(() => client.write(json.targetID, consts.eventNames.windowEventWebContentsExecutedJavaScript)); | ||
| elements[json.targetID].webContents.executeJavaScript(json.code) | ||
| .then(() => client.write(json.targetID, consts.eventNames.windowEventWebContentsExecutedJavaScript)); | ||
| break; | ||
| case consts.eventNames.windowCmdWebContentsSetProxy: | ||
| elements[json.targetID].webContents.session.clearAuthCache().then(() => { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really like the fact of clearing the Session Auth Cache here. It should be split into 2 different events, one for clearing the auth cache and another one to set the proxy.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree since when you re-set the proxy you don't want it to try use the same credentials (for instance, when using a rotating proxy IP), the behaviour in Electron is what is strange.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thing is, it makes sense in your case, but not in others. Clearing auth cache shouldn't be binded to setting the proxy simply to allow developers to do one without the other. |
||
| elements[json.targetID].webContents.session.setProxy(json.proxy) | ||
| .then(() => client.write(json.targetID, consts.eventNames.windowEventWebContentsSetProxy)); | ||
| }); | ||
| break; | ||
| } | ||
| }); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.