Skip to content

Commit

Permalink
Call autoupdater. (#31)
Browse files Browse the repository at this point in the history
* Call autoupdater.

* Only call updater when app is in production.
  • Loading branch information
robinjhuang authored Sep 16, 2024
1 parent 18013f8 commit 8ae30bd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "comfyui-electron",
"productName": "ComfyUI",
"repository": "github:comfy-org/electron",
"version": "0.0.6",
"description": "The best modular GUI to run AI diffusion models.",
"main": ".vite/build/main.js",
Expand Down Expand Up @@ -72,6 +73,7 @@
"electron-squirrel-startup": "^1.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tar": "^7.4.3"
"tar": "^7.4.3",
"update-electron-app": "^3.0.0"
}
}
12 changes: 12 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IPC_CHANNELS } from './constants';
import dotenv from 'dotenv';
import { app, BrowserWindow, webContents, screen } from 'electron';
import tar from 'tar';
import { updateElectronApp, UpdateSourceType } from 'update-electron-app';

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
import('electron-squirrel-startup').then((ess) => {
Expand All @@ -17,6 +18,17 @@ import('electron-squirrel-startup').then((ess) => {
}
});

if (app.isPackaged) {
updateElectronApp({
updateInterval: '1 hour',
updateSource: {
type: UpdateSourceType.ElectronPublicUpdateService,
host: 'https://updater.comfy.org',
repo: 'comfy-org/electron',
},
});
}

let pythonProcess: ChildProcess | null = null;
const host = '127.0.0.1'; // Replace with the desired IP address
const port = 8188; // Replace with the port number your server is running on
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3802,6 +3802,7 @@ __metadata:
tar: "npm:^7.4.3"
ts-node: "npm:^10.0.0"
typescript: "npm:~5.5.4"
update-electron-app: "npm:^3.0.0"
vite: "npm:^5.0.12"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -5471,6 +5472,15 @@ __metadata:
languageName: node
linkType: hard

"github-url-to-object@npm:^4.0.4":
version: 4.0.6
resolution: "github-url-to-object@npm:4.0.6"
dependencies:
is-url: "npm:^1.1.0"
checksum: 10c0/b8ed9b2b93c55657299b7cc5ce9faf4441f143e59f995e126929d18f8fc692fc932d8530da9bde7655f35b29201beacbc17b066b7e26dbcc0dc983f8d3c918cf
languageName: node
linkType: hard

"glob-parent@npm:^5.1.2":
version: 5.1.2
resolution: "glob-parent@npm:5.1.2"
Expand Down Expand Up @@ -6233,6 +6243,13 @@ __metadata:
languageName: node
linkType: hard

"is-url@npm:^1.1.0, is-url@npm:^1.2.4":
version: 1.2.4
resolution: "is-url@npm:1.2.4"
checksum: 10c0/0157a79874f8f95fdd63540e3f38c8583c2ef572661cd0693cda80ae3e42dfe8e9a4a972ec1b827f861d9a9acf75b37f7d58a37f94a8a053259642912c252bc3
languageName: node
linkType: hard

"is-weakref@npm:^1.0.2":
version: 1.0.2
resolution: "is-weakref@npm:1.0.2"
Expand Down Expand Up @@ -9090,6 +9107,17 @@ __metadata:
languageName: node
linkType: hard

"update-electron-app@npm:^3.0.0":
version: 3.0.0
resolution: "update-electron-app@npm:3.0.0"
dependencies:
github-url-to-object: "npm:^4.0.4"
is-url: "npm:^1.2.4"
ms: "npm:^2.1.1"
checksum: 10c0/5e0b9ce8fd2cbcf6ea64d8029f90d90394facf05d86c8dceda5dba79af6e21522ef4f37f212982be781f488d497882529d9b11b91174159f6567a24039c76e6a
languageName: node
linkType: hard

"uri-js@npm:^4.2.2":
version: 4.4.1
resolution: "uri-js@npm:4.4.1"
Expand Down

0 comments on commit 8ae30bd

Please sign in to comment.