File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
- const { ipcRenderer, remote, clipboard } = require ( 'electron' )
1
+ const { ipcRenderer, remote, clipboard, shell } = require ( 'electron' )
2
2
const { Menu } = remote
3
3
4
4
const os = remote . require ( 'os' )
@@ -35,7 +35,7 @@ window.onload = () => {
35
35
targetURL = getServerUrl ( )
36
36
}
37
37
38
- document . body . innerHTML += `<webview src="${ targetURL } " id="main-window" disablewebsecurity autosize="on" allowpopups allowfileaccessfromfiles></webview>`
38
+ document . body . innerHTML += `<webview src="${ targetURL } " id="main-window" autosize="on" allowpopups allowfileaccessfromfiles></webview>`
39
39
40
40
const webview = document . getElementById ( 'main-window' )
41
41
@@ -203,10 +203,18 @@ window.onload = () => {
203
203
204
204
$ ( '#open-from-url-modal.modal #submit-file-url' ) . click ( function ( ) {
205
205
let url = $ ( '#open-from-url-modal.modal input[type="text"]' ) . val ( )
206
- if ( url . length > 0 ) {
206
+ const serverurl = getServerUrl ( )
207
+ if ( url . length <= 0 ) {
208
+ return
209
+ }
210
+
211
+ if ( ! url . match ( serverurl ) ) {
212
+ shell . openExternal ( url )
213
+ } else {
207
214
ipcClient ( 'createWindow' , { url : `file://${ path . join ( __dirname , `index.html?target=${ url } ` ) } ` } )
208
- $ ( '#open-from-url-modal.modal' ) . modal ( 'hide' )
209
215
}
216
+
217
+ $ ( '#open-from-url-modal.modal' ) . modal ( 'hide' )
210
218
} )
211
219
212
220
/* handle _target=blank pages */
You can’t perform that action at this time.
0 commit comments