Skip to content

Commit e37e086

Browse files
committed
reload on error
1 parent 802f97e commit e37e086

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/scripts/webui/__inject_webui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/* eslint-disable */
22
// @ts-nocheck
33

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') {
58
const { ipcRenderer } = require('electron')
69
window['__flat_registered'] = true
710
gradioApp().addEventListener('click', (e) => {

src/web/pages/webui/launcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const createArgs = () => {
3939
if (typeof val === 'string' && !val) continue
4040
if (!key.startsWith('webui/args')) continue
4141
const arg = key.split('/').slice(-1)[0]
42-
if (arg === 'custom') result += val
42+
if (arg === 'custom') result += ` ${val}`
4343
else if (typeof val === 'boolean' && val) result += ` --${arg}`
4444
else if (typeof val === 'string') result += ` --${arg} "${val}"`.replace(/\\/g, '\\\\')
4545
else result += ` --${arg} ${val}`

src/web/pages/webui/ui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const UI: Component = () => {
9696
}
9797
})
9898
webview.addEventListener('dom-ready', () => {
99-
webview.executeJavaScript(__inject_webui)
99+
webview.executeJavaScript(__inject_webui.replace('__WEBUI_URL', url))
100100
})
101101
}
102102

0 commit comments

Comments
 (0)