-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44263ae
commit 3c28570
Showing
7 changed files
with
139 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,13 @@ | |
"format:fix": "prettier --write .", | ||
"prepare": "husky", | ||
"make": "yarn run vite:compile && electron-builder build --config=builder-debug.config.ts", | ||
"make:assets:amd": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --amd --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && mkdir -p ComfyUI/user/default", | ||
"make:assets:cpu": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --cpu --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && node ../scripts/env.mjs && mkdir -p ComfyUI/user/default", | ||
"make:assets:nvidia": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --nvidia --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && mkdir -p ComfyUI/user/default", | ||
"make:assets:macos": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --m-series --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && mkdir -p ComfyUI/user/default", | ||
"make:assets:amd": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --amd --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run clone-settings-extension", | ||
"make:assets:cpu": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --cpu --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && node ../scripts/env.mjs && yarn run clone-settings-extension", | ||
"make:assets:nvidia": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --nvidia --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run clone-settings-extension", | ||
"make:assets:macos": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --m-series --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run clone-settings-extension", | ||
"vite:compile": "vite build --config vite.renderer.config.ts && vite build --config vite.main.config.ts && vite build --config vite.preload.config.ts ", | ||
"notarize": "node debug/notarize.js", | ||
"clone-settings-extension": "git clone [email protected]:Comfy-Org/DesktopSettingsExtension.git ComfyUI/custom_nodes/DesktopSettingsExtension", | ||
"package": "yarn run vite:compile && todesktop build --code-sign=false --async", | ||
"publish": "yarn run vite:compile && todesktop build --async", | ||
"sign": "node debug/sign.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import log from 'electron-log/main'; | ||
|
||
interface ComfySettingsData { | ||
'Comfy-Desktop.AutoUpdate'?: boolean; | ||
'Comfy-Desktop.SendCrashStatistics'?: boolean; | ||
[key: string]: any; | ||
} | ||
|
||
/** | ||
* ComfySettings is a class that loads settings from the comfy.settings.json file. | ||
*/ | ||
export class ComfySettings { | ||
private filePath: string; | ||
private settings: ComfySettingsData; | ||
|
||
constructor(settingsPath: string) { | ||
this.filePath = path.join(settingsPath, 'user', 'default', 'comfy.settings.json'); | ||
this.settings = this.loadSettings(); | ||
} | ||
|
||
private loadSettings(): ComfySettingsData { | ||
if (!fs.existsSync(this.filePath)) { | ||
throw new Error(`Settings file ${this.filePath} does not exist`); | ||
} | ||
try { | ||
const fileContent = fs.readFileSync(this.filePath, 'utf-8'); | ||
return JSON.parse(fileContent); | ||
} catch (error) { | ||
log.error(`Failed to load settings from ${this.filePath}:`, error); | ||
return {}; | ||
} | ||
} | ||
|
||
get autoUpdate(): boolean { | ||
return this.settings['Comfy-Desktop.AutoUpdate'] ?? true; | ||
} | ||
|
||
get sendCrashStatistics(): boolean { | ||
return this.settings['Comfy-Desktop.SendCrashStatistics'] ?? true; | ||
} | ||
|
||
public reload(): void { | ||
this.settings = this.loadSettings(); | ||
} | ||
|
||
public getAllDesktopSettings(): Record<string, any> { | ||
return Object.entries(this.settings) | ||
.filter(([key]) => key.startsWith('Comfy-Desktop.')) | ||
.reduce( | ||
(acc, [key, value]) => { | ||
const settingName = key.replace('Comfy-Desktop.', ''); | ||
acc[settingName] = value; | ||
return acc; | ||
}, | ||
{} as Record<string, any> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters