File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable */
2
2
// @ts -nocheck
3
3
4
- if ( typeof window [ '__flat_registered' ] === 'undefined' ) {
4
+ const webui_url = new URL ( '__WEBUI_URL' )
5
+
6
+ if ( webui_url . origin !== document . location . origin ) document . location . href = webui_url . href
7
+ else if ( typeof window [ '__flat_registered' ] === 'undefined' ) {
5
8
const { ipcRenderer } = require ( 'electron' )
6
9
window [ '__flat_registered' ] = true
7
10
gradioApp ( ) . addEventListener ( 'click' , ( e ) => {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export const createArgs = () => {
39
39
if ( typeof val === 'string' && ! val ) continue
40
40
if ( ! key . startsWith ( 'webui/args' ) ) continue
41
41
const arg = key . split ( '/' ) . slice ( - 1 ) [ 0 ]
42
- if ( arg === 'custom' ) result += val
42
+ if ( arg === 'custom' ) result += ` ${ val } `
43
43
else if ( typeof val === 'boolean' && val ) result += ` --${ arg } `
44
44
else if ( typeof val === 'string' ) result += ` --${ arg } "${ val } "` . replace ( / \\ / g, '\\\\' )
45
45
else result += ` --${ arg } ${ val } `
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export const UI: Component = () => {
96
96
}
97
97
} )
98
98
webview . addEventListener ( 'dom-ready' , ( ) => {
99
- webview . executeJavaScript ( __inject_webui )
99
+ webview . executeJavaScript ( __inject_webui . replace ( '__WEBUI_URL' , url ) )
100
100
} )
101
101
}
102
102
You can’t perform that action at this time.
0 commit comments