-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into enh/upload-sourcemaps-to-sentry
- Loading branch information
Showing
9 changed files
with
164 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Publish Staging Application | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-staging-todesktop: | ||
if: | | ||
github.event_name == 'workflow_dispatch' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Github checkout | ||
uses: actions/checkout@v4 | ||
- name: Build | ||
uses: ./.github/actions/build/windows/todesktop | ||
with: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
TODESKTOP_ACCESS_TOKEN: ${{secrets.TODESKTOP_ACCESS_TOKEN}} | ||
TODESKTOP_EMAIL: ${{secrets.TODESKTOP_EMAIL}} | ||
STAGING: true |
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 |
---|---|---|
|
@@ -3,15 +3,15 @@ | |
"productName": "ComfyUI", | ||
"repository": "github:comfy-org/electron", | ||
"copyright": "Copyright © 2024 Comfy Org", | ||
"version": "0.3.20-test", | ||
"version": "0.3.23-test", | ||
"homepage": "https://comfy.org", | ||
"description": "The best modular GUI to run AI diffusion models.", | ||
"main": ".vite/build/main.js", | ||
"packageManager": "[email protected]", | ||
"config": { | ||
"frontendVersion": "1.5.0", | ||
"comfyVersion": "0.3.2", | ||
"managerCommit": "ada683c6bafcb983c8366e4310b7f95f66bd6362", | ||
"managerCommit": "1ca349523787b943f6d03201d4aed1cb0bcbbafe", | ||
"uvVersion": "0.5.4" | ||
}, | ||
"scripts": { | ||
|
@@ -37,6 +37,7 @@ | |
"package": "yarn run vite:compile && todesktop build --code-sign=false --async", | ||
"prepare": "husky", | ||
"publish": "yarn run vite:compile && todesktop build --async", | ||
"publish:staging": "yarn run vite:compile && todesktop build --config=./todesktop.staging.json --async", | ||
"reset-install": "node scripts/resetInstall.js", | ||
"sign": "node debug/sign.js", | ||
"start": "node ./scripts/launchdev.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import * as path from 'path'; | ||
import * as fs from 'fs'; | ||
import * as glob from 'glob'; | ||
import { app } from 'electron'; | ||
import { VirtualEnvironment } from '../virtualEnvironment'; | ||
import { getAppResourcesPath } from '../install/resourcePaths'; | ||
import log from 'electron-log/main'; | ||
import { AppWindow } from '../main-process/appWindow'; | ||
import { IPC_CHANNELS } from '../constants'; | ||
|
||
function parseLogFile(logPath: string): Set<string> { | ||
console.log('Parsing log file:', logPath); | ||
const customNodes = new Set<string>(); | ||
const content = fs.readFileSync(logPath, 'utf-8'); | ||
|
||
const lines = content.split('\n'); | ||
for (let i = 0; i < lines.length; i++) { | ||
const line = lines[i].trim(); | ||
// Match the exact format from Python's "{:6.1f} seconds" | ||
const timeMatch = line.match(/\s*\d+\.\d+\s+seconds/); | ||
if (timeMatch) { | ||
log.info(line); | ||
// Second pattern: extract custom node name from path | ||
const customNodeMatch = line.match(/custom_nodes[/\\]([^/\\]+)/); | ||
if (customNodeMatch) { | ||
log.info('Node match found:', customNodeMatch[1]); | ||
const nodeName = customNodeMatch[1]; | ||
if (nodeName !== 'ComfyUI-Manager' && nodeName !== 'websocket_image_save.py') { | ||
customNodes.add(nodeName); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return customNodes; | ||
} | ||
|
||
function getSortedLogFiles(): string[] { | ||
try { | ||
const logsDir = app.getPath('logs'); | ||
const logFiles = glob.sync(path.join(logsDir, 'comfyui*.log')); | ||
|
||
// Sort files by modification time, newest first | ||
return logFiles.sort((a, b) => { | ||
return fs.statSync(b).mtime.getTime() - fs.statSync(a).mtime.getTime(); | ||
}); | ||
} catch (error) { | ||
console.error('Failed to get logs directory:', error); | ||
return []; | ||
} | ||
} | ||
|
||
async function installCustomNodes( | ||
nodes: string[], | ||
virtualEnvironment: VirtualEnvironment, | ||
appWindow: AppWindow | ||
): Promise<void> { | ||
if (nodes.length === 0) { | ||
return; | ||
} | ||
const cmCliPath = path.join(getAppResourcesPath(), 'ComfyUI', 'custom_nodes', 'ComfyUI-Manager', 'cm-cli.py'); | ||
appWindow.send(IPC_CHANNELS.LOG_MESSAGE, `Reinstalling ${nodes.length} custom nodes...\n`); | ||
for (let i = 0; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
appWindow.send(IPC_CHANNELS.LOG_MESSAGE, `Installing custom node (${i + 1}/${nodes.length}): ${node}\n`); | ||
const cmd = [ | ||
cmCliPath, | ||
'install', | ||
node, | ||
'--install-path', | ||
path.join(virtualEnvironment.venvRootPath, 'custom_nodes'), | ||
'--no-deps', | ||
]; | ||
const { exitCode } = await virtualEnvironment.runPythonCommandAsync(cmd, { | ||
onStdout: (data) => { | ||
log.info(data.toString()); | ||
}, | ||
onStderr: (data) => { | ||
log.error(data.toString()); | ||
}, | ||
}); | ||
if (exitCode !== 0) { | ||
log.error(`Failed to install custom nodes: ${exitCode}`); | ||
} | ||
log.info(`Successfully installed custom node: ${node}`); | ||
} | ||
} | ||
|
||
export async function restoreCustomNodes(virtualEnvironment: VirtualEnvironment, appWindow: AppWindow): Promise<void> { | ||
const logFiles = getSortedLogFiles(); | ||
if (logFiles.length === 0) { | ||
return; | ||
} | ||
|
||
const customNodes = new Set<string>(); | ||
for (const logFile of logFiles) { | ||
const nodes = parseLogFile(logFile); | ||
nodes.forEach((node) => customNodes.add(node)); | ||
} | ||
|
||
log.info('Found custom nodes:', customNodes); | ||
await installCustomNodes(Array.from(customNodes), virtualEnvironment, appWindow); | ||
} |
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,10 @@ | ||
{ | ||
"extends": "./todesktop.json", | ||
"id": "241130tqe9q3y", | ||
"appId": "comfyuidesktop.staging.app", | ||
"icon": "./assets/UI/Comfy_Logo_x128.png", | ||
"packageJson": { | ||
"name": "comfyui-desktop-staging", | ||
"productName": "ComfyUI (Staging)" | ||
} | ||
} |