Skip to content

Commit

Permalink
split winsign commit from tabs
Browse files Browse the repository at this point in the history
Only try and sign ComfyUI.exe

Only Sign if PUBLISH is true

Bumped the package number up incase the old one still wants to be dl'ed

Don't need this step anymore
  • Loading branch information
KenCorma committed Aug 24, 2024
1 parent bb197af commit 0932f37
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/publish_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ jobs:
with:
node-version: 20
- run: yarn install
<<<<<<< HEAD
<<<<<<< HEAD
=======
- name: Mod
shell: powershell
run: |
(Get-Content node_modules\@electron\windows-sign\dist\cjs\sign-with-signtool.js) -replace [Regex]::Escape('await execute({ ...internalOptions, hash: "sha1'), [Regex]::Escape('//await execute({ ...internalOptions, hash: "sha1') | Out-File -encoding ASCII node_modules\@electron\windows-sign\dist\cjs\sign-with-signtool.js
(Get-Content node_modules\@electron\windows-sign\dist\esm\sign-with-signtool.js) -replace [Regex]::Escape('await execute({ ...internalOptions, hash: "sha1'), [Regex]::Escape('//await execute({ ...internalOptions, hash: "sha1') | Out-File -encoding ASCII node_modules\@electron\windows-sign\dist\esm\sign-with-signtool.js
gc node_modules\@electron\windows-sign\dist\esm\sign-with-signtool.js
>>>>>>> 35d4937 (split winsign commit from tabs)
=======
>>>>>>> dae13ca (Don't need this step anymore)
- name: Set variables
id: variables
run: |
Expand Down
20 changes: 20 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,33 @@ import { FuseV1Options, FuseVersion } from '@electron/fuses';
const config: ForgeConfig = {
packagerConfig: {
asar: true,
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 8a417fa (Only Sign if PUBLISH is true)
...process.env.PUBLISH && {windowsSign: {
debug:true,
hookFunction: (filePath) => {
if (!filePath.endsWith("ComfyUI.exe")) return; // For now just ignore any file that isnt the main exe will need to change when building with installers/auto updates / a compiled python servesr
require("child_process").execSync(`signtool.exe sign /sha1 ${process.env.DIGICERT_FINGERPRINT} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${filePath}`)
},
}},
<<<<<<< HEAD
=======
windowsSign: {debug:true,
=======
windowsSign: {
debug:true,
>>>>>>> 4c6fcda (Only try and sign ComfyUI.exe)
hookFunction: (filePath) => {
if (!filePath.endsWith("ComfyUI.exe")) return; // For now just ignore any file that isnt the main exe will need to change when building with installers/auto updates / a compiled python servesr
require("child_process").execSync(`signtool.exe sign /sha1 ${process.env.DIGICERT_FINGERPRINT} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${filePath}`)
},
},
>>>>>>> 35d4937 (split winsign commit from tabs)
=======
>>>>>>> 8a417fa (Only Sign if PUBLISH is true)
osxSign: {
optionsForFile: (filepath) => {
return { entitlements: './assets/entitlements.mac.plist' };
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"name": "comfyui-electron",
"productName": "ComfyUI",
<<<<<<< HEAD
<<<<<<< HEAD
"version": "0.0.2",
=======
"version": "0.0.1",
>>>>>>> 35d4937 (split winsign commit from tabs)
=======
"version": "0.0.2",
>>>>>>> 16ea5e2 (Bumped the package number up incase the old one still wants to be dl'ed)
"description": "The best modular GUI to run AI diffusion models.",
"main": ".vite/build/main.js",
"scripts": {
Expand Down
44 changes: 44 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const launchPythonServer = async () => {
console.log('Python server is already running');
return Promise.resolve();
}
<<<<<<< HEAD

console.log('Launching Python server...');

Expand All @@ -80,7 +81,10 @@ const launchPythonServer = async () => {
stdio: 'pipe',
});
}
=======
>>>>>>> 8a417fa (Only Sign if PUBLISH is true)

<<<<<<< HEAD
pythonProcess.stdout.pipe(process.stdout);
pythonProcess.stderr.pipe(process.stderr);

Expand All @@ -99,6 +103,46 @@ const launchPythonServer = async () => {
checkServerReady();
});

=======
console.log('Launching Python server...');

return new Promise<void>((resolve, reject) => {
let executablePath: string;

if (app.isPackaged) {
//Production: use the bundled Python package
executablePath = path.join(process.resourcesPath, 'UI', packagedComfyUIExecutable);
pythonProcess = spawn(executablePath, { shell: true });
} else {
// Development: use the fake Python server
executablePath = path.join(app.getAppPath(), 'ComfyUI', 'ComfyUI.sh');
pythonProcess = spawn(executablePath, {
stdio: 'pipe',
});
}

pythonProcess.stdout.pipe(process.stdout);
pythonProcess.stderr.pipe(process.stderr);

const checkInterval = 1000; // Check every 1 second
<<<<<<< HEAD
>>>>>>> 35d4937 (split winsign commit from tabs)
=======

const checkServerReady = async () => {
const isReady = await isPortInUse(host, port);
if (isReady) {
console.log('Python server is ready');
resolve();
} else {
setTimeout(checkServerReady, checkInterval);
}
};

checkServerReady();
});

>>>>>>> 8a417fa (Only Sign if PUBLISH is true)
};


Expand Down

0 comments on commit 0932f37

Please sign in to comment.