Fix routing (#929)

* fix router and move graph related parts to GraphView.vue

* (fix) add back child element in UnloadWindowConfirmDialog

* (cleanup) remove empty callback

* (fix) routing issue when base url is not webroot

* add back DEV_SERVER_COMFYUI_URL
This commit is contained in:
ArtificialLab
2024-09-23 07:09:10 +04:00
committed by Chenlei Hu
parent 5e51ae37cf
commit 9c7ea5bd87
6 changed files with 22 additions and 12 deletions

View File

@@ -33,7 +33,6 @@ interface QueuePromptRequestBody {
class ComfyApi extends EventTarget {
#registered = new Set()
api_host: string
api_base: string
initialClientId: string
user: string
socket?: WebSocket
@@ -43,21 +42,21 @@ class ComfyApi extends EventTarget {
constructor() {
super()
this.api_host = location.host
this.api_base = location.pathname.split('/').slice(0, -1).join('/')
this.api_host = window.location.host
console.log('Running on', this.api_host)
this.initialClientId = sessionStorage.getItem('clientId')
}
internalURL(route: string): string {
return this.api_base + '/internal' + route
return '/internal' + route
}
apiURL(route: string): string {
return this.api_base + '/api' + route
return '/api' + route
}
fileURL(route: string): string {
return this.api_base + route
return route
}
fetchApi(route: string, options?: RequestInit) {
@@ -113,7 +112,7 @@ class ComfyApi extends EventTarget {
existingSession = '?clientId=' + existingSession
}
this.socket = new WebSocket(
`ws${window.location.protocol === 'https:' ? 's' : ''}://${this.api_host}${this.api_base}/ws${existingSession}`
`ws${window.location.protocol === 'https:' ? 's' : ''}://${this.api_host}/ws${existingSession}`
)
this.socket.binaryType = 'arraybuffer'