mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 06:44:32 +00:00
Remove migration logic (settings & templates storage location) (#1732)
* Remove isNewUserSession handling * Remove writing of setting and templates to localStorage
This commit is contained in:
@@ -142,7 +142,6 @@ export class ComfyApp {
|
||||
lastExecutionError: { node_id: number } | null
|
||||
progress: { value: number; max: number } | null
|
||||
configuringGraph: boolean
|
||||
isNewUserSession: boolean
|
||||
ctx: CanvasRenderingContext2D
|
||||
bodyTop: HTMLElement
|
||||
bodyLeft: HTMLElement
|
||||
@@ -186,6 +185,13 @@ export class ComfyApp {
|
||||
return 'server'
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated storage migration is no longer needed.
|
||||
*/
|
||||
get isNewUserSession() {
|
||||
return false
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.vueAppReady = false
|
||||
this.ui = new ComfyUI(this)
|
||||
@@ -1707,11 +1713,8 @@ export class ComfyApp {
|
||||
|
||||
async #setUser() {
|
||||
const userConfig = await api.getUserConfig()
|
||||
if (typeof userConfig.migrated == 'boolean') {
|
||||
// Single user mode migrated true/false for if the default user is created
|
||||
if (!userConfig.migrated) {
|
||||
this.isNewUserSession = true
|
||||
}
|
||||
// Return in single user mode.
|
||||
if (userConfig.users === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1725,18 +1728,15 @@ export class ComfyApp {
|
||||
const { UserSelectionScreen } = await import('./ui/userSelection')
|
||||
|
||||
this.ui.menuContainer.style.display = 'none'
|
||||
const { userId, username, created } =
|
||||
await new UserSelectionScreen().show(users, user)
|
||||
const { userId, username } = await new UserSelectionScreen().show(
|
||||
users,
|
||||
user
|
||||
)
|
||||
this.ui.menuContainer.style.display = ''
|
||||
|
||||
user = userId
|
||||
localStorage['Comfy.userName'] = username
|
||||
localStorage['Comfy.userId'] = user
|
||||
|
||||
if (created) {
|
||||
api.user = user
|
||||
this.isNewUserSession = true
|
||||
}
|
||||
}
|
||||
|
||||
api.user = user
|
||||
|
||||
@@ -89,9 +89,6 @@ export class ComfySettingsDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
) {
|
||||
value = this.tryMigrateDeprecatedValue(id, value)
|
||||
|
||||
const json = JSON.stringify(value)
|
||||
localStorage['Comfy.Settings.' + id] = json // backwards compatibility for extensions keep setting in storage
|
||||
|
||||
let oldValue = this.getSettingValue(id, undefined)
|
||||
this.settingsValues[id] = value
|
||||
|
||||
@@ -142,20 +139,7 @@ export class ComfySettingsDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
throw new Error(`Setting ${id} of type ${type} must have a unique ID.`)
|
||||
}
|
||||
|
||||
let value = this.getSettingValue(id)
|
||||
if (value == null) {
|
||||
if (this.app.isNewUserSession) {
|
||||
// Check if we have a localStorage value but not a setting value and we are a new user
|
||||
const localValue = localStorage['Comfy.Settings.' + id]
|
||||
if (localValue) {
|
||||
value = JSON.parse(localValue)
|
||||
this.setSettingValue(id, value) // Store on the server
|
||||
}
|
||||
}
|
||||
if (value == null) {
|
||||
value = defaultValue
|
||||
}
|
||||
}
|
||||
const value = this.getSettingValue(id) ?? defaultValue
|
||||
|
||||
// Trigger initial setting of value
|
||||
onChange?.(value, undefined)
|
||||
|
||||
Reference in New Issue
Block a user