mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 23:39:45 +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:
@@ -85,29 +85,19 @@ class ManageTemplates extends ComfyDialog {
|
||||
|
||||
async load() {
|
||||
let templates = []
|
||||
if (app.isNewUserSession) {
|
||||
// New user so migrate existing templates
|
||||
const json = localStorage.getItem(id)
|
||||
if (json) {
|
||||
templates = JSON.parse(json)
|
||||
}
|
||||
await api.storeUserData(file, json, { stringify: false })
|
||||
} else {
|
||||
const res = await api.getUserData(file)
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
templates = await res.json()
|
||||
} catch (error) {}
|
||||
} else if (res.status !== 404) {
|
||||
console.error(res.status + ' ' + res.statusText)
|
||||
}
|
||||
const res = await api.getUserData(file)
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
templates = await res.json()
|
||||
} catch (error) {}
|
||||
} else if (res.status !== 404) {
|
||||
console.error(res.status + ' ' + res.statusText)
|
||||
}
|
||||
return templates ?? []
|
||||
}
|
||||
|
||||
async store() {
|
||||
const templates = JSON.stringify(this.templates, undefined, 4)
|
||||
localStorage.setItem(id, templates) // Backwards compatibility
|
||||
try {
|
||||
await api.storeUserData(file, templates, { stringify: false })
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user