Browse Source

fix: resolve Electron auto-updater 404 errors

- Update repository URL to correct Gitea location
- Disable auto-updates due to Gitea hosting limitations
- Remove GitHub provider configuration from electron-builder
- Add comprehensive documentation for future update strategies
- Fixes HttpError 404 when checking for GitHub releases

The app was trying to check for updates on GitHub but the repository
is hosted on Gitea. Auto-updates are now disabled with manual
distribution as the current update mechanism.
pull/142/head
Matthew Raymer 2 weeks ago
parent
commit
2a9b6a6444
  1. 174
      docs/electron-auto-updates.md
  2. 3
      electron/electron-builder.config.json
  3. 2
      electron/package.json
  4. 26
      electron/src/index.ts

174
docs/electron-auto-updates.md

@ -0,0 +1,174 @@
# Electron Auto-Updates Configuration
**Author**: Matthew Raymer
**Date**: 2025-07-12
**Status**: **DISABLED** - Manual Updates Only
## Overview
TimeSafari's Electron application currently has auto-updates disabled due to hosting on Gitea instead of GitHub. This document explains the current configuration and provides guidance for future update mechanisms.
## Current Status
### Auto-Updates Disabled
Auto-updates are currently disabled for the following reasons:
1. **Repository Hosting**: The project is hosted on Gitea (`https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa`) rather than GitHub
2. **Provider Limitations**: `electron-updater` primarily supports GitHub, S3, and other major cloud providers
3. **404 Errors**: Attempting to use GitHub auto-updates with a Gitea repository causes 404 errors
### Configuration Changes Made
1. **Repository URL Updated**: Changed from `https://github.com/trentlarson/crowd-master` to the correct Gitea URL
2. **Publish Configuration Removed**: Removed GitHub provider from `electron-builder.config.json`
3. **Auto-Updater Disabled**: Commented out auto-updater code in `electron/src/index.ts`
## Error Resolution
The original error:
```
HttpError: 404
"method: GET url: https://github.com/trentlarson/crowd-master/releases.atom"
```
This occurred because:
- The app was trying to check for updates on GitHub
- The repository doesn't exist on GitHub
- The auto-updater was configured for GitHub releases
## Future Update Options
### Option 1: Manual Distribution
- Build and distribute packages manually
- Users download and install new versions manually
- No automatic update checking
### Option 2: Custom Update Server
- Implement a custom update server compatible with `electron-updater`
- Host update files on a web server
- Configure custom update endpoints
### Option 3: GitHub Migration
- Move repository to GitHub
- Set up GitHub releases
- Re-enable auto-updates
### Option 4: Alternative Update Providers
- Use S3 or other supported providers
- Implement custom update mechanism
- Use third-party update services
## Current Build Process
### Development Builds
```bash
npm run build:electron:dev
```
### Production Builds
```bash
npm run build:electron:prod
```
### Package Distribution
```bash
# Windows
npm run build:electron:windows:prod
# macOS
npm run build:electron:mac:prod
# Linux
npm run build:electron:linux:prod
```
## Manual Update Process
1. **Build New Version**: Use appropriate build script
2. **Test Package**: Verify the built package works correctly
3. **Distribute**: Share the package with users
4. **User Installation**: Users manually download and install
## Security Considerations
### Disabled Auto-Updates
- No automatic security updates
- Users must manually update for security patches
- Consider implementing update notifications
### Package Verification
- Verify package integrity before distribution
- Use code signing for packages
- Implement checksum verification
## Monitoring and Maintenance
### Version Tracking
- Track application versions manually
- Document changes between versions
- Maintain changelog for users
### User Communication
- Notify users of available updates
- Provide clear update instructions
- Document breaking changes
## Recommendations
### Short Term
1. Continue with manual distribution
2. Implement update notifications in-app
3. Provide clear update instructions
### Long Term
1. Evaluate hosting platform options
2. Consider implementing custom update server
3. Plan for automated update mechanism
## Configuration Files
### electron-builder.config.json
```json
{
"appId": "app.timesafari.desktop",
"productName": "TimeSafari",
// publish configuration removed
}
```
### electron/src/index.ts
```typescript
// Auto-updater disabled
// import { autoUpdater } from 'electron-updater';
// Auto-updates disabled - not supported on Gitea hosting
// if (!electronIsDev && !process.env.APPIMAGE) {
// try {
// autoUpdater.checkForUpdatesAndNotify();
// } catch (error) {
// console.log('Update check failed (suppressed):', error);
// }
// }
```
## Troubleshooting
### Common Issues
1. **404 Errors**: Ensure repository URL is correct
2. **Build Failures**: Check build configuration
3. **Package Issues**: Verify package contents
### Debug Mode
```bash
# Enable debug logging
DEBUG=* npm run build:electron:dev
```
---
**Status**: Auto-updates disabled
**Last Updated**: 2025-07-12
**Version**: 1.0
**Maintainer**: Matthew Raymer

3
electron/electron-builder.config.json

@ -11,9 +11,6 @@
"capacitor.config.*", "capacitor.config.*",
"app/**/*" "app/**/*"
], ],
"publish": {
"provider": "github"
},
"linux": { "linux": {
"target": [ "target": [
{ {

2
electron/package.json

@ -9,7 +9,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/trentlarson/crowd-master" "url": "https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa"
}, },
"license": "MIT", "license": "MIT",
"main": "build/src/index.js", "main": "build/src/index.js",

26
electron/src/index.ts

@ -4,7 +4,7 @@ import type { MenuItemConstructorOptions } from 'electron';
import { app, MenuItem, ipcMain, dialog } from 'electron'; import { app, MenuItem, ipcMain, dialog } from 'electron';
import electronIsDev from 'electron-is-dev'; import electronIsDev from 'electron-is-dev';
import unhandled from 'electron-unhandled'; import unhandled from 'electron-unhandled';
import { autoUpdater } from 'electron-updater'; // import { autoUpdater } from 'electron-updater';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import { join } from 'path'; import { join } from 'path';
@ -73,10 +73,11 @@ if (electronIsDev) {
} }
// Configure auto-updater // Configure auto-updater
autoUpdater.on('error', (error) => { // DISABLED: Auto-updates not supported on Gitea hosting
console.log('Auto-updater error (suppressed):', error.message); // autoUpdater.on('error', (error) => {
// Don't show error dialogs for update check failures // console.log('Auto-updater error (suppressed):', error.message);
}); // // Don't show error dialogs for update check failures
// });
// Run Application // Run Application
(async () => { (async () => {
@ -112,14 +113,15 @@ autoUpdater.on('error', (error) => {
} }
}); });
// Auto-updates disabled - not supported on Gitea hosting
// Only check for updates in production builds, not in development or AppImage // Only check for updates in production builds, not in development or AppImage
if (!electronIsDev && !process.env.APPIMAGE) { // if (!electronIsDev && !process.env.APPIMAGE) {
try { // try {
autoUpdater.checkForUpdatesAndNotify(); // autoUpdater.checkForUpdatesAndNotify();
} catch (error) { // } catch (error) {
console.log('Update check failed (suppressed):', error); // console.log('Update check failed (suppressed):', error);
} // }
} // }
})(); })();
// Handle when all of our windows are close (platforms have their own expectations). // Handle when all of our windows are close (platforms have their own expectations).

Loading…
Cancel
Save