mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-22 06:07:00 +08:00
make editor work
This commit is contained in:
parent
011b11d8d7
commit
1be2210d46
@ -11,7 +11,8 @@
|
|||||||
<script type="text/javascript" src="./lib/litegraph.core.js"></script>
|
<script type="text/javascript" src="./lib/litegraph.core.js"></script>
|
||||||
<script type="text/javascript" src="./lib/litegraph.extensions.js" defer></script>
|
<script type="text/javascript" src="./lib/litegraph.extensions.js" defer></script>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { app } from "./scripts/app.js";
|
import { app, loadModuleBasedOnPath } from "./scripts/app.js";
|
||||||
|
await loadModuleBasedOnPath();
|
||||||
await app.setup();
|
await app.setup();
|
||||||
window.app = app;
|
window.app = app;
|
||||||
window.graph = app.graph;
|
window.graph = app.graph;
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import {serverNodeDefs} from "../../serverNodeDefs.js";
|
||||||
|
|
||||||
class ComfyApi extends EventTarget {
|
class ComfyApi extends EventTarget {
|
||||||
#registered = new Set();
|
#registered = new Set();
|
||||||
|
|
||||||
@ -168,8 +170,33 @@ class ComfyApi extends EventTarget {
|
|||||||
* @returns An array of script urls to import
|
* @returns An array of script urls to import
|
||||||
*/
|
*/
|
||||||
async getExtensions() {
|
async getExtensions() {
|
||||||
const resp = await this.fetchApi("/extensions", { cache: "no-store" });
|
const COMFYUI_CORE_EXTENSIONS = [
|
||||||
return await resp.json();
|
// "/extensions/core/clipspace.js",
|
||||||
|
"/extensions/core/colorPalette.js",
|
||||||
|
// "/extensions/core/contextMenuFilter.js",
|
||||||
|
// "/extensions/core/dynamicPrompts.js",
|
||||||
|
// "/extensions/core/editAttention.js",
|
||||||
|
"/extensions/core/groupNode.js",
|
||||||
|
"/extensions/core/groupNodeManage.js",
|
||||||
|
"/extensions/core/groupOptions.js",
|
||||||
|
// "/extensions/core/invertMenuScrolling.js",
|
||||||
|
// "/extensions/core/keybinds.js",
|
||||||
|
// "/extensions/core/linkRenderMode.js",
|
||||||
|
"/extensions/core/maskeditor.js",
|
||||||
|
// "/extensions/core/nodeTemplates.js",
|
||||||
|
"/extensions/core/noteNode.js",
|
||||||
|
"/extensions/core/rerouteNode.js",
|
||||||
|
"/extensions/core/saveImageExtraOutput.js",
|
||||||
|
"/extensions/core/slotDefaults.js",
|
||||||
|
"/extensions/core/snapToGrid.js",
|
||||||
|
// "/extensions/core/undoRedo.js",
|
||||||
|
"/extensions/core/uploadImage.js",
|
||||||
|
"/extensions/core/widgetInputs.js",
|
||||||
|
"/extensions/dp.js",
|
||||||
|
]
|
||||||
|
// const resp = await this.fetchApi("/extensions", { cache: "no-store" });
|
||||||
|
// return await resp.json();
|
||||||
|
return COMFYUI_CORE_EXTENSIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,8 +213,9 @@ class ComfyApi extends EventTarget {
|
|||||||
* @returns The node definitions
|
* @returns The node definitions
|
||||||
*/
|
*/
|
||||||
async getNodeDefs() {
|
async getNodeDefs() {
|
||||||
const resp = await this.fetchApi("/object_info", { cache: "no-store" });
|
// const resp = await this.fetchApi("/object_info", { cache: "no-store" });
|
||||||
return await resp.json();
|
return serverNodeDefs;
|
||||||
|
// return await resp.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,6 +358,7 @@ class ComfyApi extends EventTarget {
|
|||||||
* @returns { Promise<{ storage: "server" | "browser", users?: Promise<string, unknown>, migrated?: boolean }> }
|
* @returns { Promise<{ storage: "server" | "browser", users?: Promise<string, unknown>, migrated?: boolean }> }
|
||||||
*/
|
*/
|
||||||
async getUserConfig() {
|
async getUserConfig() {
|
||||||
|
return { storage: "browser", users: Promise.resolve({}), migrated: false };
|
||||||
return (await this.fetchApi("/users")).json();
|
return (await this.fetchApi("/users")).json();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,6 +368,7 @@ class ComfyApi extends EventTarget {
|
|||||||
* @returns The fetch response
|
* @returns The fetch response
|
||||||
*/
|
*/
|
||||||
createUser(username) {
|
createUser(username) {
|
||||||
|
return { status: 200, json: async () => ({}) };
|
||||||
return this.fetchApi("/users", {
|
return this.fetchApi("/users", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -353,6 +383,7 @@ class ComfyApi extends EventTarget {
|
|||||||
* @returns { Promise<string, unknown> } A dictionary of id -> value
|
* @returns { Promise<string, unknown> } A dictionary of id -> value
|
||||||
*/
|
*/
|
||||||
async getSettings() {
|
async getSettings() {
|
||||||
|
return {};
|
||||||
return (await this.fetchApi("/settings")).json();
|
return (await this.fetchApi("/settings")).json();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,6 +393,7 @@ class ComfyApi extends EventTarget {
|
|||||||
* @returns { Promise<unknown> } The setting value
|
* @returns { Promise<unknown> } The setting value
|
||||||
*/
|
*/
|
||||||
async getSetting(id) {
|
async getSetting(id) {
|
||||||
|
return null;
|
||||||
return (await this.fetchApi(`/settings/${encodeURIComponent(id)}`)).json();
|
return (await this.fetchApi(`/settings/${encodeURIComponent(id)}`)).json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2456,4 +2456,22 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const app = new ComfyApp();
|
|
||||||
|
export async function loadModuleBasedOnPath() {
|
||||||
|
console.log('Loading module based on path');
|
||||||
|
const queryParams = new URLSearchParams(window.location.search);
|
||||||
|
const workflowVersionID = queryParams.get('workflowVersionID');
|
||||||
|
const packageID = queryParams.get('packageID');
|
||||||
|
if(workflowVersionID !== null) {
|
||||||
|
const {ComfyViewWorkflowApp} = await import("./comfyspace_viewWorkflowApp.js");
|
||||||
|
app = new ComfyViewWorkflowApp();
|
||||||
|
} else if(packageID !=null) {
|
||||||
|
const {ComfyViewNodePackageApp} = await import("./comfyspace_viewNodePackageApp.js");
|
||||||
|
app = new ComfyViewNodePackageApp();
|
||||||
|
} else {
|
||||||
|
// For any other path, import app.js and perform setup
|
||||||
|
app = new ComfyApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export let app = null;
|
||||||
|
|||||||
2419
web/scripts/comfyspace_viewWorkflowApp.js
Normal file
2419
web/scripts/comfyspace_viewWorkflowApp.js
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user