mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-25 04:54:08 -03:00
feat: support reverse-proxy URL subpaths (llama-swap, SwarmUI) (#1122)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Base-path helpers for code running inside the ComfyUI page.
|
||||
*
|
||||
* When ComfyUI is served under a URL subpath by a reverse proxy (e.g.
|
||||
* llama-swap serves it at "/comfyui/", SwarmUI at "/ComfyBackendDirect/"),
|
||||
* the ComfyUI SPA always sits at the root of that prefix, so the prefix is
|
||||
* the current pathname without the trailing slash — the same convention the
|
||||
* ComfyUI frontend uses for its own api_base. Proxies strip the prefix and
|
||||
* forward no headers, so the page URL is the only place to learn it.
|
||||
*/
|
||||
|
||||
export function getComfyUIBasePath() {
|
||||
const { pathname } = window.location;
|
||||
return pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
||||
}
|
||||
|
||||
export function lmUrl(path) {
|
||||
return `${getComfyUIBasePath()}${path}`;
|
||||
}
|
||||
Reference in New Issue
Block a user