mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-09-14 21:45:06 +00:00
Merge branch 'use-relative-paths' of https://github.com/mcmonkey4eva/ComfyUI
This commit is contained in:
@@ -16,7 +16,7 @@ class ComfyApi extends EventTarget {
|
||||
#pollQueue() {
|
||||
setInterval(async () => {
|
||||
try {
|
||||
const resp = await fetch("/prompt");
|
||||
const resp = await fetch("./prompt");
|
||||
const status = await resp.json();
|
||||
this.dispatchEvent(new CustomEvent("status", { detail: status }));
|
||||
} catch (error) {
|
||||
@@ -40,7 +40,7 @@ class ComfyApi extends EventTarget {
|
||||
existingSession = "?clientId=" + existingSession;
|
||||
}
|
||||
this.socket = new WebSocket(
|
||||
`ws${window.location.protocol === "https:" ? "s" : ""}://${location.host}/ws${existingSession}`
|
||||
`ws${window.location.protocol === "https:" ? "s" : ""}://${location.host}${location.pathname}ws${existingSession}`
|
||||
);
|
||||
this.socket.binaryType = "arraybuffer";
|
||||
|
||||
@@ -149,7 +149,7 @@ class ComfyApi extends EventTarget {
|
||||
* @returns An array of script urls to import
|
||||
*/
|
||||
async getExtensions() {
|
||||
const resp = await fetch("/extensions", { cache: "no-store" });
|
||||
const resp = await fetch("./extensions", { cache: "no-store" });
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class ComfyApi extends EventTarget {
|
||||
* @returns An array of script urls to import
|
||||
*/
|
||||
async getEmbeddings() {
|
||||
const resp = await fetch("/embeddings", { cache: "no-store" });
|
||||
const resp = await fetch("./embeddings", { cache: "no-store" });
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ class ComfyApi extends EventTarget {
|
||||
* @returns The node definitions
|
||||
*/
|
||||
async getNodeDefs() {
|
||||
const resp = await fetch("object_info", { cache: "no-store" });
|
||||
const resp = await fetch("./object_info", { cache: "no-store" });
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class ComfyApi extends EventTarget {
|
||||
body.number = number;
|
||||
}
|
||||
|
||||
const res = await fetch("/prompt", {
|
||||
const res = await fetch("./prompt", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -224,7 +224,7 @@ class ComfyApi extends EventTarget {
|
||||
*/
|
||||
async getQueue() {
|
||||
try {
|
||||
const res = await fetch("/queue");
|
||||
const res = await fetch("./queue");
|
||||
const data = await res.json();
|
||||
return {
|
||||
// Running action uses a different endpoint for cancelling
|
||||
@@ -246,7 +246,7 @@ class ComfyApi extends EventTarget {
|
||||
*/
|
||||
async getHistory() {
|
||||
try {
|
||||
const res = await fetch("/history");
|
||||
const res = await fetch("./history");
|
||||
return { History: Object.values(await res.json()) };
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -261,7 +261,7 @@ class ComfyApi extends EventTarget {
|
||||
*/
|
||||
async #postItem(type, body) {
|
||||
try {
|
||||
await fetch("/" + type, {
|
||||
await fetch("./" + type, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@@ -404,7 +404,7 @@ export class ComfyApp {
|
||||
this.images = output.images;
|
||||
imagesChanged = true;
|
||||
imgURLs = imgURLs.concat(output.images.map(params => {
|
||||
return "/view?" + new URLSearchParams(params).toString() + app.getPreviewFormatParam();
|
||||
return "./view?" + new URLSearchParams(params).toString() + app.getPreviewFormatParam();
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -1005,7 +1005,7 @@ export class ComfyApp {
|
||||
const extensions = await api.getExtensions();
|
||||
for (const ext of extensions) {
|
||||
try {
|
||||
await import(ext);
|
||||
await import(".." + ext);
|
||||
} catch (error) {
|
||||
console.error("Error loading extension", ext, error);
|
||||
}
|
||||
|
@@ -305,7 +305,7 @@ export const ComfyWidgets = {
|
||||
subfolder = name.substring(0, folder_separator);
|
||||
name = name.substring(folder_separator + 1);
|
||||
}
|
||||
img.src = `/view?filename=${name}&type=input&subfolder=${subfolder}${app.getPreviewFormatParam()}`;
|
||||
img.src = `./view?filename=${name}&type=input&subfolder=${subfolder}${app.getPreviewFormatParam()}`;
|
||||
node.setSizeForImage?.();
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ export const ComfyWidgets = {
|
||||
// Wrap file in formdata so it includes filename
|
||||
const body = new FormData();
|
||||
body.append("image", file);
|
||||
const resp = await fetch("/upload/image", {
|
||||
const resp = await fetch("./upload/image", {
|
||||
method: "POST",
|
||||
body,
|
||||
});
|
||||
|
Reference in New Issue
Block a user