More template work & configure backend URL
This commit is contained in:
@@ -3,6 +3,12 @@ import { get, writable } from 'svelte/store';
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
export type ConfigState = {
|
||||
/** Backend domain for ComfyUI */
|
||||
comfyUIHostname: string,
|
||||
|
||||
/** Backend port for ComfyUI */
|
||||
comfyUIPort: number,
|
||||
|
||||
/** Strip user state even if saving to local storage */
|
||||
alwaysStripUserState: boolean,
|
||||
|
||||
@@ -14,18 +20,27 @@ export type ConfigState = {
|
||||
}
|
||||
|
||||
type ConfigStateOps = {
|
||||
getBackendURL: () => string
|
||||
}
|
||||
|
||||
export type WritableConfigStateStore = Writable<ConfigState> & ConfigStateOps;
|
||||
const store: Writable<ConfigState> = writable(
|
||||
{
|
||||
comfyUIHostname: "localhost",
|
||||
comfyUIPort: 8188,
|
||||
alwaysStripUserState: false,
|
||||
promptForWorkflowName: false,
|
||||
confirmWhenUnloadingUnsavedChanges: true
|
||||
})
|
||||
|
||||
function getBackendURL(): string {
|
||||
const state = get(store);
|
||||
return `${window.location.protocol}://${state.comfyUIHostname}:${state.comfyUIPort}`
|
||||
}
|
||||
|
||||
const configStateStore: WritableConfigStateStore =
|
||||
{
|
||||
...store
|
||||
...store,
|
||||
getBackendURL
|
||||
}
|
||||
export default configStateStore;
|
||||
|
||||
@@ -1005,6 +1005,9 @@ function createRaw(workflow: ComfyBoxWorkflow | null = null): WritableLayoutStat
|
||||
store.set(state)
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: Modifies the template in-place, be sure you cloned it beforehand!
|
||||
*/
|
||||
function insertTemplate(template: SerializedComfyBoxTemplate, graph: LGraph, templateNodeIDToNode: Record<NodeID, LGraphNode>, container: ContainerLayout, childIndex: number): IDragItem {
|
||||
const idMapping: Record<DragItemID, DragItemID> = {};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export type ModalState = Record<string, any>;
|
||||
export type ModalButton = {
|
||||
name: string,
|
||||
variant: "primary" | "secondary",
|
||||
onClick: (state: ModalData) => void,
|
||||
onClick: (state: ModalData) => boolean | void,
|
||||
closeOnClick?: boolean
|
||||
}
|
||||
export interface ModalData {
|
||||
|
||||
@@ -11,7 +11,7 @@ export type UIState = {
|
||||
uiEditMode: UIEditMode,
|
||||
|
||||
reconnecting: boolean,
|
||||
isSavingToLocalStorage: boolean
|
||||
forceSaveUserState: boolean | null
|
||||
}
|
||||
|
||||
type UIStateOps = {
|
||||
@@ -29,7 +29,7 @@ const store: Writable<UIState> = writable(
|
||||
uiEditMode: "widgets",
|
||||
|
||||
reconnecting: false,
|
||||
isSavingToLocalStorage: false,
|
||||
forceSaveUserState: null,
|
||||
})
|
||||
|
||||
function reconnecting() {
|
||||
|
||||
Reference in New Issue
Block a user