-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feat/automatic update installation #5345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c92720a
1ff4842
ddccbb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,29 +123,6 @@ export default function UpdateSection() { | |
| } | ||
| }; | ||
|
|
||
| const downloadAndInstallUpdate = async () => { | ||
| setUpdateStatus('downloading'); | ||
| setProgress(0); | ||
|
|
||
| try { | ||
| const result = await window.electron.downloadUpdate(); | ||
|
|
||
| if (!result.success) { | ||
| throw new Error(result.error || 'Failed to download update'); | ||
| } | ||
|
|
||
| // The download progress and completion will be handled by updater events | ||
| } catch (error) { | ||
| console.error('Error downloading update:', error); | ||
| setUpdateInfo((prev) => ({ | ||
| ...prev, | ||
| error: error instanceof Error ? error.message : 'Failed to download update', | ||
| })); | ||
| setUpdateStatus('error'); | ||
| setTimeout(() => setUpdateStatus('idle'), 5000); | ||
| } | ||
| }; | ||
|
|
||
| const installUpdate = () => { | ||
| window.electron.installUpdate(); | ||
| }; | ||
|
|
@@ -216,13 +193,6 @@ export default function UpdateSection() { | |
| Check for Updates | ||
| </Button> | ||
|
|
||
| {updateInfo.isUpdateAvailable && updateStatus === 'idle' && ( | ||
| <Button onClick={downloadAndInstallUpdate} variant="secondary" size="sm"> | ||
| <Download className="w-3 h-3 mr-1" /> | ||
| Download Update | ||
| </Button> | ||
| )} | ||
|
|
||
| {updateStatus === 'ready' && ( | ||
| <Button onClick={installUpdate} variant="default" size="sm"> | ||
| Install & Restart | ||
|
|
@@ -247,12 +217,21 @@ export default function UpdateSection() { | |
| )} | ||
|
|
||
| {/* Update information */} | ||
| {updateInfo.isUpdateAvailable && ( | ||
| {updateInfo.isUpdateAvailable && updateStatus === 'idle' && ( | ||
| <div className="text-xs text-text-muted mt-4 space-y-1"> | ||
| <p>Update will be downloaded automatically in the background.</p> | ||
| <p className="text-xs text-green-600"> | ||
| The update will be installed automatically when you quit the app. | ||
| </p> | ||
| </div> | ||
| )} | ||
|
|
||
|
Comment on lines
+220
to
+228
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. expected behavior for signed build |
||
| {updateStatus === 'ready' && ( | ||
| <div className="text-xs text-text-muted mt-4 space-y-1"> | ||
| <p>Update will be downloaded to your Downloads folder.</p> | ||
| <p className="text-xs text-amber-600"> | ||
| Note: After downloading, you'll need to close the app and manually install the update. | ||
| <p className="text-xs text-green-600"> | ||
| Update is ready! It will be installed when you quit Goose. | ||
| </p> | ||
| <p className="text-xs text-text-muted">Or click "Install & Restart" to update now.</p> | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,7 @@ export class GitHubUpdater { | |
| log.info(`GitHubUpdater: Looking for asset named: ${assetName}`); | ||
| log.info(`GitHubUpdater: Available assets: ${release.assets.map((a) => a.name).join(', ')}`); | ||
|
|
||
| const asset = release.assets.find((a) => a.name === assetName); | ||
| const asset = release.assets.find((a) => a.name.toLowerCase() === assetName); // keeping comparisms to lower case becasue Goose vs goose | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought about either changing the hardcoded values in lines 94-103 or keeping this normalized comparison. Let me know if i should change the hardcoded values instead. |
||
| if (asset) { | ||
| downloadUrl = asset.browser_download_url; | ||
| log.info(`GitHubUpdater: Found matching asset: ${asset.name} (${asset.size} bytes)`); | ||
|
|
@@ -115,6 +115,12 @@ export class GitHubUpdater { | |
| log.warn(`GitHubUpdater: No matching asset found for ${assetName}`); | ||
| } | ||
|
|
||
| if (!downloadUrl) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. edge case - update is available but no asset match. |
||
| throw new Error( | ||
| `Update Available but no download URL found for platform: ${platform}, arch: ${arch}` | ||
| ); | ||
| } | ||
|
|
||
| return { | ||
| updateAvailable: true, | ||
| latestVersion, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed as downloads are automatic now