Allow api_base override

Provide a means for local development to specify the api_base to override assumption that the api is where the client is based on browser 'location'
This commit is contained in:
Andre Molnar 2023-11-29 20:10:47 -05:00
parent d19de2753e
commit f73bf1cffd
3 changed files with 15 additions and 2 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ venv/
!/web/extensions/logging.js.example
!/web/extensions/core/
/tests-ui/data/object_info.json
.vscode

View File

@ -7,6 +7,10 @@ class ComfyApi extends EventTarget {
this.api_base = location.pathname.split('/').slice(0, -1).join('/');
}
set apiBase(apiBase) {
this.api_base = apiBase;
}
apiURL(route) {
return this.api_base + route;
}

View File

@ -78,6 +78,14 @@ export class ComfyApp {
this.shiftDown = false;
}
/**
* Provide a setter for the base url of the api
* @param {string} apiBase
*/
set apiBase(apiBase) {
api.apiBase = apiBase;
}
getPreviewFormatParam() {
let preview_format = this.ui.settings.getSettingValue("Comfy.PreviewFormat");
if(preview_format)