More template work & configure backend URL

This commit is contained in:
space-nuko
2023-05-24 23:21:06 -05:00
parent 4ae4e71616
commit 0fedef30c0
17 changed files with 764 additions and 623 deletions

View File

@@ -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;